-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
79 lines (64 loc) · 3.77 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
pipeline {
agent none
parameters {
choice(name: 'PROJECT', choices: ['gcp-ushi-carbon-predevsvcs-npe','gcp-ushi-carbon-svcs-dev','gcp-ushi-carbon-svcs-stage','gcp-ushi-carbon-svcs-prd'], description: ' The project in which the cluster needs to (re)created')
choice(name: 'REGION', choices: ['us-central1', 'us-east4'], description: 'The region in which the cluster needs to be (re)created.')
choice(name: 'CLUSTER_NAME', choices: ['diamond', 'graphite'], description: 'The name of the cluster that needs to be (re)created.')
choice(name: 'VERSION', choices: ['0.9.0','1.0.0'], description: "Version of the artifact.")
}
stages {
stage("Deploying Telemetry Components") {
when {
branch 'master'
beforeAgent true
}
environment {
GOOGLE_CREDENTIALS = credentials("${PROJECT.toUpperCase()}_GKE")
CHART_ENVIRONMENT = credentials("${PROJECT.toUpperCase()}_CHART_ENVIRONMENT")
NAMESPACE_ENVIRONMENT = credentials("${PROJECT.toUpperCase()}_NAMESPACE_ENV")
VAULT_ENVIRONMENT = credentials("${PROJECT.toUpperCase()}_VAULT_ENV")
VAULT_URL = credentials("${PROJECT.toUpperCase()}_${REGION.toUpperCase()}_VAULT_URL")
VAULT_TOKEN = credentials("${PROJECT.toUpperCase()}_${REGION.toUpperCase()}_VAULT_TOKEN")
DATADOG_API_KEY = credentials("DATADOG_API_KEY")
STACKDRIVER_CREDENTIALS = credentials("${PROJECT.toUpperCase()}_STACKDRIVER_CREDENTIALS")
ELASTIC_KAFKA_CREDENTIALS_CRT = credentials("${PROJECT.toUpperCase()}_${REGION.toUpperCase()}_ELASTIC_KAFKA_CREDENTIALS_CRT")
ELASTIC_KAFKA_CREDENTIALS_KEY = credentials("${PROJECT.toUpperCase()}_${REGION.toUpperCase()}_ELASTIC_KAFKA_CREDENTIALS_KEY")
ELASTIC_KAFKA_CREDENTIALS_CA = credentials("${PROJECT.toUpperCase()}_${REGION.toUpperCase()}_ELASTIC_KAFKA_CREDENTIALS_CA")
ELASTIC_USER = credentials("${PROJECT.toUpperCase()}_${REGION.toUpperCase()}_ELASTIC_USER")
ELASTIC_PASSWORD = credentials("${PROJECT.toUpperCase()}_${REGION.toUpperCase()}_ELASTIC_PASSWORD")
GRAFANA_PG_PWD = credentials("${PROJECT.toUpperCase()}_${REGION.toUpperCase()}_GRAFANA_PG_PASSWORD")
// let's remove this one image_tag
ELASTIC_IMAGE_TAG = credentials("${PROJECT.toUpperCase()}_${REGION.toUpperCase()}_ELASTIC_IMAGE_TAG")
INGRESS_TLS_CRT = credentials("${PROJECT.toUpperCase()}_${REGION.toUpperCase()}_INGRESS_TLS_CERT")
INGRESS_TLS_KEY = credentials("${PROJECT.toUpperCase()}_${REGION.toUpperCase()}_INGRESS_TLS_KEY")
INGRESS_IP = credentials("${PROJECT.toUpperCase()}_${REGION.toUpperCase()}_${CLUSTER_NAME.toUpperCase()}_INGRESS_IP")
CLOUDABILITY_API_KEY = credentials("CLOUDABILITY_API_KEY")
}
agent {
docker {
label 'docker'
image "gcr.io/gcp-ushi-carbon-svcs-dev/carbon-telemetry-components:${VERSION}"
args '-u root:root -v /home/jenkins/.ssh:/root/.ssh '
registryUrl 'https://gcr.io/'
registryCredentialsId 'NPE_GCR_AGENT_CREDENTIALS'
alwaysPull true
}
}
steps {
script {
sh "./deploy.sh -p ${params.PROJECT} -r ${params.REGION} -c carbon-${params.REGION}-app-${params.CLUSTER_NAME} -v ${params.VERSION} -x"
}
}
}
}
post {
failure {
script {
mail (to: '[email protected]',
subject: "Failure!! Cluster creation for job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) failed.",
body: "Please visit ${env.BUILD_URL} for further information."
);
}
}
}
}