Skip to content

Commit 430e5db

Browse files
committed
ci: adjust the “Deploy” job for the current deployment code
LW-9879
1 parent 44e7a89 commit 430e5db

File tree

1 file changed

+40
-33
lines changed

1 file changed

+40
-33
lines changed

.github/workflows/std.yml

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ on:
1313
branches:
1414
- master
1515
- conway-era
16+
- dev-preview
1617
push:
1718
branches:
1819
- master
1920
- conway-era
21+
- dev-preview
2022
tags:
2123
- '@cardano-sdk/cardano-services**'
2224
env:
@@ -168,50 +170,55 @@ jobs:
168170
gh pr comment "$prNumber" --body "$(sed -e '2i\\n```diff' -e '$a```' k8s-plan.diff)"
169171
170172
171-
deploy-to-eu:
172-
runs-on: ubuntu-latest
173-
needs: [discover, images]
174-
name: ${{ matrix.target.jobName }} (us-east-1)
175-
env:
176-
AWS_REGION: us-east-1
177-
permissions:
178-
id-token: write
179-
contents: read
180-
deployments: write
173+
# TODO: remove all hardcoded instances of `dev-preview` in the next iteration
174+
deploy-to-us:
175+
if: (github.event_name == 'push' && github.ref_name == 'master') || (github.event_name == 'workflow_dispatch' && inputs.deploy)
176+
needs: [images]
177+
concurrency:
178+
# Only one deployment at a time per environment, and wait for the previous one to finish:
179+
group: deploy-dev-preview
180+
cancel-in-progress: false
181+
name: Deploy (dev-preview)
182+
runs-on: ubuntu-22.04
181183
environment:
182184
name: dev-preview
183-
url: https://backend.dev-preview.eks.lw.iog.io
184-
# Boolean input should be compared with string until https://github.com/actions/runner/issues/2238 resolved
185-
if: >
186-
fromJSON(needs.discover.outputs.hits).deployments.apply != '{}' && ((github.event_name == 'push' && github.ref == 'refs/heads/master') || inputs.deploy)
187-
188-
strategy:
189-
matrix:
190-
target: ${{ fromJSON(needs.discover.outputs.hits).deployments.apply }}
185+
url: https://dev-preview.lw.iog.io/
191186
steps:
192-
- name: Configure AWS Credentials
193-
uses: aws-actions/[email protected]
194-
with:
195-
role-to-assume: ${{ env.AWS_ROLE_ARN }}
196-
aws-region: ${{ env.AWS_REGION }}
187+
- uses: actions/checkout@v4
197188
- uses: nixbuild/nix-quick-install-action@v25
198189
- uses: nixbuild/nixbuild-action@v17
199190
with:
200191
nixbuild_ssh_key: ${{ secrets.SSH_PRIVATE_KEY }}
201192
generate_summary_for: job
193+
# Further steps assume AWS_PROFILE=lw, while the official action has no way to specify that profile:
194+
- name: Set up AWS credentials
195+
run: |
196+
mkdir -p ~/.aws
197+
198+
cat <<EOF >~/.aws/credentials
199+
[lw]
200+
aws_access_key_id = ${{ secrets.AWS_ACCESS_KEY}}
201+
aws_secret_access_key = ${{ secrets.AWS_SECRET_ACCESS_KEY }}
202+
EOF
203+
204+
cat <<EOF >~/.aws/config
205+
[lw]
206+
region = us-east-1
207+
EOF
202208
- uses: divnix/std-action/setup-discovery-ssh@main
203209
with:
204210
ssh_key: ${{ secrets.SSH_PRIVATE_KEY }}
205211
user_name: ${{ env.DISCOVERY_USER_NAME }}
206212
ssh_known_hosts_entry: ${{ env.DISCOVERY_KNOWN_HOSTS_ENTRY }}
207-
- name: Configure K8S Cluster Access
208-
shell: bash
209-
run: |
210-
echo "Assuming role '$(aws sts get-caller-identity)' in cluster 'lace-dev-us-east-1'."
211-
aws eks update-kubeconfig --name "lace-dev-us-east-1"
212-
- name: Show commit
213-
shell: bash
213+
- name: Deploy to K8s
214214
run: |
215-
echo commit: ${{ github.sha }}
216-
- uses: divnix/std-action/run@main
217-
with: {ffBuildInstructions: true, remoteStore: "ssh-ng://eu.nixbuild.net"}
215+
echo 'export K8S_USER=eks-devs' >.envrc.local
216+
217+
nix develop .#x86_64-linux.local.envs.main -L --command bash -c '
218+
set -euo pipefail
219+
220+
export AWS_PROFILE="lw"
221+
export AWS_REGION="us-east-1"
222+
223+
echo yes | nix run -L ".#[email protected]"
224+
'

0 commit comments

Comments
 (0)