forked from flowcommerce/aws-credentials-broker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
executable file
·66 lines (57 loc) · 1.83 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
properties([pipelineTriggers([githubPush()])])
pipeline {
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '10'))
timeout(time: 30, unit: 'MINUTES')
}
agent {
kubernetes {
label 'worker-aws-credentials-broker'
inheritFrom 'default'
containerTemplates([
containerTemplate(name: 'helm', image: "grahamar/k8s-helm-secrets:v2.13.0", command: 'cat', ttyEnabled: true),
containerTemplate(name: 'docker', image: 'docker', command: 'cat', ttyEnabled: true)
])
}
}
environment {
ORG = 'flowcommerce'
APP_NAME = 'aws-credentials-broker'
}
stages {
stage('Checkout') {
steps {
checkoutWithTags scm
script {
APP_TAG = sh(returnStdout: true, script: 'git describe --tags --dirty --always').trim()
}
}
}
stage('Build and push docker image release') {
when { branch 'master' }
steps {
container('docker') {
script {
docker.withRegistry('', 'docker-hub-credentials') {
image = docker.build("$ORG/aws-credentials-broker:$APP_TAG", '--network=host -f Dockerfile .')
image.push()
}
}
}
}
}
stage('Deploy Helm chart') {
when { branch 'master' }
steps {
container('helm') {
sh('helm init --client-only')
sh('helm plugin install https://github.com/futuresimple/helm-secrets || true')
withAWS(role: 'arn:aws:iam::479720515435:role/cicd20181011095611663000000001', roleAccount: '479720515435') {
sh("helm secrets upgrade --wait --install --namespace production --set deployments.live.version=$APP_TAG aws-credentials-broker -f deploy/aws-credentials-broker/secrets.yaml ./deploy/aws-credentials-broker")
}
}
}
}
}
}