mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
ci: run jjb-validate batch job against a PR
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>
This commit is contained in:
parent
fef7bfdf23
commit
5f9222d7ee
@ -27,7 +27,7 @@ objects:
|
||||
- name: GIT_REPO
|
||||
value: https://github.com/ceph/ceph-csi
|
||||
- name: GIT_REF
|
||||
value: ci/centos
|
||||
value: "${GIT_REF}"
|
||||
- name: MAKE_TARGET
|
||||
value: deploy
|
||||
volumeMounts:
|
||||
@ -43,3 +43,7 @@ parameters:
|
||||
- name: SESSION
|
||||
description: unique ID for the session to track the pod for the job
|
||||
required: true
|
||||
- name: GIT_REF
|
||||
description: the git branch or other ref to checkout and deploy
|
||||
value: ci/centos
|
||||
required: false
|
||||
|
@ -27,9 +27,13 @@ objects:
|
||||
- name: GIT_REPO
|
||||
value: https://github.com/ceph/ceph-csi
|
||||
- name: GIT_REF
|
||||
value: ci/centos
|
||||
value: "${GIT_REF}"
|
||||
restartPolicy: Never
|
||||
parameters:
|
||||
- name: SESSION
|
||||
description: unique ID for the session to track the pod for the job
|
||||
required: true
|
||||
- name: GIT_REF
|
||||
description: the git branch or other ref to checkout and validate
|
||||
value: ci/centos
|
||||
required: false
|
||||
|
@ -4,11 +4,17 @@
|
||||
# script will wait for completion of the validation, and uses the result of the
|
||||
# container to report the status.
|
||||
#
|
||||
# Usage:
|
||||
# - arguments to the script can be "validate" or "deploy"
|
||||
# - the GIT_REF environment variable is injected in the batch job so that it
|
||||
# can use a particular GitHub PR
|
||||
#
|
||||
|
||||
# error out in case a command fails
|
||||
set -e
|
||||
|
||||
CMD="${1}"
|
||||
GIT_REF=${GIT_REF:-"ci/centos"}
|
||||
|
||||
get_pod_status() {
|
||||
oc get "pod/${1}" --no-headers -o=jsonpath='{.status.phase}'
|
||||
@ -34,7 +40,7 @@ cd "$(dirname "${0}")"
|
||||
# unique ID for the session
|
||||
SESSION=$(uuidgen)
|
||||
|
||||
oc process -f "jjb-${CMD}.yaml" -p=SESSION="${SESSION}" | oc create -f -
|
||||
oc process -f "jjb-${CMD}.yaml" -p=SESSION="${SESSION}" -p=GIT_REF="${GIT_REF}" | oc create -f -
|
||||
|
||||
# loop until pod is available
|
||||
while true
|
||||
|
@ -25,7 +25,7 @@
|
||||
refspec: "${GIT_BRANCH}"]]])
|
||||
}
|
||||
stage('validation') {
|
||||
sh './deploy/jjb.sh validate'
|
||||
sh "GIT_REF=${GIT_BRANCH} ./deploy/jjb.sh validate"
|
||||
}
|
||||
}
|
||||
triggers:
|
||||
|
Loading…
Reference in New Issue
Block a user