1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| # Jenkinsfile https://github.com/agileworks-tw/spring-boot-sample pipeline { agent any stages { stage('checkout project') { steps { //git url: 'https://github.com/agileworks-tw/spring-boot-sample.git' checkout scm } } stage('check docker install and build env') { steps { sh "docker -v" sh "docker-compose -v" sh "docker ps" sh "make start-docker-registry" sh "make build-docker-env" } } stage('test project and serve') { steps { sh "docker-compose run --rm test" sh "docker-compose up -d server" } post { always { archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true junit '**/target/surefire-reports/TEST-*.xml' } } } stage('wait for confirm') { input { message "Does staging at http://localhost:8000 look good?" ok "Deploy to production" submitter "admin" parameters { string(name: 'PERSON', defaultValue: 'Mr Jenkins', description: 'Who should I say hello to?') } } steps { echo "Hello, ${PERSON}, nice to meet you."
} post { always { sh "docker-compose stop server" } } } stage('deploy project') { when { branch 'master' } steps { sh "docker-compose run --rm package" sh "make build-docker-prod-image" sh "docker push localhost:5000/java_sample_prod" sh "make deploy-production-local" } } } }
|