Commit 29875801 authored by João Lino's avatar João Lino

Initial Jenkins file to build pom projects.

parent b3b9e215
Pipeline #2 failed with stages
pipeline { pipeline {
environment {
BRANCH_TO_DEPLOY = "master"
}
agent none agent none
parameters {
booleanParam(
name: 'SNYK_TEST',
defaultValue: true,
description: 'Do you want to run Snyk tests?'
)
booleanParam(
name: 'RELEASE_INPUT',
defaultValue: false,
description: 'Do you want to release this version? (Only relevant if branch is master or release/*)'
)
}
options {
timeout(time: 1, unit: 'HOURS')
buildDiscarder(
logRotator(
numToKeepStr: '10',
artifactNumToKeepStr: '3'
)
)
ansiColor('xterm')
}
triggers {
cron('@weekly')
}
stages { stages {
stage('Checkout') {
agent {
label 'docker'
}
steps {
checkout scm
sh 'git fetch --prune --tags'
}
}
stage('Verify') {
agent {
label 'docker'
}
steps {
sh 'mvn clean verify'
}
}
stage('Snyk test') {
agent {
label 'docker'
}
when {
expression { return params.SNYK_TEST }
}
steps {
sh 'mvn snyk:test'
}
}
stage('Deploy') { stage('Deploy') {
agent { agent {
label 'docker' label 'docker'
} }
when { when {
branch "${BRANCH_TO_DEPLOY}" anyOf {
branch 'master'
branch pattern: 'release/*'
}
not {
expression { return params.RELEASE_INPUT }
}
}
steps {
sh 'mvn deploy'
}
}
stage('Snyk monitor') {
agent {
label 'docker'
}
when {
anyOf {
branch 'master'
branch pattern: 'release/*'
}
expression { return params.SNYK_TEST }
}
steps {
sh 'mvn snyk:monitor'
}
}
stage('Release') {
agent {
label 'docker'
}
when {
allOf {
anyOf {
branch 'master'
branch pattern: 'release/*'
}
expression { return params.RELEASE_INPUT }
}
}
environment {
RELEASE_VERSION = sh(
returnStdout: true,
script: 'mvn help:evaluate -Dexpression=project.version -q -DforceStdout'
).trim().replace('-SNAPSHOT','')
} }
steps { steps {
// Just get helm3 for testing sh "git checkout ${BRANCH_NAME}"
sh 'wget https://get.helm.sh/helm-v3.0.3-linux-amd64.tar.gz https://get.helm.sh/helm-v3.0.3-linux-amd64.tar.gz.sha256' sh 'mvn release:prepare release:perform -V'
script {
currentBuild.description = "Release ${RELEASE_VERSION}"
currentBuild.keepLog = true
}
} }
} }
} }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment