12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #!groovy
- def port = 7777
- pipeline {
- agent {
- label 'master'
- }
- options {
- timestamps()
- }
- stages {
- stage("build project") {
- steps {
- sh 'go build main.go webPage.go'
- }
- }
- stage("deploy docker") {
- steps{
- sh 'docker stop schedule || exit 0'
- sh 'docker rm schedule || exit 0'
- sh 'docker build -t basic .'
- sh 'docker run -d --name schedule -p 7777:7777 -t basic'
- }
- }
- }
- post {
- success {
- echo 'I succeeeded!'
- sh 'cat $JENKINS_HOME/jobs/$JOB_NAME/builds/$BUILD_NUMBER/log > /tmp/success.log'
- }
- unstable {
- echo 'I am unstable :/'
- }
- failure {
- echo 'I failed :((('
- sh 'cat $JENKINS_HOME/jobs/$JOB_NAME/builds/$BUILD_NUMBER/log > /tmp/fail.log'
- }
- changed {
- echo 'things were different before...'
- }
- }
- }
|