In case the '--cmd' option is missing, usage() will be called and the
script exits with 0. A missing option is a failure, so make usage()
return and handle the exit status when usage() got called instead.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Add the ability to run JJB from private branch/fork
jjb-deploy.yaml:
- Add GIT_REPO parameter (not required) with default value
jjb.sh:
- Changing PS4 for more indicative debug prompt
- Adding flags to get the repo and branch
jjb-deploy.yaml:
- Calling the jjb.sh with the correct flags
Signed-off-by: liranmauda <liran.mauda@gmail.com>
The batch job templates for OpenShift use a GIT_REF variable that is
used by the jobs to checkout the repository. This defaults to
"ci/centos", but it never is adjusted when jjb-validate runs against a
PR.
With the new GIT_REF environment variable in the jjb.sh script, the
variable can now be used to checkout a PR from gitHub and run the
validation against that.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
On the new OCP4 cluster, deleting the batch job results in deletion of
the pod as well. Deleting the pod when it does not exist anymore results
in a failure. Ignoring the potential failure makes the job pass again.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Currently the number of Pods is growing in the OpenShift Console. The
pods are all Completed, so not running anymore, but there is also no
need to keep them around.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
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>
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>
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>