Merge "Enable ignore_cache flag on jenkins_jobs.ini"

This commit is contained in:
Jenkins 2013-12-12 04:41:11 +00:00 committed by Gerrit Code Review
commit 7959bf44db
3 changed files with 16 additions and 1 deletions

View File

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

View File

@ -2,3 +2,4 @@
user=jenkins user=jenkins
password=1234567890abcdef1234567890abcdef password=1234567890abcdef1234567890abcdef
url=https://jenkins.example.com 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", "url", "http://localhost:8080")
config.set("jenkins", "user", None) config.set("jenkins", "user", None)
config.set("jenkins", "password", None) config.set("jenkins", "password", None)
config.set("jenkins", "ignore_cache", False)
logger.debug("Not reading config for test output generation") logger.debug("Not reading config for test output generation")
else: else:
raise jenkins_jobs.errors.JenkinsJobsException( raise jenkins_jobs.errors.JenkinsJobsException(
"A valid configuration file is required when not run as a test") "A valid configuration file is required when not run as a test")
logger.debug("Config: {0}".format(config)) 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'), builder = jenkins_jobs.builder.Builder(config.get('jenkins', 'url'),
config.get('jenkins', 'user'), config.get('jenkins', 'user'),
config.get('jenkins', 'password'), config.get('jenkins', 'password'),
config, config,
ignore_cache=options.ignore_cache, ignore_cache=ignore_cache,
flush_cache=options.flush_cache) flush_cache=options.flush_cache)
if options.command == 'delete': if options.command == 'delete':