mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-01-18 02:39:30 +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
|
- name: GIT_REPO
|
||||||
value: https://github.com/ceph/ceph-csi
|
value: https://github.com/ceph/ceph-csi
|
||||||
- name: GIT_REF
|
- name: GIT_REF
|
||||||
value: ci/centos
|
value: "${GIT_REF}"
|
||||||
- name: MAKE_TARGET
|
- name: MAKE_TARGET
|
||||||
value: deploy
|
value: deploy
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
@ -43,3 +43,7 @@ parameters:
|
|||||||
- name: SESSION
|
- name: SESSION
|
||||||
description: unique ID for the session to track the pod for the job
|
description: unique ID for the session to track the pod for the job
|
||||||
required: true
|
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
|
- name: GIT_REPO
|
||||||
value: https://github.com/ceph/ceph-csi
|
value: https://github.com/ceph/ceph-csi
|
||||||
- name: GIT_REF
|
- name: GIT_REF
|
||||||
value: ci/centos
|
value: "${GIT_REF}"
|
||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
parameters:
|
parameters:
|
||||||
- name: SESSION
|
- name: SESSION
|
||||||
description: unique ID for the session to track the pod for the job
|
description: unique ID for the session to track the pod for the job
|
||||||
required: true
|
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
|
# script will wait for completion of the validation, and uses the result of the
|
||||||
# container to report the status.
|
# 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
|
# error out in case a command fails
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
CMD="${1}"
|
CMD="${1}"
|
||||||
|
GIT_REF=${GIT_REF:-"ci/centos"}
|
||||||
|
|
||||||
get_pod_status() {
|
get_pod_status() {
|
||||||
oc get "pod/${1}" --no-headers -o=jsonpath='{.status.phase}'
|
oc get "pod/${1}" --no-headers -o=jsonpath='{.status.phase}'
|
||||||
@ -34,7 +40,7 @@ cd "$(dirname "${0}")"
|
|||||||
# unique ID for the session
|
# unique ID for the session
|
||||||
SESSION=$(uuidgen)
|
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
|
# loop until pod is available
|
||||||
while true
|
while true
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
refspec: "${GIT_BRANCH}"]]])
|
refspec: "${GIT_BRANCH}"]]])
|
||||||
}
|
}
|
||||||
stage('validation') {
|
stage('validation') {
|
||||||
sh './deploy/jjb.sh validate'
|
sh "GIT_REF=${GIT_BRANCH} ./deploy/jjb.sh validate"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
triggers:
|
triggers:
|
||||||
|
Loading…
Reference in New Issue
Block a user