Skip to content

Instantly share code, notes, and snippets.

@fabriciofmsilva
Created January 24, 2018 19:54
Show Gist options
  • Save fabriciofmsilva/c372547288a00cd8c86a40a4e7aab782 to your computer and use it in GitHub Desktop.
Save fabriciofmsilva/c372547288a00cd8c86a40a4e7aab782 to your computer and use it in GitHub Desktop.
#!groovy
pipeline {
agent any
// environment {
// git_commit_message = ''
// git_commit_diff = ''
// git_commit_author = ''
// git_commit_author_name = ''
// git_commit_author_email = ''
// }
stages {
// checkout
stage('Checkout') {
steps {
deleteDir()
checkout scm
}
}
// Build
stage('Build') {
parallel {
stage('Front-end') {
steps {
echo "Build:Front-end"
}
}
stage('Backend') {
steps {
echo "Build:Backend"
}
}
}
}
// Static Code Analysis
stage('Static Code Analysis') {
parallel {
stage('Front-end') {
steps {
echo "Static Code Analysis:Front-end"
}
}
stage('Backend') {
steps {
echo "Static Code Analysis:Backend"
}
}
}
}
// Unit Tests
stage('Unit Test') {
parallel {
stage('Front-end') {
steps {
echo "Unit Test:Front-end"
}
}
stage('Backend') {
steps {
echo "Unit Test:Backend"
}
}
}
}
// Acceptance Tests
stage('Acceptance Tests') {
steps {
echo "Acceptance Tests"
}
}
// Deploy
stage('Deploy') {
parallel {
stage('Development') {
when {
branch 'develop'
}
steps {
echo "Deployed in development"
}
}
stage('Beta') {
when {
branch 'beta'
}
steps {
echo "Deployed in beta"
}
}
stage('Production') {
when {
branch 'master'
}
steps {
echo "Deployed in production"
}
}
}
}
}
post {
always {
echo "Always"
}
changed {
echo "Changed"
}
success {
echo "Success"
}
failure {
echo "Failure"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment