Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
pipeline {
agent any

stages {
stage("Verify Branch") {
steps {
echo "${env.GIT_BRANCH}"
}
}

stage("Docker Build") {
steps {
sh 'docker compose build'
}
}

stage("Start App") {
steps {
sh 'docker --version'
sh 'docker compose --version'
sh 'docker compose up -d'
}
}

stage("Run Tests") {
steps {
sh 'pytest ./tests/test_sample.py'
}
post {
success {
echo "Test Passed :)"
}
failure {
echo "Test Failed :("
}
}
}
}

post {
always {
echo "Cleaning up..."
sh 'docker compose down'
}
}
}
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ services:
environment:
REDIS: azure-vote-back
ports:
- "8080:80"
- "8081:80"
5 changes: 5 additions & 0 deletions tests/test_sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def inc(x):
return x+1

def test_answer():
assert inc(4) == 5