Last active
November 18, 2019 00:20
-
-
Save jrichardsz/a62e3790c6db7654808528bd5e5a385f to your computer and use it in GitHub Desktop.
jenkins templates : scripted pipelines and declarative pipeline (Jenkinsfile)
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
pipeline { | |
agent any | |
stages { | |
stage('Build') { | |
steps { | |
echo 'Building..' | |
} | |
} | |
stage('Test') { | |
steps { | |
echo 'Testing..' | |
} | |
} | |
stage('Deploy') { | |
steps { | |
echo 'Deploying....' | |
} | |
} | |
} | |
} |
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
node { | |
echo 'New build for: '+params.repositoryName+' in branch '+params.branchName | |
} |
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
node { | |
try{ | |
stage 'checkout project' | |
checkout scm | |
stage 'check env' | |
sh "mvn -v" | |
sh "java -version" | |
stage 'test' | |
sh "mvn test" | |
stage 'package' | |
sh "mvn package" | |
stage 'report' | |
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml']) | |
stage 'Artifact' | |
step([$class: 'ArtifactArchiver', artifacts: '**/target/*.jar', fingerprint: true]) | |
}catch(e){ | |
throw e; | |
} | |
} |
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
node { | |
echo 'New build detected with this incoming parameters: '+params | |
} |
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
https://gist.github.com/jrichardsz/cdea67fe6357c9c51df04eaafc83e11c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment