1
1
#! groovy
2
2
properties([
3
- pipelineTriggers([[$class :" SCMTrigger " , scmpoll_spec : " H/2 * * * * " ]])
3
+ pipelineTriggers([[$class :" GitHubPushTrigger " ]])
4
4
])
5
-
6
5
pipeline {
7
6
agent { label ' docker-slave' }
8
7
stages{
9
8
stage(' Get Code' ) {
10
9
steps {
11
10
deleteDir()
12
- checkout scm
11
+ checkout ([
12
+ $class : ' GitSCM' ,
13
+ branches : scm. branches,
14
+ doGenerateSubmoduleConfigurations : scm. doGenerateSubmoduleConfigurations,
15
+ extensions : [[$class : ' CloneOption' , noTags : false , shallow : false , depth : 0 , reference : ' ' ]],
16
+ userRemoteConfigs : scm. userRemoteConfigs,
17
+ ])
18
+ script {
19
+ tag= sh(returnStdout : true , script : " git tag -l --points-at HEAD" ). trim()
20
+ env. tag = tag
21
+ }
13
22
}
14
23
}
15
24
stage(' GetOpsScripts' ) {
16
25
steps {
17
- slackSend (color : ' #ddaa00' , message : " :construction_worker: GETTING SCRIPTS:" )
26
+ slackSend (color : ' #ddaa00' , message : " :construction_worker: kf-portal-ego GETTING SCRIPTS:" )
18
27
sh '''
19
- git clone [email protected] :overture-stack/ ego.git
28
+ git clone [email protected] :kids-first/kf-portal- ego-config .git
20
29
'''
21
30
}
22
31
}
23
32
stage(' Test' ) {
24
33
steps {
25
- slackSend (color : ' #ddaa00' , message : " :construction_worker: TESTING STARTED: (${ env.BUILD_URL} )" )
34
+ slackSend (color : ' #ddaa00' , message : " :construction_worker: kf-portal-ego TESTING STARTED: (${ env.BUILD_URL} )" )
26
35
sh '''
27
- dataservice-api /test_stage/test.sh
36
+ kf-portal-ego-config/aws-ecs-service-type-1/ci-scripts /test_stage/test.sh
28
37
'''
29
- slackSend (color : ' #41aa58' , message : " :white_check_mark: TESTING COMPLETED: (${ env.BUILD_URL} )" )
38
+ slackSend (color : ' #41aa58' , message : " :white_check_mark: kf-portal-ego TESTING COMPLETED: (${ env.BUILD_URL} )" )
30
39
}
31
40
post {
32
41
failure {
33
- slackSend (color : ' #ff0000' , message : " :frowning: Test Failed: Branch '${ env.BRANCH } [${ env.BUILD_NUMBER} ]' (${ env.BUILD_URL} )" )
42
+ slackSend (color : ' #ff0000' , message : " :frowning: kf-portal-ego Test Failed: Branch '${ env.BRANCH_NAME } [${ env.BUILD_NUMBER} ]' (${ env.BUILD_URL} )" )
34
43
}
35
44
}
36
45
}
37
46
stage(' Build' ) {
38
47
steps {
39
48
sh '''
40
- dataservice-api /build_stage/build.sh
49
+ kf-portal-ego-config/aws-ecs-service-type-1/ci-scripts /build_stage/build.sh
41
50
'''
42
51
}
43
52
}
44
53
stage(' Publish' ) {
45
54
steps {
46
55
sh '''
47
- dataservice-api /publish_stage/publish.sh
56
+ kf-portal-ego-config/aws-ecs-service-type-1/ci-scripts /publish_stage/publish.sh
48
57
'''
49
- slackSend (color : ' #41aa58' , message : " :arrow_up: PUSHED IMAGE: (${ env.BUILD_URL} )" )
58
+ slackSend (color : ' #41aa58' , message : " :arrow_up: kf-portal-ego PUSHED IMAGE: (${ env.BUILD_URL} )" )
50
59
}
51
60
post {
52
61
failure {
53
- slackSend (color : ' #ff0000' , message : " :frowning: Publish Failed: Branch '${ env.BRANCH } [${ env.BUILD_NUMBER} ]' (${ env.BUILD_URL} )" )
62
+ slackSend (color : ' #ff0000' , message : " :frowning: kf-portal-ego Publish Failed: Branch '${ env.BRANCH_NAME } [${ env.BUILD_NUMBER} ]' (${ env.BUILD_URL} )" )
54
63
}
55
64
}
56
65
}
@@ -63,28 +72,108 @@ pipeline {
63
72
steps {
64
73
slackSend (color : ' #005e99' , message : " :deploying_dev: DEPLOYING TO DEVELOPMENT: (${ env.BUILD_URL} )" )
65
74
sh '''
66
- dataservice-api /deploy_stage/deploy.sh dev
75
+ kf-portal-ego-config/aws-ecs-service-type-1/ci-scripts /deploy_stage/deploy.sh dev
67
76
'''
68
- slackSend (color : ' #41aa58' , message : " :white_check_mark: DEPLOYED TO DEVELOPMENT: (${ env.BUILD_URL} )" )
77
+ slackSend (color : ' #41aa58' , message : " :white_check_mark: kf-portal-ego DEPLOYED TO DEVELOPMENT: (${ env.BUILD_URL} )" )
69
78
}
70
79
post {
71
80
failure {
72
- slackSend (color : ' #ff0000' , message : " :frowning: Test Failed: Branch '${ env.BRANCH } [${ env.BUILD_NUMBER} ]' (${ env.BUILD_URL} )" )
81
+ slackSend (color : ' #ff0000' , message : " :frowning: kf-portal-ego Deploy Failed: Branch '${ env.BRANCH_NAME } [${ env.BUILD_NUMBER} ]' (${ env.BUILD_URL} )" )
73
82
}
74
83
}
75
84
}
85
+ stage(' Retag with pre-release' ){
86
+ when {
87
+ expression {
88
+ return env. BRANCH_NAME == ' master' ;
89
+ }
90
+ expression {
91
+ return tag != ' ' ;
92
+ }
93
+ }
94
+ steps {
95
+ slackSend (color : ' #005e99' , message : " :deploying_qa: Retagging image with 'pre-release'" )
96
+ sh '''
97
+ MANIFEST=$(aws ecr batch-get-image --region us-east-1 --repository-name kf-portal-ego --image-ids imageTag=latest --query images[].imageManifest --output text)
98
+ aws ecr put-image --region us-east-1 --repository-name kf-portal-ego --image-tag "prerelease-$tag" --image-manifest "$MANIFEST"
99
+ '''
100
+ }
101
+ }
76
102
stage(' Deploy QA' ) {
77
103
when {
78
104
expression {
79
105
return env. BRANCH_NAME == ' master' ;
80
106
}
81
107
}
82
108
steps {
83
- slackSend (color : ' #005e99' , message : " :deploying_qa: DEPLOYING TO QA: (${ env.BUILD_URL} )" )
109
+ slackSend (color : ' #005e99' , message : " :deploying_qa: kf-portal-ego DEPLOYING TO QA: (${ env.BUILD_URL} )" )
110
+ sh '''
111
+ kf-portal-ego-config/aws-ecs-service-type-1/ci-scripts/deploy_stage/deploy.sh qa
112
+ '''
113
+ slackSend (color : ' #41aa58' , message : " :white_check_mark: kf-portal-ego DEPLOYED TO QA: (${ env.BUILD_URL} )" )
114
+ }
115
+ post {
116
+ failure {
117
+ slackSend (color : ' #ff0000' , message : " :frowning: kf-portal-ego Deploy Failed: Branch '${ env.BRANCH_NAME} [${ env.BUILD_NUMBER} ]' (${ env.BUILD_URL} )" )
118
+ }
119
+ }
120
+ }
121
+ stage(" Promotion kf-portal-ego to PRD" ) {
122
+ when {
123
+ expression {
124
+ return env. BRANCH_NAME == ' master' ;
125
+ }
126
+ expression {
127
+ return tag != ' ' ;
128
+ }
129
+ }
130
+ steps {
131
+ script {
132
+ env. DEPLOY_TO_PRD = input message : ' User input required' ,
133
+ submitter : ' lubneuskia,heatha' ,
134
+ parameters : [choice(name : ' kf-portal-ego: Deploy to PRD Environment' , choices : ' no\n yes' , description : ' Choose "yes" if you want to deploy the PRD server' )]
135
+ }
136
+ }
137
+ }
138
+ stage(' Retag with release' ){
139
+ when {
140
+ environment name : ' DEPLOY_TO_PRD' , value : ' yes'
141
+ expression {
142
+ return env. BRANCH_NAME == ' master' ;
143
+ }
144
+ expression {
145
+ return tag != ' ' ;
146
+ }
147
+ }
148
+ steps {
149
+ slackSend (color : ' #005e99' , message : " :deploying_prd: kf-portal-ego Retagging image with 'release'" )
150
+ sh '''
151
+ MANIFEST=$(aws ecr batch-get-image --region us-east-1 --repository-name kf-portal-ego --image-ids imageTag="prerelease-$tag" --query images[].imageManifest --output text)
152
+ aws ecr put-image --region us-east-1 --repository-name kf-portal-ego --image-tag "$tag" --image-manifest "$MANIFEST"
153
+ '''
154
+ }
155
+ post {
156
+ failure {
157
+ slackSend (color : ' #ff0000' , message : " :frowning: kf-portal-ego Deploy Failed: Branch '${ env.BRANCH_NAME} [${ env.BUILD_NUMBER} ]' (${ env.BUILD_URL} )" )
158
+ }
159
+ }
160
+ }
161
+ stage(' Deploy PRD' ) {
162
+ when {
163
+ environment name : ' DEPLOY_TO_PRD' , value : ' yes'
164
+ expression {
165
+ return env. BRANCH_NAME == ' master' ;
166
+ }
167
+ expression {
168
+ return tag != ' ' ;
169
+ }
170
+ }
171
+ steps {
172
+ slackSend (color : ' #005e99' , message : " :deploying_prd: kf-portal-ego DEPLOYING TO PRD: (${ env.BUILD_URL} )" )
84
173
sh '''
85
- dataservice-api/ deploy_stage/deploy.sh qa
174
+ kf-portal-ego-config/aws-ecs-service-type-1/ci-scripts/ deploy_stage/deploy.sh prd
86
175
'''
87
- slackSend (color : ' #41aa58' , message : " :white_check_mark: DEPLOYED TO QA : (${ env.BUILD_URL} )" )
176
+ slackSend (color : ' #41aa58' , message : " :white_check_mark: kf-portal-ego DEPLOYED TO PRD : (${ env.BUILD_URL} )" )
88
177
}
89
178
}
90
179
}
0 commit comments