-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
97 lines (87 loc) · 2.76 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
@Library('jenkins-devops@dev')_ // load jenkins-devops as a library
properties([
parameters([
choice( name: 'TYPE', choices: ['converge',
'dismiss'],
defaultValue: 'converge', description: 'TYPE of run Deploy or Dismis packages'),
string( name: 'SERVICE', defaultValue: 'rabbitmq', description: 'Name of Service (also namespace too)'),
])
])
pipeline {
agent { label 'multiwerf' }
environment {
WERF_TMP_DIR = '/home/jenkins/tmp/'
WERF_HOME = '/home/jenkins/tmp/.werf/'
WERF_IMAGES_REPO_MODE = "monorepo"
YC_REGISTRY = 'cr.yandex/xxxxxxxx'
AWS_REGISTRY = 'xxxx.amazonaws.com'
WERF_STAGES_STORAGE = "cr.yandex/xxxxxxxx/${params.SERVICE}/stages"
YC_AUTH = credentials("ya_registry_key")
KUBECONFIG = credentials('werf_kube_config')
AWS_ACCESS_KEY_ID = credentials('aws_access_key_id')
AWS_SECRET_ACCESS_KEY = credentials('aws_secret_access_key')
}
stages {
stage("Prerequisites") {
steps {
script {
sh 'export'
}
script{
functions.loginYCRegistry("${YC_AUTH}", "${YC_REGISTRY}")
script {
functions.loginAWSRegistry("${AWS_ACCESS_KEY_ID}", "${AWS_SECRET_ACCESS_KEY}", "${params.SERVICE}", "${AWS_REGISTRY}")
}
}
}
}
stage("DEV") {
when {
anyOf { branch 'dev'; }
}
environment {
WERF_IMAGES_REPO = "${YC_REGISTRY}/${params.SERVICE}"
WERF_NAMESPACE = "${params.SERVICE}"
WERF_ENV = "dev"
WERF_KUBE_CONTEXT = "dev"
}
steps {
script {
functions.runWerf("${params.TYPE}")
}
}
}
stage("PROD YC") {
when {
anyOf { branch 'master'; }
}
environment {
WERF_IMAGES_REPO = "${YC_REGISTRY}/${params.SERVICE}"
WERF_NAMESPACE = "${params.SERVICE}"
WERF_ENV = "production"
WERF_KUBE_CONTEXT = "production"
}
steps {
script {
functions.runWerf("${params.TYPE}")
}
}
}
stage("PROD AWS") {
when {
anyOf { branch 'master'; }
}
environment {
WERF_IMAGES_REPO = "${AWS_REGISTRY}/${params.SERVICE}"
WERF_NAMESPACE = "${params.SERVICE}"
WERF_ENV = "aws-production"
WERF_KUBE_CONTEXT = "aws-production"
}
steps {
script {
functions.runWerf("${params.TYPE}")
}
}
}
}
}