Skip to content

Commit 52d8329

Browse files
Pushing v7.9.0 changes
Pushing v7.9.0 changes
1 parent 559fb89 commit 52d8329

File tree

268 files changed

+15558
-1669
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

268 files changed

+15558
-1669
lines changed

Jenkinsfile

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!groovy
2+
//JRS REST clients
3+
4+
pipeline {
5+
agent { label 'qaa' }
6+
options {
7+
timeout(time: 1, unit: 'HOURS')
8+
buildDiscarder(logRotator(artifactNumToKeepStr: '5'))
9+
timestamps()
10+
}
11+
environment {
12+
PROD_MVNREPO_SERVER_ID = 'jaspersoft-jfrog-io'
13+
PROD_SNAPSHOT_REPO = 'jaspersoft-clients-snapshots'
14+
PROD_PROD_REPO = 'jaspersoft-clients-releases'
15+
16+
DEV_MVNREPO_SERVER_ID = 'mvnrepo-jaspersoft-com'
17+
DEV_SNAPSHOT_REPO = 'rest-client-test'
18+
DEV_PROD_REPO = 'rest-client-test-prod'
19+
20+
RESOLVE_REPO_ID = "${env.DEV_MVNREPO_SERVER_ID}"
21+
RESOLVE_REPO = 'repo'
22+
23+
devBuild = JENKINS_URL.contains('-dev')
24+
25+
MVNREPO_SERVER_ID = "${devBuild ? env.DEV_MVNREPO_SERVER_ID : env.PROD_MVNREPO_SERVER_ID}"
26+
SNAPSHOT_REPO = "${devBuild ? env.DEV_SNAPSHOT_REPO : env.PROD_SNAPSHOT_REPO}"
27+
PROD_REPO = "${devBuild ? env.DEV_PROD_REPO : env.PROD_PROD_REPO}"
28+
29+
MVN_NAME = 'mvn-default'
30+
JDK_NAME = 'jdk-default'
31+
32+
}
33+
tools {
34+
maven env.MVN_NAME
35+
jdk env.JDK_NAME
36+
}
37+
stages {
38+
stage('Configure') {
39+
steps {
40+
rtMavenResolver (
41+
id: "maven-resolver-${env.JOB_BASE_NAME}",
42+
serverId: "${env.RESOLVE_REPO_ID}",
43+
releaseRepo: "${env.RESOLVE_REPO}",
44+
snapshotRepo: "${env.RESOLVE_REPO}",
45+
)
46+
rtMavenDeployer (
47+
id: "maven-deployer-${env.JOB_BASE_NAME}",
48+
serverId: "${env.MVNREPO_SERVER_ID}",
49+
releaseRepo: "${env.PROD_REPO}",
50+
snapshotRepo: "${env.SNAPSHOT_REPO}",
51+
)
52+
rtBuildInfo (
53+
captureEnv: true,
54+
)
55+
}
56+
}
57+
stage('Build'){
58+
steps {
59+
rtMavenRun (
60+
pom: 'pom.xml',
61+
goals: "clean install source:jar --update-snapshots -Dmaven.repo.local=${env.WORKSPACE}/.m2/repository --batch-mode",
62+
/* Not working, bug recently fixed and not yet released. See https://github.com/jfrog/jenkins-artifactory-plugin/pull/139 and HAP-1183
63+
opts: "--update-snapshots -Dmaven.repo.local=${env.WORKSPACE}/.m2/repository --batch-mode",
64+
*/
65+
resolverId: "maven-resolver-${env.JOB_BASE_NAME}",
66+
deployerId: "maven-deployer-${env.JOB_BASE_NAME}",
67+
)
68+
}
69+
}
70+
}
71+
post {
72+
success {
73+
archiveArtifacts allowEmptyArchive: true, artifacts: '**/target/*.jar'
74+
script {
75+
echo "devBuid: ${env.devBuild}, server: ${env.MVNREPO_SERVER_ID}, snapshots: ${env.SNAPSHOT_REPO}, release: ${env.PROD_REPO}, JENKINS_URL: ${JENKINS_URL}"
76+
step([$class: 'Publisher', reportFilenamePattern: '**/target/*-reports/*.xml' ])
77+
}
78+
rtPublishBuildInfo (
79+
serverId: "${env.MVNREPO_SERVER_ID}",
80+
)
81+
rtAddInteractivePromotion (
82+
serverId: "${env.MVNREPO_SERVER_ID}",
83+
targetRepo: "${env.PROD_REPO}",
84+
sourceRepo: "${env.SNAPSHOT_REPO}",
85+
copy: true,
86+
)
87+
}
88+
cleanup {
89+
cleanWs()
90+
}
91+
}
92+
}

README.Jenkinsfile.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# JRS java REST client build setup via pipeline
2+
3+
## Builds
4+
Every branch with exisiting `Jenkisfile` will be picked up by CI and built
5+
Exceptions:
6+
* branches containing `dev-` in names are built on development CI
7+
* branches containing `dev-` in names are **not** built on production CI
8+
9+
## Pipeline
10+
`Jenkinsfile` uses [Declarative Pipeline](
11+
https://jenkins.io/doc/book/pipeline/syntax/#declarative-pipeline)
12+
syntax.
13+
`rtMavenResolver`, `rtMavenDeployer`, `rtBuildInfo`, `rtMavenRun`, `rtPublishBuildInfo` and
14+
`rtAddInteractivePromotion` are declarative steps for [Jenkins Artifactory Plugin](
15+
https://github.com/JFrog/jenkins-artifactory-plugin) and are documented in
16+
[Working With Pipeline Jobs in Jenkins](https://www.jfrog.com/confluence/display/RTF/Working+With+Pipeline+Jobs+in+Jenkins)
17+
18+
## Flowchart
19+
```mermaid
20+
graph TB
21+
subgraph agent 'qaa'
22+
subgraph pipeline options, environment and tools
23+
A1[Setup pipeline]
24+
end
25+
subgraph stages
26+
subgraph stage Configure
27+
A1 --> B1["Configure (artifactory pipeline plugin)"]
28+
end
29+
subgraph stage Build
30+
B1 --> B2["Build (run Maven via artifactory pipeline plugin)"]
31+
end
32+
end
33+
subgraph Post-build
34+
subgraph success
35+
B2 --> C2[archive artifacts]
36+
C2 --> C3[publish test results]
37+
C3 --> C4[Set buildInfo and interactive promotion artifactory plugin]
38+
end
39+
A1 --> |Timeout or Error | E2
40+
subgraph always
41+
E2[Remove workspace]
42+
end
43+
C4 --> E2
44+
end
45+
end
46+
```

0 commit comments

Comments
 (0)