Skip to content

Commit cf45c66

Browse files
committed
Change in Jenkinsfile to upload the artifacts for branches different from develop and master to branch artifacts repo
QA-7545
1 parent 2d269dc commit cf45c66

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

Jenkinsfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,43 @@ pipeline {
104104
}
105105
}
106106
}
107+
stage('Branch Artifactory Deploy') {
108+
options {
109+
timeout(time: 5, unit: 'MINUTES')
110+
}
111+
when {
112+
not {
113+
anyOf {
114+
branch "master"
115+
branch "develop"
116+
}
117+
}
118+
}
119+
steps {
120+
script {
121+
getAndConfigureJFrogCLI()
122+
if (env.GIT_URL) {
123+
repoName = ("${env.GIT_URL}" =~ /(.*\/)(.*)(\.git)/)[ 0 ][ 2 ]
124+
findFiles(glob: 'target/*.jar').each { item ->
125+
if (!(item ==~ /.*\/fb-contrib-.*?.jar/) && !(item ==~ /.*\/findsecbugs-plugin-.*?.jar/) && !(item ==~ /.*-sources.jar/) && !(item ==~ /.*-javadoc.jar/)) {
126+
sh "./jfrog rt u \"${item.path}\" branch-artifacts/${env.BRANCH_NAME}/${repoName}/java/ --recursive=false --build-name ${env.BRANCH_NAME} --build-number ${env.BUILD_NUMBER} --props \"vcs.revision=${env.GIT_COMMIT};repo.name=${repoName}\""
127+
}
128+
}
129+
findFiles(glob: '**/pom.xml').each { item ->
130+
def pomPath = item.path.replace('\\','/')
131+
if (!(pomPath ==~ /.*target.*/)) {
132+
def resPomName = "main.pom"
133+
def subDirMatcher = (pomPath =~ /^.*(?<=\/|^)(.*)\/pom\.xml/)
134+
if (subDirMatcher.matches()) {
135+
resPomName = "${subDirMatcher[ 0 ][ 1 ]}.pom"
136+
}
137+
sh "./jfrog rt u \"${item.path}\" branch-artifacts/${env.BRANCH_NAME}/${repoName}/java/${resPomName} --recursive=false --build-name ${env.BRANCH_NAME} --build-number ${env.BUILD_NUMBER} --props \"vcs.revision=${env.GIT_COMMIT};repo.name=${repoName}\""
138+
}
139+
}
140+
}
141+
}
142+
}
143+
}
107144
stage('Archive Artifacts') {
108145
options {
109146
timeout(time: 5, unit: 'MINUTES')

0 commit comments

Comments
 (0)