Skip to content

Commit

Permalink
tests on tags fail
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume DeMengin committed Apr 2, 2022
1 parent 4fbc5aa commit ad0d662
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 10 deletions.
43 changes: 34 additions & 9 deletions .github/jenkins-lts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

# start jenkins, run job to test and wait for it to complete, then stop kenkins
run_job() {
function run_job() {
timeout 300 /manage_jenkins.sh start
sleep 10
timeout 300 /manage_jenkins.sh wait_for_jobs "$1"
Expand All @@ -12,10 +12,37 @@ run_job() {
/manage_jenkins.sh check_jobs_success "$1"
}

cd ${GITHUB_WORKSPACE}
[ "${GITHUB_EVENT_NAME}" == "pull_request" ] && git checkout -b ${GITHUB_SHA}
git status
git show -q
# using the current git tree as Global Pipeline Library may fail
# if HEAD is detached (pull-request, tag, ...)
# So clone current commit in a local repo with local branch
# the test job shall use that branch
function create_local_repo() {
local SRC=${GITHUB_WORKSPACE}/.git
local SHA=${GITHUB_SHA}
local DST=${GITHUB_WORKSPACE}/.tmp-test

rm -rf ${DST}
git clone file://${SRC} ${DST}
cd ${DST}
git status

# create dummy branch to be able to use this commit
git checkout -b ${SHA}

# show status and last commit
git status
git show -q
}

function clean() {
# cleanup temp filesi
rm -rf ${GITHUB_WORKSPACE}/.tmp-test

# sleep to capture logs in tail command
sleep 10
}

create_local_repo
echo GITHUB_SHA=${GITHUB_SHA}

cd /
Expand All @@ -28,12 +55,10 @@ JOBS="logparser"

run_job "${JOBS}" > stdout 2<&1|| {
return_code=$?
# sleep to capture logs in tail command
sleep 10
clean
echo "run_jobs failed, exiting"
exit ${return_code}
}

# sleep to capture logs in tail command
sleep 10
clean
echo "Happy End!"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<retriever class="org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever">
<scm class="jenkins.plugins.git.GitSCMSource" plugin="git@4.4.1">
<id>e5fafb6b-9224-4646-ad29-20f69699a92b</id>
<remote>file://${GITHUB_WORKSPACE}/.git</remote>
<remote>file://${GITHUB_WORKSPACE}/.tmp-test/.git</remote>
<credentialsId></credentialsId>
<traits>
<jenkins.plugins.git.traits.BranchDiscoveryTrait/>
Expand Down

0 comments on commit ad0d662

Please sign in to comment.