Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add protected automated deployment to environments #1382

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
47 changes: 47 additions & 0 deletions .github/workflows/deploy-env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy Environment

on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to'
type: choice
required: true
default: 'ops-preview-1'
options:
- live-sanchonet@eu-central-1@v2
- live-mainnet@eu-central-1@v2
- live-sanchonet@us-east-2@v1
- dev-mainnet@us-east-1
- live-mainnet@us-east-2@v2
- live-sanchonet@us-east-2@v2
- dev-preprod@us-east-1@v2
- live-preprod@eu-central-1@v2
- dev-preview@us-east-1
- live-preprod@us-east-2@v2
- ops-preprod-1@us-east-1
- dev-sanchonet@us-east-1@v1
- live-preview@eu-central-1@v2
- ops-preview-1@us-east-1
- dev-sanchonet@us-east-1@v2
- live-preview@us-east-2@v2
- staging-preprod@us-east-1@v2

jobs:
deploy:
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v3

- name: 🧰 Setup Nix
uses: cachix/install-nix-action@v21

- name: 🚀 Deploy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, but don't we have to build the images first? 🤔 Or at least make sure they're built and pushed to ECR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it, it should not have push at the top and then it should be fine. We may encounter a race condition once in a while but that's probably not going to be even noticable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I plan to take out push: once the PR is tested and cleared for merging.

Ref: #1382 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, thanks. I remember I added a check in dapp-store once, to prevent such a race condition, but they use Git commits to tag images.

run: |
echo "${{ secrets.ENVRC }}" > .envrc.local
nix develop -L --command bash -c '
set -euo pipefail
echo "yes" | nix run .#cardano-services.${{ inputs.environment }}.apply
'
2 changes: 1 addition & 1 deletion nix/cardano-services/deployments/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ in
name = "${final.namespace}-cardanojs";
chart = ./Chart.yaml;
context = "eks-devs";
kubeconfig = "$PRJ_ROOT/.kube/${final.region}";
kubeconfig = ./../../local/kubeconfig + "/${final.region}";

utils = {
mkPodEnv = lib.mapAttrsToList (
Expand Down
Loading