|
13 | 13 | branches:
|
14 | 14 | - master
|
15 | 15 | - conway-era
|
| 16 | + - dev-preview |
16 | 17 | push:
|
17 | 18 | branches:
|
18 | 19 | - master
|
19 | 20 | - conway-era
|
| 21 | + - dev-preview |
20 | 22 | tags:
|
21 | 23 | - '@cardano-sdk/cardano-services**'
|
22 | 24 | env:
|
@@ -168,50 +170,55 @@ jobs:
|
168 | 170 | gh pr comment "$prNumber" --body "$(sed -e '2i\\n```diff' -e '$a```' k8s-plan.diff)"
|
169 | 171 |
|
170 | 172 |
|
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 |
181 | 183 | environment:
|
182 | 184 | 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/ |
191 | 186 | 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 |
197 | 188 | - uses: nixbuild/nix-quick-install-action@v25
|
198 | 189 | - uses: nixbuild/nixbuild-action@v17
|
199 | 190 | with:
|
200 | 191 | nixbuild_ssh_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
201 | 192 | 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 |
202 | 208 | - uses: divnix/std-action/setup-discovery-ssh@main
|
203 | 209 | with:
|
204 | 210 | ssh_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
205 | 211 | user_name: ${{ env.DISCOVERY_USER_NAME }}
|
206 | 212 | 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 |
214 | 214 | 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