-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbash-pipeline
54 lines (49 loc) · 2.03 KB
/
bash-pipeline
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '30'))
}
stages {
stage('Main') {
steps {
cleanWs()
script {
echo "JOB_NAME:[${env.JOB_NAME}]"
echo "SCRIPT:[${env.PATH_TO_SCRIPT}]"
// warning, GIT_BRANCH var alreads points to pipeline's branch
if ( env.GIT_REPOSITORY_BRANCH == null || "".equals("${env.GIT_REPOSITORY_BRANCH}") ) {
env.GIT_REPOSITORY_BRANCH = "master"
}
echo "GIT_REPOSITORY_BRANCH:[${env.GIT_REPOSITORY_BRANCH}]"
}
dir('hera') {
git 'https://github.com/jboss-set/hera.git'
}
dir('workdir') {
git url: "${env.GIT_REPOSITORY_URL}",
branch: "${env.GIT_REPOSITORY_BRANCH}"
}
script {
env.BUILD_SCRIPT = "${env.WORKSPACE}/workdir/${env.PATH_TO_SCRIPT}"
env.WORKDIR = "${env.WORKSPACE}/workdir/"
sh label: '', script: "${env.WORKSPACE}/hera/hera.sh run"
sh label: '', script: "${env.WORKSPACE}/hera/hera.sh job"
archiveArtifacts artifacts: 'workdir/**/*', fingerprint: true, followSymlinks: false, onlyIfSuccessful: true
step([$class: "TapPublisher", testResults: "workdir/*.tap"])
publishHTML([allowMissing: true, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'workdir', reportFiles: 'shellcheck.html', reportName: 'Shellcheck Report', reportTitles: ''])
}
}
}
}
post {
always {
script {
try {
sh label: '', script: "${env.WORKSPACE}/hera/hera.sh stop"
} catch (err) {
echo "Error while deleting container: ${err}"
}
}
}
}
}