forked from lensesio/lenses-helm-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
106 lines (95 loc) · 3.2 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
#!/usr/bin/env groovy
pipeline {
agent {
label 'docker && ephemeral'
}
options {
ansiColor 'xterm'
disableConcurrentBuilds()
copyArtifactPermission('*')
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '10'))
parallelsAlwaysFailFast()
timeout(time: 10, unit: 'MINUTES')
}
stages {
stage('Build Helm Charts') {
agent {
docker {
image "dtzar/helm-kubectl"
args '-e HOME=/tmp -e HELM_HOME=/tmp'
reuseNode true
}
}
steps {
script {
env.BRANCH_VERSION = env.BRANCH_NAME
.trim()
.toLowerCase()
.replaceAll(' ','-')
.replaceAll('/','-')
.replaceAll('\\.','-')
env.BUILD_MODE = 'development'
if (env.BRANCH_NAME =~ /^release/) {
env.BUILD_MODE = 'release'
}
sh("_cicd/functions.sh setup_helm")
sh("_cicd/functions.sh package_all")
dir('build') {
archiveArtifacts '*.tgz'
}
}
}
}
stage('Upload Helm Chart to public repo') {
when {
anyOf {
branch 'release/3.2'
branch 'release/4.0'
branch 'release/4.1'
}
}
environment {
HELM_REPOSITORY = 'lenses-helm-charts'
ARTIFACTORY_URL = 'https://lenses.jfrog.io/artifactory/'
ARTIFACTORY_API_KEY = credentials('artifactory-lenses-helm')
SSH_HOST = credentials('ssh-host')
}
steps {
script {
docker.image("docker.bintray.io/jfrog/jfrog-cli-go").inside {
sh("jfrog rt u build/*.tgz ${HELM_REPOSITORY} --url=${ARTIFACTORY_URL} --apikey=${ARTIFACTORY_API_KEY}")
}
// Update helm.repo.lenses.io
sshagent(credentials: ['57dab1e7-d47f-4c57-8eef-c107c4bb707a']) {
sh '_cicd/functions.sh clone_site'
}
}
}
}
stage('Upload Helm Chart to private repo') {
when {
anyOf {
branch 'release/4.1'
not { branch 'release/**' }
}
}
environment {
HELM_REPOSITORY = 'lenses-private-helm-charts'
ARTIFACTORY_URL = 'https://lenses.jfrog.io/artifactory/'
ARTIFACTORY_API_KEY = credentials('artifactory-lenses-helm')
}
steps {
script {
docker.image("docker.bintray.io/jfrog/jfrog-cli-go").inside {
sh("_cicd/functions.sh publish_all")
}
}
}
}
}
post {
always {
cleanWs()
}
}
}