-
Notifications
You must be signed in to change notification settings - Fork 12
179 lines (170 loc) · 6.8 KB
/
connect-button-ci.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
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
name: 'Connect button CI/CD'
on:
pull_request:
# branches:
# - develop
push:
branches:
- develop
- main
env:
jenkins_job_name: 'kubernetes-deployments/job/connect-button'
helm_dir: 'deploy/helm/connect-button'
dev_eks_cluster: 'rdx-works-main-dev'
prod_eks_cluster: 'rdx-works-main-dev'
jobs:
build_push_container:
permissions:
packages: write
id-token: write
pull-requests: write
contents: read
name: Build and push docker image
uses: radixdlt/public-iac-resuable-artifacts/.github/workflows/docker-build.yml@main
with:
runs_on: ubuntu-latest
image_registry: 'docker.io'
image_organization: 'radixdlt'
image_name: 'connect-button-storybook'
tag: ${{ needs.build.outputs.tag }}
tags: |
type=sha,priority=601
type=ref,event=pr
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
context: './'
dockerfile: './packages/connect-button/Dockerfile'
platforms: 'linux/amd64'
provenance: 'false'
enable_gcr: 'false'
scan_image: true
snyk_target_ref: ${{ github.ref_name }}
secrets:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDP }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
deploy_pull_request:
if: ${{ github.event.pull_request }}
name: Deploy PR
permissions:
id-token: write
deployments: write
packages: write
pull-requests: write
contents: read
needs:
- build_push_container
uses: radixdlt/public-iac-resuable-artifacts/.github/workflows/jenkins-deployment.yml@main
with:
jenkins_job_name: "kubernetes-deployments/job/connect-button"
github_branch: "${{ github.head_ref }}"
application_name: "connect-button"
hierarchical_namespace: "connect-button-ci-pr"
create_subnamespace: "true"
kubernetes_namespace: "connect-button-pr-${{ github.event.number }}"
aws_eks_cluster: "rdx-works-main-dev"
aws_iam_role_name: "jenkins-connect-button-pr-deployer"
helmfile_environment: "pr"
helm_dir: "deploy/helm/connect-button"
helmfile_extra_vars: "ci.tag=${{ fromJSON(needs.build_push_container.outputs.json).labels['org.opencontainers.image.version'] }},ci.prNumber=${{ github.event.number }}"
secrets:
aws_deployment_account_id: ${{ secrets.AWS_DEV_ACCOUNT_ID }}
secrets_account_id: ${{ secrets.SECRETS_ACCOUNT_ID }}
deploy_dev:
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
name: Deploy DEV
permissions:
id-token: write
deployments: write
packages: write
pull-requests: write
contents: read
needs:
- build_push_container
uses: radixdlt/public-iac-resuable-artifacts/.github/workflows/jenkins-deployment.yml@main
with:
github_environment: "dev"
github_branch: "${{ github.ref }}"
jenkins_job_name: "kubernetes-deployments/job/connect-button"
application_name: "connect-button"
kubernetes_namespace: "connect-button-dev"
aws_eks_cluster: "rdx-works-main-dev"
aws_iam_role_name: "jenkins-connect-button-dev-deployer"
helmfile_environment: "dev"
helm_dir: "deploy/helm/connect-button"
helmfile_extra_vars: "ci.tag=${{ fromJSON(needs.build_push_container.outputs.json).labels['org.opencontainers.image.version'] }}"
secrets:
aws_deployment_account_id: ${{ secrets.AWS_DEV_ACCOUNT_ID }}
secrets_account_id: ${{ secrets.SECRETS_ACCOUNT_ID }}
deploy_prod:
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
name: Deploy PROD
permissions:
id-token: write
deployments: write
packages: write
pull-requests: write
contents: read
needs:
- build_push_container
uses: radixdlt/public-iac-resuable-artifacts/.github/workflows/jenkins-deployment.yml@main
with:
github_environment: "prod"
github_branch: "${{ github.ref }}"
jenkins_job_name: "kubernetes-deployments/job/connect-button"
application_name: "connect-button"
kubernetes_namespace: "connect-button-prod"
aws_eks_cluster: "rdx-works-main-dev"
aws_iam_role_name: "jenkins-connect-button-prod-deployer"
helmfile_environment: "prod"
helm_dir: "deploy/helm/connect-button"
helmfile_extra_vars: "ci.tag=${{ fromJSON(needs.build_push_container.outputs.json).labels['org.opencontainers.image.version'] }}"
secrets:
aws_deployment_account_id: ${{ secrets.AWS_DEV_ACCOUNT_ID }}
secrets_account_id: ${{ secrets.SECRETS_ACCOUNT_ID }}
snyk_container_monitor:
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
needs:
- build_push_container
permissions:
id-token: write
pull-requests: read
contents: read
deployments: write
steps:
- uses: radixdlt/public-iac-resuable-artifacts/snyk-container-monitor@main
with:
role_name: 'arn:aws:iam::${{ secrets.SECRETS_ACCOUNT_ID }}:role/gh-common-secrets-read-access'
app_name: 'cnct-button'
dockerhub_secret_name: 'arn:aws:secretsmanager:eu-west-2:${{ secrets.SECRETS_ACCOUNT_ID }}:secret:github-actions/common/dockerhub-credentials'
snyk_secret_name: 'arn:aws:secretsmanager:eu-west-2:${{ secrets.SECRETS_ACCOUNT_ID }}:secret:github-actions/common/snyk-credentials-rXRpuX'
snyk_org_id: ${{ secrets.SNYK_ORG_ID }}
image: docker.io/radixdlt/connect-button-storybook:${{ fromJSON(needs.build_push_container.outputs.json).labels['org.opencontainers.image.version'] }}
target_ref: ${{ github.ref_name }}
snyk_monitor:
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
needs:
- build_push_container
permissions:
id-token: write
pull-requests: read
contents: read
deployments: write
steps:
- uses: RDXWorks-actions/checkout@main
- uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main
with:
role_name: 'arn:aws:iam::${{ secrets.SECRETS_ACCOUNT_ID }}:role/gh-common-secrets-read-access'
app_name: 'connect-button'
step_name: 'snyk-monitor'
secret_prefix: 'SNYK'
secret_name: 'arn:aws:secretsmanager:eu-west-2:${{ secrets.SECRETS_ACCOUNT_ID }}:secret:github-actions/common/snyk-credentials-rXRpuX'
parse_json: true
- name: Enable Snyk online monitoring to check for vulnerabilities
uses: RDXWorks-actions/snyk-actions/node@master
with:
args: --all-projects --org=${{ env.SNYK_PROJECTS_ORG_ID }} --target-reference=${{ github.ref_name }}
command: monitor