Skip to content

Commit

Permalink
fix failed builds in jenkinsfile
Browse files Browse the repository at this point in the history
  • Loading branch information
MonssafToukal authored and amontoison committed Feb 10, 2022
1 parent a35b79f commit c98f337
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
20 changes: 10 additions & 10 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,16 @@ pipeline {
stages {
stage('clone repo') {
when {
expression { REPO_EXISTS == 'false' }
expression { REPO_EXISTS == 'false' && env.comment }
}
steps {
sh 'git clone https://${GITHUB_AUTH}@github.com/$org/$repo.git'
}
}
stage('checkout on new branch') {
when {
expression { env.comment }
}
steps {
dir(WORKSPACE + "/$repo") {
sh '''
Expand All @@ -87,6 +90,9 @@ pipeline {
}
}
stage('run benchmarks') {
when {
expression {env.comment}
}
steps {
script {
def data = env.comment.tokenize(' ')
Expand All @@ -95,9 +101,9 @@ pipeline {
}
}
dir(WORKSPACE + "/$repo") {
sh "mkdir -p $HOME/benchmarks/${org}/${repo}"
sh "qsub -N ${repo}_${pullrequest} -V -cwd -o $HOME/benchmarks/${org}/${repo}/${pullrequest}_${BUILD_NUMBER}_bmark_output.log -e $HOME/benchmarks/${org}/${repo}/${pullrequest}_${BUILD_NUMBER}_bmark_error.log benchmark/push_benchmarks.sh $bmarkFile"
}
sh "mkdir -p $HOME/benchmarks/${org}/${repo}"
sh "qsub -N ${repo}_${pullrequest} -V -cwd -o $HOME/benchmarks/${org}/${repo}/${pullrequest}_${BUILD_NUMBER}_bmark_output.log -e $HOME/benchmarks/${org}/${repo}/${pullrequest}_${BUILD_NUMBER}_bmark_error.log benchmark/push_benchmarks.sh $bmarkFile"
}
}
}
}
Expand All @@ -106,13 +112,7 @@ pipeline {
echo "SUCCESS!"
}
cleanup {
dir(WORKSPACE + "/$repo") {
sh 'printenv'
sh '''
git clean -fd
git checkout main
'''
}
}
}
}
Expand Down
16 changes: 14 additions & 2 deletions benchmark/push_benchmarks.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#!/bin/bash

set -e
git clean -fd
git checkout main
git pull origin main
git fetch origin
LOCAL_BRANCH_NAME="temp_bmark"
git branch -D $LOCAL_BRANCH_NAME || true
git fetch origin pull/$pullrequest/head:$LOCAL_BRANCH_NAME
git checkout $LOCAL_BRANCH_NAME -- || true

julia --project=benchmark -E 'using Pkg; Pkg.resolve()'
julia --project=benchmark benchmark/send_comment_to_pr.jl -o $org -r $repo -p $pullrequest -c '**Starting benchmarks!**'

LOCAL_BRANCH_NAME="temp_bmark"
git checkout $LOCAL_BRANCH_NAME -- || true

julia --project=benchmark benchmark/$1 $repo

Expand All @@ -14,3 +22,7 @@ else
ERROR_LOGS="/home/jenkins/benchmarks/$org/$repo/${pullrequest}_${BUILD_NUMBER}_bmark_error.log"
julia --project=benchmark benchmark/send_comment_to_pr.jl -o $org -r $repo -p $pullrequest -c "**An error occured while running $1**" -g $ERROR_LOGS
fi

git clean -fd
git reset --hard
git checkout main

0 comments on commit c98f337

Please sign in to comment.