Created
April 27, 2022 03:53
-
-
Save initcron/2204d6ace31192020424685c9e3d7faa to your computer and use it in GitHub Desktop.
Jenkinsfile for Vote App
This file contains hidden or 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 none | |
stages{ | |
stage('Build'){ | |
agent{ | |
docker{ | |
image 'python:2.7.16-slim' | |
args '--user root' | |
} | |
} | |
steps{ | |
echo 'Compiling vote app' | |
dir('vote'){ | |
sh 'pip install -r requirements.txt' | |
} | |
} | |
} | |
stage('Unit Test'){ | |
agent{ | |
docker{ | |
image 'python:2.7.16-slim' | |
args '--user root' | |
} | |
} | |
steps{ | |
echo 'Running Unit Tests on vote app' | |
dir('vote'){ | |
sh 'pip install -r requirements.txt' | |
sh 'nosetests -v' | |
} | |
} | |
} | |
stage('Docker BnP'){ | |
agent any | |
when{ | |
branch "master" | |
} | |
steps{ | |
echo 'Packaging vote app with docker' | |
script{ | |
docker.withRegistry('https://index.docker.io/v1/', 'dockerlogin') { | |
def voteImage = docker.build("xxxxxx/vote:v-jen-${env.BUILD_ID}", "./vote") | |
voteImage.push() | |
voteImage.push("dev") | |
} | |
} | |
} | |
} | |
} | |
post{ | |
always{ | |
echo 'Pipeline for vote is complete..' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment