forked from jenkins-infra/repository-permissions-updater
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
44 lines (39 loc) · 1.5 KB
/
Jenkinsfile
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
properties([
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '10']],
[$class: 'PipelineTriggersJobProperty', triggers: [
[$class: 'SCMTrigger', scmpoll_spec: 'H/2 * * * *', ignorePostCommitHooks: false],
cron('H/30 * * * *')
]]
])
/* Exit early if we are executing in a pull request, until this ticket is resolved:
* https://issues.jenkins-ci.org/browse/INFRA-902
*/
if (env.CHANGE_ID) {
return
}
node('java') {
try {
stage 'Clean'
deleteDir()
sh 'ls -lah'
stage 'Checkout'
checkout scm
stage 'Build'
def mvnHome = tool 'mvn'
env.JAVA_HOME = tool 'jdk8'
sh "${mvnHome}/bin/mvn -U clean verify"
stage 'Run'
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'artifactoryAdmin',
usernameVariable: 'ARTIFACTORY_USERNAME', passwordVariable: 'ARTIFACTORY_PASSWORD']]) {
sh '${JAVA_HOME}/bin/java' +
' -DdefinitionsDir=$PWD/permissions' +
' -DartifactoryApiTempDir=$PWD/json' +
' -Djava.util.logging.SimpleFormatter.format="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s: %5$s%6$s%n"' +
' -jar target/repository-permissions-updater-*-bin/repository-permissions-updater-*.jar'
}
} finally {
stage 'Archive'
archiveArtifacts 'permissions/*.yml'
archiveArtifacts 'json/*.json'
}
}