forked from jfrog/jenkins-artifactory-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
48 lines (41 loc) · 1.72 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
45
46
47
48
node('java') {
cleanWs()
def jdktool = tool name: "1.8.0_102"
env.JAVA_HOME = jdktool
if ("$P_BUILD_MODE".toString().equals("Pre build actions")) {
git(
url: 'git@github.com:jenkinsci/artifactory-plugin.git',
credentialsId: 'jenkinsci-github-key'
)
stage('Initial install') {
def rtMaven = Artifactory.newMavenBuild()
rtMaven.tool = 'mvn-3.6.2'
rtMaven.run pom: 'pom.xml', goals: 'clean install'
}
stage('Pull') {
sh("git pull https://github.com/JFrog/jenkins-artifactory-plugin.git master")
}
stage('Install pulled code') {
def rtMaven = Artifactory.newMavenBuild()
rtMaven.tool = 'mvn-3.6.2'
rtMaven.run pom: 'pom.xml', goals: 'clean install'
}
stage('Push') {
sh("git push --set-upstream origin master")
}
stage ('Starting next job') {
build 'artifactory-jenkins-plugin'
}
}
if ("$P_BUILD_MODE".toString().equals("Post build merge")) {
git(
url: 'https://github.com/JFrog/jenkins-artifactory-plugin.git'
)
wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[password: 'GITHUB_API_KEY', var: 'SECRET']]]) {
sh("git pull https://github.com/jenkinsci/artifactory-plugin.git")
sh("git fetch https://github.com/jenkinsci/artifactory-plugin.git --tags")
sh("git push https://${GITHUB_USERNAME}:${GITHUB_API_KEY}@github.com/JFrog/jenkins-artifactory-plugin.git")
sh("git push https://${GITHUB_USERNAME}:${GITHUB_API_KEY}@github.com/JFrog/jenkins-artifactory-plugin.git --tags")
}
}
}