-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
268 changed files
with
15,558 additions
and
1,669 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!groovy | ||
//JRS REST clients | ||
|
||
pipeline { | ||
agent { label 'qaa' } | ||
options { | ||
timeout(time: 1, unit: 'HOURS') | ||
buildDiscarder(logRotator(artifactNumToKeepStr: '5')) | ||
timestamps() | ||
} | ||
environment { | ||
PROD_MVNREPO_SERVER_ID = 'jaspersoft-jfrog-io' | ||
PROD_SNAPSHOT_REPO = 'jaspersoft-clients-snapshots' | ||
PROD_PROD_REPO = 'jaspersoft-clients-releases' | ||
|
||
DEV_MVNREPO_SERVER_ID = 'mvnrepo-jaspersoft-com' | ||
DEV_SNAPSHOT_REPO = 'rest-client-test' | ||
DEV_PROD_REPO = 'rest-client-test-prod' | ||
|
||
RESOLVE_REPO_ID = "${env.DEV_MVNREPO_SERVER_ID}" | ||
RESOLVE_REPO = 'repo' | ||
|
||
devBuild = JENKINS_URL.contains('-dev') | ||
|
||
MVNREPO_SERVER_ID = "${devBuild ? env.DEV_MVNREPO_SERVER_ID : env.PROD_MVNREPO_SERVER_ID}" | ||
SNAPSHOT_REPO = "${devBuild ? env.DEV_SNAPSHOT_REPO : env.PROD_SNAPSHOT_REPO}" | ||
PROD_REPO = "${devBuild ? env.DEV_PROD_REPO : env.PROD_PROD_REPO}" | ||
|
||
MVN_NAME = 'mvn-default' | ||
JDK_NAME = 'jdk-default' | ||
|
||
} | ||
tools { | ||
maven env.MVN_NAME | ||
jdk env.JDK_NAME | ||
} | ||
stages { | ||
stage('Configure') { | ||
steps { | ||
rtMavenResolver ( | ||
id: "maven-resolver-${env.JOB_BASE_NAME}", | ||
serverId: "${env.RESOLVE_REPO_ID}", | ||
releaseRepo: "${env.RESOLVE_REPO}", | ||
snapshotRepo: "${env.RESOLVE_REPO}", | ||
) | ||
rtMavenDeployer ( | ||
id: "maven-deployer-${env.JOB_BASE_NAME}", | ||
serverId: "${env.MVNREPO_SERVER_ID}", | ||
releaseRepo: "${env.PROD_REPO}", | ||
snapshotRepo: "${env.SNAPSHOT_REPO}", | ||
) | ||
rtBuildInfo ( | ||
captureEnv: true, | ||
) | ||
} | ||
} | ||
stage('Build'){ | ||
steps { | ||
rtMavenRun ( | ||
pom: 'pom.xml', | ||
goals: "clean install source:jar --update-snapshots -Dmaven.repo.local=${env.WORKSPACE}/.m2/repository --batch-mode", | ||
/* Not working, bug recently fixed and not yet released. See https://github.com/jfrog/jenkins-artifactory-plugin/pull/139 and HAP-1183 | ||
opts: "--update-snapshots -Dmaven.repo.local=${env.WORKSPACE}/.m2/repository --batch-mode", | ||
*/ | ||
resolverId: "maven-resolver-${env.JOB_BASE_NAME}", | ||
deployerId: "maven-deployer-${env.JOB_BASE_NAME}", | ||
) | ||
} | ||
} | ||
} | ||
post { | ||
success { | ||
archiveArtifacts allowEmptyArchive: true, artifacts: '**/target/*.jar' | ||
script { | ||
echo "devBuid: ${env.devBuild}, server: ${env.MVNREPO_SERVER_ID}, snapshots: ${env.SNAPSHOT_REPO}, release: ${env.PROD_REPO}, JENKINS_URL: ${JENKINS_URL}" | ||
step([$class: 'Publisher', reportFilenamePattern: '**/target/*-reports/*.xml' ]) | ||
} | ||
rtPublishBuildInfo ( | ||
serverId: "${env.MVNREPO_SERVER_ID}", | ||
) | ||
rtAddInteractivePromotion ( | ||
serverId: "${env.MVNREPO_SERVER_ID}", | ||
targetRepo: "${env.PROD_REPO}", | ||
sourceRepo: "${env.SNAPSHOT_REPO}", | ||
copy: true, | ||
) | ||
} | ||
cleanup { | ||
cleanWs() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# JRS java REST client build setup via pipeline | ||
|
||
## Builds | ||
Every branch with exisiting `Jenkisfile` will be picked up by CI and built | ||
Exceptions: | ||
* branches containing `dev-` in names are built on development CI | ||
* branches containing `dev-` in names are **not** built on production CI | ||
|
||
## Pipeline | ||
`Jenkinsfile` uses [Declarative Pipeline]( | ||
https://jenkins.io/doc/book/pipeline/syntax/#declarative-pipeline) | ||
syntax. | ||
`rtMavenResolver`, `rtMavenDeployer`, `rtBuildInfo`, `rtMavenRun`, `rtPublishBuildInfo` and | ||
`rtAddInteractivePromotion` are declarative steps for [Jenkins Artifactory Plugin]( | ||
https://github.com/JFrog/jenkins-artifactory-plugin) and are documented in | ||
[Working With Pipeline Jobs in Jenkins](https://www.jfrog.com/confluence/display/RTF/Working+With+Pipeline+Jobs+in+Jenkins) | ||
|
||
## Flowchart | ||
```mermaid | ||
graph TB | ||
subgraph agent 'qaa' | ||
subgraph pipeline options, environment and tools | ||
A1[Setup pipeline] | ||
end | ||
subgraph stages | ||
subgraph stage Configure | ||
A1 --> B1["Configure (artifactory pipeline plugin)"] | ||
end | ||
subgraph stage Build | ||
B1 --> B2["Build (run Maven via artifactory pipeline plugin)"] | ||
end | ||
end | ||
subgraph Post-build | ||
subgraph success | ||
B2 --> C2[archive artifacts] | ||
C2 --> C3[publish test results] | ||
C3 --> C4[Set buildInfo and interactive promotion artifactory plugin] | ||
end | ||
A1 --> |Timeout or Error | E2 | ||
subgraph always | ||
E2[Remove workspace] | ||
end | ||
C4 --> E2 | ||
end | ||
end | ||
``` |
Oops, something went wrong.