-
Notifications
You must be signed in to change notification settings - Fork 17
/
Jenkinsfile.staging
52 lines (45 loc) · 1.57 KB
/
Jenkinsfile.staging
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
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr:'10', daysToKeepStr:'28', artifactNumToKeepStr:'5', artifactDaysToKeepStr:'14'))
}
environment {
DOCKERHUB_CREDENTIALS = credentials('dockerhub')
ENV_FILE = credentials('fairgame-staging-env')
}
tools {
// Install the Maven version configured as "Maven" and add it to the path.
maven "Maven"
}
stages {
stage('Build/Test') {
steps {
// git branch: 'staging', credentialsId: 'github', url: 'https://github.com/TheExkaliburg/MoreFair.git'
sh 'mvn -Dmaven.test.failure.ignore=true clean package'
}
post {
success {
junit allowEmptyResults: true, skipOldReports: true, testResults: 'backend/target/surefire-reports/TEST-*.xml'
}
}
}
stage('Docker') {
steps {
sh 'docker build -t kaliburg/fairgame:staging .'
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
sh 'docker push kaliburg/fairgame:staging'
}
post {
always {
sh 'docker logout'
}
}
}
stage('Compose/Startup') {
steps {
sh 'docker compose stop'
sh 'docker compose -f docker-compose-staging.yml --env-file $ENV_FILE up --pull always --force-recreate --detach'
}
}
}
}