-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
46 lines (41 loc) · 1.31 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
node() {
withCredentials([string(credentialsId: 'docker_server', variable: 'docker_server')]){
properties([
parameters([
string(name: 'docker_repo', defaultValue: 'samagragovernance/issuer', description: 'Docker Image Name'),
string(name: 'docker_server', defaultValue: "$docker_server", description: 'Docker Registry URL'),
])
])
}
stage('Checkout') {
cleanWs()
checkout scm
env.commit_id = env.BRANCH_NAME
echo "${env.commit_id}"
}
stage('docker-build') {
sh '''
docker build -t $docker_server/$docker_repo:$commit_id .
'''
if (env.BRANCH_NAME == 'main') {
sh '''
docker build -t $docker_server/$docker_repo:main .
'''
}
}
stage('docker-push') {
sh '''
docker push $docker_server/$docker_repo:$commit_id
'''
if (env.BRANCH_NAME == 'main') {
sh '''
docker push $docker_server/$docker_repo:main
'''
}
}
stage('Start deploy job with latest tag') {
if (env.BRANCH_NAME == 'main') {
build job: 'ULP/deploy-staging/deploy-issuer', parameters: [string(name: 'tag', value: 'main')]
}
}
}