Skip to content

Instantly share code, notes, and snippets.

@kenrachynski
Created May 30, 2019 16:08
Show Gist options
  • Select an option

  • Save kenrachynski/3aef16f4f637e4967bc5012d86cd879c to your computer and use it in GitHub Desktop.

Select an option

Save kenrachynski/3aef16f4f637e4967bc5012d86cd879c to your computer and use it in GitHub Desktop.
pipeline with authentication deploying wildfly application
pipeline {
agent {
label 'aws'
}
environment {
JBOSSADMIN = credentials('jboss-admin')
MAVEN_SETTINGS = credentials('maven-settings-windows')
}
tools {
maven 'Maven35'
jdk 'jdk-1.8.0-aws'
}
stages {
stage('Build') {
steps {
checkout scm
sh "mvn -s ${MAVEN_SETTINGS} -B -U -V clean deploy"
}
}
stage('Deploy Development') {
when { not { branch 'master' } }
steps {
sh """mvn -s ${MAVEN_SETTINGS} -B -U -V -Pdev wildfly:deploy \
-Dwildfly.username=${JBOSSADMIN_USR} \
-Dwildfly.password='${JBOSSADMIN_PSW}'"""
}
}
stage('Deploy Production') {
when { branch 'master' }
parallel {
stage('Release') {
input {
message "Permission to deploy to production server?"
}
steps {
sh """mvn -s ${MAVEN_SETTINGS} -B -U -V -Pprod wildfly:deploy \
-Dwildfly.username=${JBOSSADMIN_USR} \
-Dwildfly.password='${JBOSSADMIN_PSW}'"""
}
}
}
}
}
post {
always { sendNotifications currentBuild.currentResult }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment