-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
59 lines (50 loc) · 1.91 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
58
59
pipeline {
agent { label 'small' }
environment {
imagename = 'ghcr.io/pilotdataplatform/project'
commit = sh(returnStdout: true, script: 'git describe --always').trim()
registryCredential = 'pilot-ghcr'
}
stages {
stage('DEV: Git clone') {
when { branch 'develop' }
steps {
git branch: 'develop',
url: 'https://github.com/PilotDataPlatform/project.git',
credentialsId: 'pilot-gh'
}
}
stage('DEV: Build and push image') {
when { branch 'develop' }
steps {
script {
docker.withRegistry('https://ghcr.io', registryCredential) {
customImage = docker.build('$imagename:alembic-$commit', '--target alembic-image .')
customImage.push()
}
docker.withRegistry('https://ghcr.io', registryCredential) {
customImage = docker.build('$imagename:project-$commit', '--target project-image .')
customImage.push()
}
}
}
}
stage('DEV: Remove image') {
when { branch 'develop' }
steps {
sh 'docker rmi $imagename:alembic-$commit'
sh 'docker rmi $imagename:project-$commit'
}
}
stage('DEV: Deploy') {
when { branch 'develop' }
steps {
build(job: '/VRE-IaC/UpdateAppVersion', parameters: [
[$class: 'StringParameterValue', name: 'TF_TARGET_ENV', value: 'dev'],
[$class: 'StringParameterValue', name: 'TARGET_RELEASE', value: 'project'],
[$class: 'StringParameterValue', name: 'NEW_APP_VERSION', value: "$commit"]
])
}
}
}
}