forked from keikoproj/flippy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
executable file
·72 lines (65 loc) · 2.66 KB
/
Jenkinsfile
File metadata and controls
executable file
·72 lines (65 loc) · 2.66 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
@Library(value = 'msaas-shared-lib', changelog = false) _
pipeline {
agent {
kubernetes {
label "build-flippy"
yamlFile 'KubernetesPods.yaml'
}
}
environment {
GIT_TOKEN = credentials('GIT_TOKEN')
commitSha = sh(returnStdout: true, script: 'git rev-parse --short=5 HEAD').trim()
}
stages {
stage('build & push') {
steps {
script {
container('podman') {
withEnv(["HUB=docker.intuit.com/services/mesh/flippy/service", "TAG=${commitSha}", "VERSION=0.1"]) {
withCredentials([[$class: 'UsernamePasswordMultiBinding',
credentialsId: "flippy_docker_login",
usernameVariable: 'DOCKER_REGISTRY_CREDS_USR',
passwordVariable: 'DOCKER_REGISTRY_CREDS_PSW']]) {
echo 'Login to registry..'
sh "podman login docker.intuit.com --username ${DOCKER_REGISTRY_CREDS_USR} --password ${DOCKER_REGISTRY_CREDS_PSW} --storage-driver=overlay"
sh "podman build --storage-driver=overlay --isolation=chroot --ulimit=nofile=1048576:1048576 --cgroup-manager=cgroupfs --events-backend=file -t $HUB/flippy:latest -t $HUB/flippy:$TAG --build-arg GIT_TOKEN=$GIT_TOKEN ."
sh "podman push $HUB/flippy:$TAG --storage-driver=overlay --cgroup-manager=cgroupfs --events-backend=file"
}
}
}
}
}
}
stage('master build build & push') {
when {
branch 'master'
}
steps {
script {
container('podman') {
withEnv(["HUB=docker.intuit.com/services/mesh/flippy/service", "TAG=${commitSha}", "VERSION=0.1"]) {
withCredentials([[$class: 'UsernamePasswordMultiBinding',
credentialsId: "flippy_docker_login",
usernameVariable: 'DOCKER_REGISTRY_CREDS_USR',
passwordVariable: 'DOCKER_REGISTRY_CREDS_PSW']]) {
echo 'Login to registry..'
sh "podman login docker.intuit.com --username ${DOCKER_REGISTRY_CREDS_USR} --password ${DOCKER_REGISTRY_CREDS_PSW} --storage-driver=overlay"
sh "podman push $HUB/flippy:latest --storage-driver=overlay --cgroup-manager=cgroupfs --events-backend=file"
}
}
}
}
}
}
stage('CPD Certification') {
when {
branch 'master'
}
steps {
container('cpd2') {
intuitCPD2Podman([asset_id: "7209154696006625069", code_repo: "https://github.intuit.com/services-mesh/flippy.git"], "-i docker.intuit.com/services/mesh/flippy/service/flippy:latest --buildfile Dockerfile", "flippy_docker_login")
}
}
}
}
}