-
Notifications
You must be signed in to change notification settings - Fork 3
/
pipelines.yml
112 lines (110 loc) · 4.43 KB
/
pipelines.yml
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
template: true
valuesFilePath: values.yml
resources:
- name: awsEcsRepo
type: GitRepo
configuration:
path: {{ .Values.GitHub.path }}
gitProvider: {{ .Values.GitHub.gitProvider }}
branches:
include: master
- name: awsEcsImage
type: Image
configuration:
registry: {{ .Values.Artifactory.intName }}
sourceRepository: {{ .Values.Artifactory.devRepo }}
imageName: {{ .Values.app.dockerImageName }}
imageTag: ${run_number}
autoPull: true
- name: awsEcsBuildInfo
type: Buildinfo
configuration:
sourceArtifactory: {{ .Values.Artifactory.intName }}
buildName: {{ .Values.app.buildName }}
buildNumber: ${run_number}
- name: promotedAwsEcsBuildInfo
type: Buildinfo
configuration:
sourceArtifactory: {{ .Values.Artifactory.intName }}
buildName: {{ .Values.app.buildName }}
buildNumber: ${run_number}
pipelines:
- name: aws_ecs_workshop_app_build
steps:
- name: app_docker_build
type: DockerBuild
configuration:
affinityGroup: docker_build
dockerFileLocation: {{ .Values.app.dockerFileLocation }}
dockerFileName: Dockerfile
dockerImageName: {{ .Values.app.dockerImageName }}
dockerImageTag: ${run_number}
inputResources:
- name: awsEcsRepo
integrations:
- name: {{ .Values.Artifactory.intName }}
execution:
onStart:
- cd $res_awsEcsRepo_resourcePath
- sed "s|Num|${run_number}|g" $res_awsEcsRepo_resourcePath/workshop-app/src/app/app.component.html > $res_awsEcsRepo_resourcePath/workshop-app/src/app/app.component.html.update
- mv $res_awsEcsRepo_resourcePath/workshop-app/src/app/app.component.html $res_awsEcsRepo_resourcePath/workshop-app/src/app/app.component.html.orig
- mv $res_awsEcsRepo_resourcePath/workshop-app/src/app/app.component.html.update $res_awsEcsRepo_resourcePath/workshop-app/src/app/app.component.html
onSuccess:
- echo "Congrats the app Docker image was built!"
- name: app_docker_push
type: DockerPush
configuration:
affinityGroup: docker_build
autoPublishBuildInfo: true
forceXrayScan: true
targetRepository: {{ .Values.Artifactory.devRepo }}
integrations:
- name: {{ .Values.Artifactory.intName }}
inputSteps:
- name: app_docker_build
outputResources:
- name: awsEcsImage
- name: awsEcsBuildInfo
- name: publish_build_info
type: PublishBuildInfo
configuration:
inputSteps:
- name: app_docker_push
outputResources:
- name: awsEcsBuildInfo
- name: app_promote
type: PromoteBuild
configuration:
targetRepository: {{ .Values.Artifactory.prodRepo }}
includeDependencies: true
status: Passed
comment: Artifact passed Xray Scan
copy: true
inputResources:
- name: awsEcsBuildInfo
outputResources:
- name: promotedAwsEcsBuildInfo
- name: ecs_deploy
type: Bash
configuration:
integrations:
- name: {{ .Values.AWS.intName }}
- name: {{ .Values.Artifactory.intName }}
inputResources:
- name: awsEcsRepo
inputSteps:
- name: app_promote
execution:
onExecute:
- cd $res_awsEcsRepo_resourcePath
- curl -o aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.19.6/2021-01-05/bin/linux/amd64/aws-iam-authenticator
- chmod +x ./aws-iam-authenticator
- mkdir -p $HOME/bin && cp ./aws-iam-authenticator $HOME/bin/aws-iam-authenticator && export PATH=$PATH:$HOME/bin
- aws configure set default.region {{ .Values.AWS.region }}
- docker login -u $int_{{ .Values.Artifactory.intName }}_user -p $int_{{ .Values.Artifactory.intName }}_apikey {{ .Values.Artifactory.server }}
- export IMAGE_NAME={{ .Values.app.dockerImageName }}
- export AWS_ACCESS_KEY_ID=$int_{{ .Values.AWS.intName }}_accessKeyId
- export AWS_SECRET_ACCESS_KEY=$int_{{ .Values.AWS.intName }}_secretAccessKey
- chmod +x ./deploy.sh
- ./deploy.sh
- echo "Workshop App launched!"