-
Notifications
You must be signed in to change notification settings - Fork 15
115 lines (103 loc) · 4.13 KB
/
aws-prod.yaml
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
on:
push:
branches:
- main
name: Deploy to AWS Production (K8s)
permissions:
id-token: write
contents: read
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: production
env:
AWS_REGION: us-east-1
CLUSTER_NAME: maker-prod
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.GA_OIDC_EKS_PROD }}
role-session-name: chainlog-prod
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Extract commit hash
id: vars
shell: bash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
SHA_TAG: ${{ steps.vars.outputs.sha_short }}
LATEST_TAG: latest
ENVIRONMENT_TAG: prod
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
# Build Docker containers and
# push them to ECR:
# - chainlog-ui
docker pull $ECR_REGISTRY/chainlog-ui-prod:$LATEST_TAG || true
docker build -t chainlog-ui-prod \
-t $ECR_REGISTRY/chainlog-ui-prod:$SHA_TAG \
-t $ECR_REGISTRY/chainlog-ui-prod:$LATEST_TAG \
-t $ECR_REGISTRY/chainlog-ui-prod:$ENVIRONMENT_TAG \
-f Dockerfile.ui \
.
docker push $ECR_REGISTRY/chainlog-ui-prod --all-tags
# - chainlog-checksum
docker pull $ECR_REGISTRY/chainlog-checksum-prod:$LATEST_TAG || true
docker build -t chainlog-checksum-prod \
-t $ECR_REGISTRY/chainlog-checksum-prod:$SHA_TAG \
-t $ECR_REGISTRY/chainlog-checksum-prod:$LATEST_TAG \
-t $ECR_REGISTRY/chainlog-checksum-prod:$ENVIRONMENT_TAG \
-f Dockerfile.checksum \
.
docker push $ECR_REGISTRY/chainlog-checksum-prod --all-tags
# - chainlog-logger
docker pull $ECR_REGISTRY/chainlog-logger-prod:$LATEST_TAG || true
docker build -t chainlog-logger-prod \
-t $ECR_REGISTRY/chainlog-logger-prod:$SHA_TAG \
-t $ECR_REGISTRY/chainlog-logger-prod:$LATEST_TAG \
-t $ECR_REGISTRY/chainlog-logger-prod:$ENVIRONMENT_TAG \
-f Dockerfile.logger \
.
docker push $ECR_REGISTRY/chainlog-logger-prod --all-tags
- name: Preparing Helm values files
id: preparing-helm-values
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
sed -i 's/${ECR_REGISTRY}/'$(echo $ECR_REGISTRY)/ deploy/prod/chainlog-logger.yaml
sed -i 's/${ECR_REGISTRY}/'$(echo $ECR_REGISTRY)/ deploy/prod/chainlog-ui.yaml
- name: Deploying Chainlog UI to Kubernetes with Helm
uses: bitovi/github-actions-deploy-eks-helm@v1.2.4
with:
values: image.repository=${{ steps.login-ecr.outputs.registry }}/chainlog-ui-prod,image.tag=${{ steps.vars.outputs.sha_short }}
cluster-name: ${{ env.CLUSTER_NAME }}
config-files: deploy/prod/chainlog-ui.yaml
chart-path: techops-services/common
namespace: chainlog
timeout: 5m0s
name: chainlog-ui
chart-repository: https://techops-services.github.io/helm-charts
version: 0.0.19
atomic: true
- name: Deploying Chainlog Logger to Kubernetes with Helm
uses: bitovi/github-actions-deploy-eks-helm@v1.2.4
with:
values: image.repository=${{ steps.login-ecr.outputs.registry }}/chainlog-logger-prod,image.tag=${{ steps.vars.outputs.sha_short }}
cluster-name: ${{ env.CLUSTER_NAME }}
config-files: deploy/prod/chainlog-logger.yaml
chart-path: techops-services/common
namespace: chainlog
timeout: 5m0s
name: chainlog-logger
chart-repository: https://techops-services.github.io/helm-charts
version: 0.0.19
atomic: true