Repository navigation
Expand file tree
/
Copy pathJenkinsfile
More file actions
32 lines (29 loc) · 1.64 KB
/
Copy pathJenkinsfile
File metadata and controls
32 lines (29 loc) · 1.64 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
node {
stage('Clone repository') {
/* Let's make sure we have the repository cloned to our workspace */
git url: 'https://github.com/jfrogtraining/kubernetes_example.git', branch: 'master'
}
stage('Install helm & JFrog CLI') {
/* This installs helm client */
sh "curl -O https://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz"
sh "tar -xvf helm-v2.9.1-linux-amd64.tar.gz"
sh "chmod 777 ./linux-amd64/helm"
sh "./linux-amd64/helm version -c"
/* This installs and configure JFrog Cli */
sh "curl -fL https://getcli.jfrog.io | sh"
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: CREDENTIALS, usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
sh "./jfrog rt config --url ${SERVER_URL} --user ${env.USERNAME} --password ${env.PASSWORD}"
}
}
stage('Build Chart & push it to Artifactory repo') {
/* Configure helm client to point to k8s cluster */
sh "./linux-amd64/helm init"
sh "sed -i 's/0.1.1/0.1.${env.BUILD_NUMBER}/' docker-app-chart/Chart.yaml"
sh "sed -i 's/latest/${IMAGE_TAG}/g' docker-app-chart/values.yaml"
sh "./linux-amd64/helm package ./docker-app-chart/"
sh "./jfrog rt u '*.tgz' ${REPO} --build-name=${env.JOB_NAME} --build-number=${env.BUILD_NUMBER}"
sh "./jfrog rt bce ${env.JOB_NAME} ${env.BUILD_NUMBER}"
sh "./jfrog rt dl docker-prod-local/docker-app/${IMAGE_TAG}/manifest.json --build-name=${env.JOB_NAME} --build-number=${env.BUILD_NUMBER} "
sh "./jfrog rt bp ${env.JOB_NAME} ${env.BUILD_NUMBER}"
}
}