ci: do not re-checkout current branch

When tests are started manually (through the Jenkins webui), there is no
PR associated with the job. That means the `git_since` and `ref` are
equal. Trying to create a new branch named `ref` will not work, as the
branch was already created when cloning the repository with `git_since`.

With this change, Jenkins jobs can be started manually. This makes it
possible to run regular/nightly jobs as well.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2021-04-07 18:09:56 +02:00 committed by mergify[bot]
parent e030097eaa
commit 8f84e592d5
6 changed files with 18 additions and 6 deletions

View File

@ -29,7 +29,9 @@ node('cico-workspace') {
}
sh "git clone --depth=1 --branch='${git_since}' '${git_repo}' ~/build/ceph-csi"
sh "cd ~/build/ceph-csi && git fetch origin ${ref} && git checkout -b ${ref} FETCH_HEAD"
if (ref != git_since) {
sh "cd ~/build/ceph-csi && git fetch origin ${ref} && git checkout -b ${ref} FETCH_HEAD"
}
}
stage('check doc-only change') {

View File

@ -47,7 +47,9 @@ node('cico-workspace') {
}
sh "git clone --depth=1 --branch='${git_since}' '${git_repo}' ~/build/ceph-csi"
sh "cd ~/build/ceph-csi && git fetch origin ${ref} && git checkout -b ${ref} FETCH_HEAD"
if (ref != git_since) {
sh "cd ~/build/ceph-csi && git fetch origin ${ref} && git checkout -b ${ref} FETCH_HEAD"
}
}
stage('check doc-only change') {

View File

@ -57,7 +57,9 @@ node('cico-workspace') {
}
sh "git clone --depth=1 --branch='${git_since}' '${git_repo}' ~/build/ceph-csi"
sh "cd ~/build/ceph-csi && git fetch origin ${ref} && git checkout -b ${ref} FETCH_HEAD"
if (ref != git_since) {
sh "cd ~/build/ceph-csi && git fetch origin ${ref} && git checkout -b ${ref} FETCH_HEAD"
}
}
stage('check doc-only change') {

View File

@ -73,7 +73,9 @@ node('cico-workspace') {
}
sh "git clone --depth=1 --branch='${git_since}' '${git_repo}' ~/build/ceph-csi"
sh "cd ~/build/ceph-csi && git fetch origin ${ref} && git checkout -b ${ref} FETCH_HEAD"
if (ref != git_since) {
sh "cd ~/build/ceph-csi && git fetch origin ${ref} && git checkout -b ${ref} FETCH_HEAD"
}
}
stage('check doc-only change') {

View File

@ -70,7 +70,9 @@ node('cico-workspace') {
}
sh "git clone --depth=1 --branch='${git_since}' '${git_repo}' ~/build/ceph-csi"
sh "cd ~/build/ceph-csi && git fetch origin ${ref} && git checkout -b ${ref} FETCH_HEAD"
if (ref != git_since) {
sh "cd ~/build/ceph-csi && git fetch origin ${ref} && git checkout -b ${ref} FETCH_HEAD"
}
}
stage('check doc-only change') {

View File

@ -70,7 +70,9 @@ node('cico-workspace') {
}
sh "git clone --depth=1 --branch='${git_since}' '${git_repo}' ~/build/ceph-csi"
sh "cd ~/build/ceph-csi && git fetch origin ${ref} && git checkout -b ${ref} FETCH_HEAD"
if (ref != git_since) {
sh "cd ~/build/ceph-csi && git fetch origin ${ref} && git checkout -b ${ref} FETCH_HEAD"
}
}
stage('check doc-only change') {