Compare commits
No commits in common. "76a351710fffe2be1ae10471bc1a2f511f481126" and "0006044ae4aec8d50a0a846390ffd58f759dba48" have entirely different histories.
76a351710f
...
0006044ae4
72
Jenkinsfile
vendored
72
Jenkinsfile
vendored
@ -1,72 +0,0 @@
|
||||
pipeline {
|
||||
agent any
|
||||
environment {
|
||||
DOCKER_REGISTRY_URL = 'marcin00.azurecr.io'
|
||||
DOCKER_IMAGE = "${DOCKER_REGISTRY_URL}/user-microservice:${GIT_COMMIT}"
|
||||
ACR_NAME = 'marcin00'
|
||||
}
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
stage('Test python app') {
|
||||
steps {
|
||||
script {
|
||||
dir('api') {
|
||||
sh '''
|
||||
python3 -m venv env
|
||||
source env/bin/activate
|
||||
pip install -r requirements.txt pytest
|
||||
python3 -m pytest --junit-xml=pytest_junit.xml
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit testResults: '**/*pytest_junit.xml'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build & test docker image') {
|
||||
steps {
|
||||
script {
|
||||
appImage = docker.build("${DOCKER_IMAGE}")
|
||||
|
||||
sh label: 'Install dgoss', script: '''
|
||||
curl -s -L https://github.com/aelsabbahy/goss/releases/latest/download/goss-linux-amd64 -o goss
|
||||
curl -s -L https://github.com/aelsabbahy/goss/releases/latest/download/dgoss -o dgoss
|
||||
chmod +rx *goss
|
||||
'''
|
||||
|
||||
withEnv(['GOSS_OPTS=-f junit', 'GOSS_PATH=./goss', 'GOSS_SLEEP=3', 'SQLALCHEMY_DATABASE_URI=sqlite:///:memory:']) {
|
||||
sh label: 'run image tests', script: './dgoss run -e SQLALCHEMY_DATABASE_URI=sqlite:///:memory: ${DOCKER_IMAGE} > goss_junit.xml'
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit testResults: '**/*goss_junit.xml'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
script {
|
||||
sh '''
|
||||
az login --identity
|
||||
az acr login --name ${ACR_NAME}
|
||||
docker push ${DOCKER_IMAGE}
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
cleanup {
|
||||
script { cleanWs() }
|
||||
}
|
||||
}
|
||||
}
|
@ -61,7 +61,5 @@ def create_app(config_name="default"):
|
||||
|
||||
# Server start only if we run app directly
|
||||
if __name__ == "__main__":
|
||||
from waitress import serve
|
||||
app = create_app()
|
||||
port = os.getenv("APP_PORT", "80")
|
||||
serve(app, host="0.0.0.0", port=port)
|
||||
app.run(host="0.0.0.0")
|
||||
|
@ -11,5 +11,4 @@ mysql-connector-python==9.2.0
|
||||
python-dotenv==1.0.0
|
||||
SQLAlchemy==2.0.23
|
||||
typing_extensions==4.8.0
|
||||
waitress==3.0.2
|
||||
Werkzeug==3.0.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user