Hopefully fixed pipeline.

This commit is contained in:
Andrew Pitt 2020-01-06 14:05:28 -05:00
parent 84b09177f5
commit 2eeed5fbd4

39
Jenkinsfile vendored
View file

@ -1,7 +1,7 @@
def appName=env.APP_NAME
def gitSourceUrl=env.GIT_SOURCE_URL
def gitSourceRef=env.GIT_SOURCE_REF
def project=""
def project=env.PROJECT_NAME
def projectVersion=""
pipeline {
@ -10,43 +10,51 @@ pipeline {
}
stages {
stage("Initialize") {
project = env.PROJECT_NAME
stage('Initialize') {
steps {
echo "appName: ${appName}"
echo "gitSourceUrl: ${gitSourceUrl}"
echo "gitSourceRef: ${gitSourceRef}"
}
stage("Checkout") {
}
stage('Checkout') {
steps {
echo "Checkout source."
git url: "${gitSourceUrl}", branch: "${gitSourceRef}"
echo "Read POM info."
pom = readMavenPom file: 'pom.xml'
projectVersion = pom.version
}
stage("Build JAR") {
}
stage('Build JAR') {
steps {
echo "Build the app."
sh "mvn clean package"
}
stage("Quality Check") {
}
stage('Quality Check') {
steps {
sh "mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install -Dmaven.test.failure.ignore=false"
sh "mvn sonar:sonar -Dsonar.jacoco.reportPaths=target/coverage-reports/jacoco-unit.exec -Dsonar.host.url=http://sonarqube.cicd.svc:9000"
// sh "mvn org.cyclonedx:cyclonedx-maven-plugin:makeBom"
//dependencyTrackPublisher(artifact: 'target/bom.xml', artifactType: 'bom', projectName: "${appName}", projectVersion: "${projectVersion}", synchronous: false)
}
stage("Build Image") {
}
stage('Build Image') {
steps {
echo "Build container image."
// unstash name:"jar"
openshift.withCluster() {
openshift.withProject('cicd') {
sh "oc start-build ${appName}-s2i-build --from-file=target/app.jar -n cicd --follow"
}
}
}
stage("Tag DEV") {
}
stage('Tag DEV') {
agent {
label 'jenkins-slave-skopeo'
}
steps {
script {
openshift.withCluster() {
withCredentials([usernamePassword(credentialsId: "${openshift.project()}-quay-creds-secret", usernameVariable: "QUAY_USERNAME", passwordVariable: "QUAY_PASSWORD")]) {
@ -55,7 +63,9 @@ pipeline {
}
}
}
stage("Deploy DEV") {
}
stage('Deploy DEV') {
steps {
echo "Deploy to DEV."
openshift.withCluster() {
openshift.withProject("${appName}-dev") {
@ -66,11 +76,12 @@ pipeline {
}
}
}
stage("Integration Tests") {
}
stage('Integration Tests') {
echo "Running Integration tests..."
sh "mvn verify -Pfailsafe"
}
stage("Tag UAT") {
stage('Tag UAT') {
agent {
label 'jenkins-slave-skopeo'
}
@ -82,7 +93,7 @@ pipeline {
}
}
}
stage("Deploy UAT") {
stage('Deploy UAT') {
echo "Deploy to UAT."
openshift.withCluster() {
openshift.withProject("${appName}-uat") {