Skip to content

Commit

Permalink
Calling jenkins job builder with no config file
Browse files Browse the repository at this point in the history
I come with better solution for issue RHQE#41. Instead of injecting password to all
jobs, which update or create some other job, I change the way how xml for
updating/creating job is obtained from source yaml file.

In case jekins job builder does not need access to Jenkins instance, it is called
without any config file.
  • Loading branch information
mkluson committed Dec 21, 2016
1 parent 9911a63 commit d6d518f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 0 additions & 3 deletions build-on-push/jjb/platform-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@
job-commit-dispatcher.sh "{component}" "$GIT_BRANCH" "{github-user}" "{platform-ci-branch}"
wrappers:
- default-ci-workflow-wrappers
- inject-passwords:
global: true
mask-password-params: true

- job-template:
name: 'ci-{component}-dispatcher-commit'
Expand Down
9 changes: 8 additions & 1 deletion build-on-push/platform_ci/platform_ci/jjb.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def get_job_as_xml(self, job):

jjb_xml = subprocess.Popen(to_execute, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]

if not jjb_xml:
if not jjb_xml and os.getenv("JOB_BUILDER_PASS", None):
jjb_user = os.environ["JOB_BUILDER_USER"]
jjb_password = os.environ["JOB_BUILDER_PASS"]

Expand All @@ -91,4 +91,11 @@ def get_job_as_xml(self, job):

jjb_xml = subprocess.Popen(to_execute, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]

if not jjb_xml:
# This is for case job doesn't have credentials and update fail with config containing just url.
# It should pass without any config at all
# Only jobs, which really need credentials, have access to them.
to_execute = ["jenkins-jobs", "test", self.workdir, job.name]
jjb_xml = subprocess.Popen(to_execute, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]

return jjb_xml

0 comments on commit d6d518f

Please sign in to comment.