This repository has been archived by the owner on Dec 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathci.Jenkinsfile
186 lines (174 loc) · 5.65 KB
/
ci.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
pipeline {
agent any
tools {
go 'Go 1.17'
}
environment {
PATH = "${env.HOME}/go/bin:${env.HOME}/google-cloud-sdk/bin:${env.PATH}"
GITHUB_CREDS_PSW = credentials("GITHUB_TOKEN")
HARBOR_CREDS = credentials("projects-registry-vmware-tanzu_observability-robot")
PREFIX = 'projects.registry.vmware.com/tanzu_observability'
DOCKER_IMAGE = "kubernetes-operator-snapshot"
VERSION_POSTFIX = "-alpha-${GIT_COMMIT.substring(0, 8)}"
WAVEFRONT_TOKEN = credentials("WAVEFRONT_TOKEN_NIMBA")
}
parameters {
string(name: 'OPERATOR_YAML_RC_SHA', defaultValue: '')
}
stages {
stage("Test Go Code") {
steps {
sh 'make checkfmt vet test'
sh 'make linux-golangci-lint'
sh 'make golangci-lint'
}
}
stage("Setup For Publish") {
environment {
GCP_CREDS = credentials("GCP_CREDS")
}
steps {
sh './hack/jenkins/setup-for-integration-test.sh'
sh './hack/jenkins/install_docker_buildx.sh'
sh 'make semver-cli'
}
}
stage("Publish") {
environment {
RELEASE_TYPE = "alpha"
}
steps {
sh 'echo $HARBOR_CREDS_PSW | docker login $PREFIX -u $HARBOR_CREDS_USR --password-stdin'
sh 'make docker-xplatform-build'
}
}
stage("Update RC branch") {
environment {
RELEASE_TYPE = "alpha"
TOKEN = credentials('GITHUB_TOKEN')
}
steps {
sh './hack/jenkins/create-rc-ci.sh'
script {
env.OPERATOR_YAML_RC_SHA = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
}
}
}
stage("Run Integration Tests") {
environment {
OPERATOR_YAML_TYPE="rc"
}
parallel {
stage("GKE") {
agent {
label "gke"
}
options {
timeout(time: 30, unit: 'MINUTES')
}
environment {
GKE_CLUSTER_NAME = "k8po-jenkins-ci-zone-a"
GCP_ZONE="a"
GCP_CREDS = credentials("GCP_CREDS")
GCP_PROJECT = "wavefront-gcp-dev"
}
stages {
stage("without customization") {
steps {
sh './hack/jenkins/setup-for-integration-test.sh'
sh './hack/jenkins/install_docker_buildx.sh'
sh 'make semver-cli'
lock("integration-test-gke") {
sh 'make gke-connect-to-cluster'
sh 'make clean-cluster'
sh 'make integration-test'
sh 'make clean-cluster'
}
}
}
stage("with customization") {
environment {
KUSTOMIZATION_TYPE="custom"
NS="custom-namespace"
SOURCE_PREFIX="projects.registry.vmware.com/tanzu_observability"
PREFIX="projects.registry.vmware.com/tanzu_observability_keights_saas"
HARBOR_CREDS = credentials("projects-registry-vmware-tanzu_observability_keights_saas-robot")
INTEGRATION_TEST_ARGS="-r advanced"
}
steps {
sh './hack/jenkins/setup-for-integration-test.sh'
sh './hack/jenkins/install_docker_buildx.sh'
sh 'make semver-cli'
lock("integration-test-gke") {
sh 'make gke-connect-to-cluster'
sh 'docker logout $PREFIX'
sh 'echo $HARBOR_CREDS_PSW | docker login $PREFIX -u $HARBOR_CREDS_USR --password-stdin'
sh 'make docker-copy-images'
sh 'make integration-test'
sh 'make clean-cluster'
}
}
}
}
}
stage("EKS") {
agent {
label "eks"
}
options {
timeout(time: 30, unit: 'MINUTES')
}
environment {
GCP_CREDS = credentials("GCP_CREDS")
AWS_SHARED_CREDENTIALS_FILE = credentials("k8po-ci-aws-creds")
AWS_CONFIG_FILE = credentials("k8po-ci-aws-profile")
}
steps {
sh './hack/jenkins/setup-for-integration-test.sh'
sh './hack/jenkins/install_docker_buildx.sh'
sh 'make semver-cli'
lock("integration-test-eks") {
sh 'make target-eks'
sh 'make clean-cluster'
sh 'make integration-test'
sh 'make clean-cluster'
}
}
}
stage("AKS") {
agent {
label "aks"
}
options {
timeout(time: 30, unit: 'MINUTES')
}
environment {
GCP_CREDS = credentials("GCP_CREDS")
AKS_CLUSTER_NAME = "k8po-ci"
}
steps {
sh './hack/jenkins/setup-for-integration-test.sh'
sh './hack/jenkins/install_docker_buildx.sh'
sh 'make semver-cli'
lock("integration-test-aks") {
withCredentials([file(credentialsId: 'aks-kube-config', variable: 'KUBECONFIG')]) {
sh 'kubectl config use k8po-ci'
sh 'make clean-cluster'
sh 'make integration-test'
sh 'make clean-cluster'
}
}
}
}
}
}
}
post {
regression {
slackSend (channel: '#tobs-k8po-team', color: '#FF0000', message: "CI OPERATOR BUILD FAILED: <${env.BUILD_URL}|${env.JOB_NAME} [${env.BUILD_NUMBER}]>")
}
fixed {
slackSend (channel: '#tobs-k8po-team', color: '#008000', message: "CI OPERATOR BUILD FIXED: <${env.BUILD_URL}|${env.JOB_NAME} [${env.BUILD_NUMBER}]>")
}
}
}