-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (134 loc) · 6.05 KB
/
deploy.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
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
name: deploy-testgrid
on:
push:
branches:
- main
jobs:
staging-docker-image-tgapi:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: |
docker build -f tgapi/deploy/Dockerfile \
--build-arg gitsha=${GITHUB_SHA:0:7} \
--build-arg buildtime="$(date --rfc-3339=seconds | sed 's/ /T/')" \
-t 923411875752.dkr.ecr.us-east-1.amazonaws.com/tgapi:${GITHUB_SHA:0:7} \
.
- uses: docker/login-action@v2
with:
registry: 923411875752.dkr.ecr.us-east-1.amazonaws.com
username: ${{ secrets.STAGING_ECR_AWS_ACCESS_KEY_ID_SELECT }}
password: ${{ secrets.STAGING_ECR_AWS_SECRET_ACCESS_KEY_SELECT }}
- run: docker push 923411875752.dkr.ecr.us-east-1.amazonaws.com/tgapi:${GITHUB_SHA:0:7}
deploy-staging-eks-tgapi:
runs-on: ubuntu-20.04
needs: staging-docker-image-tgapi
steps:
- uses: actions/checkout@v3
- name: kustomize
run: |
curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases/tags/v2.0.0 | \
grep browser_download | \
grep linux | \
cut -d '"' -f 4 | \
xargs sudo curl -O -L && \
sudo mv kustomize_*_linux_amd64 /usr/local/bin/kustomize && \
sudo chmod +x /usr/local/bin/kustomize
pushd kustomize/overlays/staging
kustomize edit set image 923411875752.dkr.ecr.us-east-1.amazonaws.com/tgapi:${GITHUB_SHA:0:7}
kustomize build . > testgrid.yaml
popd
- name: ssh-key
env:
GITOPS_DEPLOY_KEY: ${{ secrets.GITOPS_DEPLOY_KEY }}
run: |
mkdir -p ~/.ssh
echo "$GITOPS_DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' \
>> ~/.ssh/known_hosts
- name: release
run: |
cd ~ && git clone --single-branch -b main [email protected]:replicatedcom/gitops-deploy
mkdir -p ~/gitops-deploy/testgrid
mv ${GITHUB_WORKSPACE}/kustomize/overlays/staging/testgrid.yaml gitops-deploy/testgrid/testgrid.yaml
cd ~/gitops-deploy
git config user.email "[email protected]"
git config user.name "kURL GitHub Actions"
git add .
git commit --allow-empty -m "https://github.com/replicatedhq/kURL-testgrid/actions/runs/${GITHUB_RUN_ID}" && \
git push origin main
production-docker-image-tgapi:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: |
docker build -f tgapi/deploy/Dockerfile \
--build-arg gitsha=${GITHUB_SHA:0:7} \
--build-arg buildtime="$(date --rfc-3339=seconds | sed 's/ /T/')" \
-t 799720048698.dkr.ecr.us-east-1.amazonaws.com/tgapi:${GITHUB_SHA:0:7} \
.
- uses: docker/login-action@v2
with:
registry: 799720048698.dkr.ecr.us-east-1.amazonaws.com
username: ${{ secrets.PRODUCTION_ECR_AWS_ACCESS_KEY_ID_SELECT }}
password: ${{ secrets.PRODUCTION_ECR_AWS_SECRET_ACCESS_KEY_SELECT }}
- run: docker push 799720048698.dkr.ecr.us-east-1.amazonaws.com/tgapi:${GITHUB_SHA:0:7}
docker-image-tgrun:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: tgrun-build
run: |
docker build -f tgrun/Dockerfile \
--build-arg gitsha=${GITHUB_SHA:0:7} \
--build-arg buildtime="$(date --rfc-3339=seconds | sed 's/ /T/')" \
-t replicated/tgrun:latest \
-t replicated/tgrun:${GITHUB_SHA:0:7} \
.
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: tgrun-push
run: |
docker push replicated/tgrun:latest
docker push replicated/tgrun:${GITHUB_SHA:0:7}
deploy-production-eks-tgapi:
runs-on: ubuntu-20.04
needs: production-docker-image-tgapi
steps:
- uses: actions/checkout@v3
- name: kustomize
run: |
curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases/tags/v2.0.0 | \
grep browser_download | \
grep linux | \
cut -d '"' -f 4 | \
xargs sudo curl -O -L && \
sudo mv kustomize_*_linux_amd64 /usr/local/bin/kustomize && \
sudo chmod +x /usr/local/bin/kustomize
pushd kustomize/overlays/production
kustomize edit set image 799720048698.dkr.ecr.us-east-1.amazonaws.com/tgapi:${GITHUB_SHA:0:7}
kustomize build . > testgrid.yaml
popd
- name: ssh-key
env:
GITOPS_DEPLOY_KEY: ${{ secrets.GITOPS_DEPLOY_KEY }}
run: |
mkdir -p ~/.ssh
echo "$GITOPS_DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' \
>> ~/.ssh/known_hosts
- name: release
run: |
cd ~ && git clone --single-branch -b release [email protected]:replicatedcom/gitops-deploy
mkdir -p ~/gitops-deploy/testgrid
mv ${GITHUB_WORKSPACE}/kustomize/overlays/production/testgrid.yaml gitops-deploy/testgrid/testgrid.yaml
cd ~/gitops-deploy
git config user.email "[email protected]"
git config user.name "kURL GitHub Actions"
git add .
git commit --allow-empty -m "https://github.com/replicatedhq/kURL-testgrid/actions/runs/${GITHUB_RUN_ID}" && \
git push origin release