By using a template, it becomes possible to identify the Pod that has
been started by the Batch Job.
This prevents the script from getting the logs from an incorrect (old)
container.
Fixes: #1111
Signed-off-by: Niels de Vos <ndevos@redhat.com>
The jjb-validate job is not correct, it does not always return the
results of the PR.
Prevent triggering the job automatically, and only have it run when
someone leaves the '/test ci/centos/jjb-validate' comment.
Updates: #1111
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Using the 'git' function in groovy does not allow checking out a
non-branch, so use the 'checkout' function instead.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
The 'scm' section also needs to be a list. Jenkins Jobs Builder does not
detect this while validating, but it cause an error while updating the
jobs in Jenkins.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
In case there is no 'origin', jenkins-jobs fails with an error like:
jenkins_jobs.errors.JenkinsJobsException: Must specify a url for git remote "origin"
Signed-off-by: Niels de Vos <ndevos@redhat.com>
The directory that gets constructed can be like
`/opt/build/deploy/..//jobs` and this causes jenkins-jobs to fail.
Enternig the WORKDIR and passing the local ./jobs directory to
jenkins-jobs makes things clearer.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
There is a new .commitlintrc.yml file in the root of the repository.
This causes jenkins-job-builder to complains that the file is not
confirm the Jenkins Job Builder format/specification.
jenkins_jobs.errors.JenkinsJobsException: The topmost collection in file '/opt/build/.commitlintrc.yml' must be a list, not a <class 'collections.OrderedDict'>
Move all Jenkins Job Builder .yaml files to jobs/ so that all the
Jenkins job configurations are kept together without other files.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
The `git` command does not allow checking out a non-branch (like a PR),
so it is needed to use `checkout` instead.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
When checking out a PR for a non-master branch, `git clone` should
download the last commit of the branch. Adding a `--base=..` option to
pass the cloning of a selected branch, instead of `master`.
We also want to fetch all commits in the PR, so they can get tested with
`commitlint`. Only fetch --depth=1 the initial clone, but fetch
everything in the PR itself.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This job runs 'make' on the ci/centos branch (or Pull Request) so that
all MarkDown, shell-scripts and yaml files are validated.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This merges several files from the master branch into ci/centos so that
the scripts, MarkDown and yaml files can be checked.
Run 'make' or 'make test' to validate the contents of this branch.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
./README.md:51: MD012 Multiple consecutive blank lines
./README.md:10: MD025 Multiple top level headers in the same document
Signed-off-by: Niels de Vos <ndevos@redhat.com>
20:11 error wrong indentation: expected 12 but found 10 (indentation)
22:11 error wrong indentation: expected 12 but found 10 (indentation)
Signed-off-by: Niels de Vos <ndevos@redhat.com>
16:7 error wrong indentation: expected 8 but found 6 (indentation)
19:9 error wrong indentation: expected 10 but found 8 (indentation)
Signed-off-by: Niels de Vos <ndevos@redhat.com>
./deploy/jjb-deploy.yaml
16:7 error wrong indentation: expected 8 but found 6 (indentation)
19:9 error wrong indentation: expected 10 but found 8 (indentation)
26:9 error wrong indentation: expected 10 but found 8 (indentation)
30:7 error wrong indentation: expected 8 but found 6 (indentation)
Signed-off-by: Niels de Vos <ndevos@redhat.com>
In ./deploy/jjb.sh line 11:
oc get pod/${1} --no-headers -o=jsonpath='{.status.phase}'
^--^ SC2086: Double quote to prevent globbing and word splitting.
In ./deploy/jjb.sh line 29:
cd $(dirname ${0})
^----------------^ SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
^-------------^ SC2046: Quote this to prevent word splitting.
^--^ SC2086: Double quote to prevent globbing and word splitting.
In ./deploy/jjb.sh line 31:
oc create -f jjb-${CMD}.yaml
^----^ SC2086: Double quote to prevent globbing and word splitting.
In ./deploy/jjb.sh line 36:
jjb_pod=$(oc get pods --no-headers -l job-name=jjb-${CMD} -o=jsonpath='{.items[0].metadata.name}')
^----^ SC2086: Double quote to prevent globbing and word splitting.
In ./deploy/jjb.sh line 37:
[ ${?} = 0 ] && [ -n "${jjb_pod}" ] && break
^--^ SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
In ./deploy/jjb.sh line 46:
[ ${?} = 0 ] && ( [ "${status}" = "Succeeded" ] || [ "${status}" = "Failed" ] ) && break
^--^ SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
^-- SC2235: Use { ..; } instead of (..) to avoid subshell overhead.
In ./deploy/jjb.sh line 54:
oc delete --wait -f jjb-${CMD}.yaml
^----^ SC2086: Double quote to prevent globbing and word splitting.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
In ./prepare.sh line 21:
if [ $? -ne 0 ]
^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
In ./prepare.sh line 28:
eval set -- ${opts}
^-----^ SC2086: Double quote to prevent globbing and word splitting.
In ./prepare.sh line 55:
echo ${ref}
^----^ SC2086: Double quote to prevent globbing and word splitting.
In ./prepare.sh line 69:
git clone --depth=1 ${gitrepo} ${workdir}
^--------^ SC2086: Double quote to prevent globbing and word splitting.
^--------^ SC2086: Double quote to prevent globbing and word splitting.
In ./prepare.sh line 70:
cd ${workdir}
^-----------^ SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
^--------^ SC2086: Double quote to prevent globbing and word splitting.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
To prevent the failure of job due to unavailability
of a machine immediately, retry mechanism is used.
If unable to reserve a machine, it will retry every
5 mins for 30 times to avoid job failure.
Signed-off-by: Yug Gupta <ygupta@redhat.com>
These additional settings are required to trigger the job to run when a
GitHub PR gets created or updated. It is also possible to manually run
the job by leaving one of the following comments:
/test ci/centos/containerized-tests
/retest ci/centos/containerized-tests
/test all
/retest all
The 'all' has been added so that future jobs can catch this comment as
well and act on it.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
In case the environment variable is not set at all (as opposed to
empty), teh following error is reported while running the job:
groovy.lang.MissingPropertyException: No such property: ghprbPullId for class: groovy.lang.Binding
Signed-off-by: Niels de Vos <ndevos@redhat.com>
The script checks for ghprbPullId env variable
and if found unset, runs the script for master
to support regular builds.
Signed-off-by: Yug Gupta <ygupta@redhat.com>
Thse jobs run the deploy/jjb.sh script on a Jenkins Slave that is
configured with an environment for working with the `oc` command.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
These files make it possible to
- build a container image that includes Jenkins Job Builder
- store the container image in the OpenShift ImageStream
- use the container to validate or deploy the Jenkins Jobs
More details about the files are included in the README.md.
Signed-off-by: Niels de Vos <ndevos@redhat.com>