Enable ignore_cache flag on jenkins_jobs.ini

Parses jenkins_jobs.ini to look for an ignore_cache flag.
If ignore_cache command line option is sent, it takes priority
over the jenkins_jobs.ini configuration.

Change-Id: I88f1ce1aa0d3e0ad25d592d3ca44a022ec9249c3
Closes-Bug: #1193444
This commit is contained in:
Yolanda Robla 2013-12-02 19:41:20 +01:00
parent 04be0f43ad
commit b123c13e99
3 changed files with 16 additions and 1 deletions

View File

@ -44,6 +44,7 @@ the following format::
user=USERNAME
password=PASSWORD
url=JENKINS_URL
ignore_cache=IGNORE_CACHE_FLAG
**user**
This should be the name of a user previously defined in Jenkins.
@ -60,6 +61,10 @@ the following format::
**url**
The base URL for your Jenkins installation.
**ignore_cache**
(Optional) If set to True, jenkins job builder
won't be using any cache.
Running
-------

View File

@ -2,3 +2,4 @@
user=jenkins
password=1234567890abcdef1234567890abcdef
url=https://jenkins.example.com
ignore_cache=True

View File

@ -90,17 +90,26 @@ def main():
config.set("jenkins", "url", "http://localhost:8080")
config.set("jenkins", "user", None)
config.set("jenkins", "password", None)
config.set("jenkins", "ignore_cache", False)
logger.debug("Not reading config for test output generation")
else:
raise jenkins_jobs.errors.JenkinsJobsException(
"A valid configuration file is required when not run as a test")
logger.debug("Config: {0}".format(config))
# check the ignore_cache setting: first from command line,
# if not present check from ini file
ignore_cache = False
if options.ignore_cache:
ignore_cache = options.ignore_cache
elif config.has_option('jenkins', 'ignore_cache'):
ignore_cache = config.get('jenkins', 'ignore_cache')
builder = jenkins_jobs.builder.Builder(config.get('jenkins', 'url'),
config.get('jenkins', 'user'),
config.get('jenkins', 'password'),
config,
ignore_cache=options.ignore_cache,
ignore_cache=ignore_cache,
flush_cache=options.flush_cache)
if options.command == 'delete':