-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
191 lines (176 loc) · 6.67 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
String build = 'build'
String webhooks = 'webhooks'
String imgBuildAndUpload = 'image-build-and-upload'
def sv
library(
identifier: 'jenkins-shared-lib@SDLC-2445_telepresence_poc',
retriever: modernSCM(
[
$class : 'GitSCMSource',
remote : 'git@github.com:Tealium/jenkins-shared-lib.git',
credentialsId: 'github-cicd-bot-teal'
]
)
)
pipeline {
agent {
kubernetes {
yamlFile 'jenkins/k8s-pods.yml'
}
}
options {
ansiColor('xterm')
buildDiscarder(logRotator(numToKeepStr: '15'))
skipStagesAfterUnstable()
timeout(time: 1, unit: 'HOURS')
timestamps()
}
environment {
ARTIFACTORY_CREDENTIALS = credentials('artifactory-credentials-jenkins')
COMPONENT_PREFIX = 'telepresence_poc'
LOCAL_MANIFESTS_REPO = "kubernetes-environments-${env.ACCOUNT_NAME}"
GIT_CREDS = credentials('github-cicd-bot-teal-token')
ENVIRONMENT = "${env.ENVIRONMENT}"
REGION = "${env.REGION}"
}
stages {
stage('Git Checkout') {
steps {
checkout scm
}
}
stage('Git Env') {
steps {
container(webhooks) {
script {
// sh 'apk add --no-cache curl'
sv = sourceVersion()
echo "Source Version info: ${sv}"
}
}
}
}
// stage('Install dependencies') {
// steps {
// container(build) {
// sh './jenkins/install_dependencies.sh'
// }
// container(imgBuildAndUpload) {
// sh '''
// apk add --no-cache bash curl zip
// curl -fL https://getcli.jfrog.io | sh && chmod +x jfrog && mv jfrog /bin/jfrog
// '''
// }
// }
// }
// // stage('Check for pre-existing build') {
// // environment {
// // SOURCE_VERSION = "${sourceVersion.gitsha()}"
// // }
// // steps {
// // container(imgBuildAndUpload) {
// // sh 'jenkins/artifactory_search.sh'
// // }
// // }
// // }
// stage('Build and push docker image') {
// // when {
// // not {
// // expression {
// // return readJSON(file: 'build_metadata.json')[0]?.path
// // }
// // }
// // }
// environment {
// GIT_BRANCH = "${sourceVersion.currentBranch()}"
// GIT_COMMIT = "${sourceVersion.gitsha()}"
// GIT_COMMIT_SHA = "${sourceVersion.gitsha()}"
// RUNNING_ON_DEFAULT_BRANCH = "${sourceVersion.runningOnDefaultBranch()}"
// SOURCE_VERSION = "${sourceVersion.gitsha()}"
// }
// stages {
// stage('Build Jar') {
// steps {
// container(build) {
// sh 'env'
// sh "ACTION=BUILD_JAR ./jenkins/build.sh"
// }
// }
// }
// stage('Docker build') {
// steps {
// container(imgBuildAndUpload) {
// sh '''
// local project_subdirs=info,locality,personality
// for project_subdir in ${project_subdirs//,/ }
// do
// pushd $project_subdir
// echo -n "$ARTIFACTORY_CREDENTIALS_PSW" | docker login --username "$ARTIFACTORY_CREDENTIALS_USR" --password-stdin tealium-docker-virtual-registry.jfrog.io
// docker build --tag $COMPONENT_PREFIX_$project_subdir .
// popd
// done
// '''
// }
// }
// }
// stage('Docker push source version to JFrog') {
// steps {
// container(imgBuildAndUpload) {
// sh """
// local project_subdirs=info,locality,personality
// for project_subdir in \${project_subdirs//,/ }
// do
// jenkins/docker_tag_and_push.sh ${env.SOURCE_VERSION} \$COMPONENT_PREFIX_\$project_subdir
// done
// """
// }
// }
// }
// stage('Docker push latest to JFrog') {
// when { expression { env.RUNNING_ON_DEFAULT_BRANCH } }
// steps {
// container(imgBuildAndUpload) {
// sh '''
// local project_subdirs=info,locality,personality
// for project_subdir in \${project_subdirs//,/ }
// do
// jenkins/docker_tag_and_push.sh latest \$COMPONENT_PREFIX_\$project_subdir
// done
// '''
// }
// }
// }
// }
// }
// stage('Update manifest in local kubernetes-environments repo') {
// environment {
// ACTION = 'update_gitsha_for_current_environment'
// SOURCE_VERSION = "${sourceVersion.gitsha()}"
// }
// steps {
// container(build) {
// sh "${env.LOCAL_MANIFESTS_REPO}/update_manifests.sh"
// }
// }
// }
// stage('Create Pre-Release') {
// when {
// expression { sourceVersion.runningOnDefaultBranch() }
// }
// steps { container(webhooks) { script { cutRelease() } } }
// }
}
// post {
// always {
// container(build) {
// script { deploymentOrchestrator(env.ENVIRONMENT) }
// }
// container(webhooks) {
// script {
// sourceVersion.checkUpToDate()
// webhooksHelper.post()
// }
// }
// }
// }
}