-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
57 lines (50 loc) · 1.41 KB
/
Jenkinsfile
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
pipeline {
agent none
environment {
DOCKER_IMAGE = "nhtua/flask-docker"
}
stages {
stage("Test") {
agent {
docker {
image 'python:3.8-slim-buster'
args '-u 0:0 -v /tmp:/root/.cache'
}
}
steps {
sh "pip install poetry"
sh "poetry install"
sh "poetry run pytest"
}
}
// stage("build") {
// agent { node {label 'master'}}
// environment {
// DOCKER_TAG="${GIT_BRANCH.tokenize('/').pop()}-${BUILD_NUMBER}-${GIT_COMMIT.substring(0,7)}"
// }
// steps {
// withCredentials([usernamePassword(credentialsId: 'docker-hub', usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) {
// sh 'echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin'
// }
// sh "docker build -t ${DOCKER_IMAGE}:${DOCKER_TAG} . "
// sh "docker push ${DOCKER_IMAGE}:${DOCKER_TAG}"
// script {
// if (GIT_BRANCH ==~ /.*master.*/) {
// sh "docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:latest"
// sh "docker push ${DOCKER_IMAGE}:latest"
// }
// }
// //clean to save disk
// sh "docker image rm ${DOCKER_IMAGE}:${DOCKER_TAG}"
// }
// }
}
post {
success {
echo "SUCCESSFUL"
}
failure {
echo "FAILED"
}
}
}