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

feat(devops): Deploy to test environments via CI #3572

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

bitdivine
Copy link
Member

@bitdivine bitdivine commented Nov 14, 2024

Motivation

Deploying to test environments is typically hard to get right. We would like:

  • Friendly domain names:
  • Use the same identities and assets in fe{1..4} as in staging.
    • This requires staging and II configuration to be set
  • Easy, reliable deployment

Changes

  • Enable deploying to the test networks
  • Allow refs other than main to be deployed to beta and the test networks

Configuration:

  • I have configured the test_fe_{1..4} asset canisters to accept asset uploads and commits from CI.

Tests

@bitdivine bitdivine marked this pull request as ready for review November 14, 2024 18:25
@bitdivine bitdivine requested a review from a team as a code owner November 14, 2024 18:25
@bitdivine bitdivine enabled auto-merge (squash) November 14, 2024 18:29
.github/workflows/deploy-to-environment.yml Show resolved Hide resolved
if [[ "$NETWORK" = test_be_* ]] && [[ "$CANISTER" != "backend" ]] ; then
echo "Only a backend may be deployed to test_be_* networks"
exit 1
fi
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe just a final ECHO if all checks passed for policy? as feedback for the dev

Copy link
Member Author

Choose a reason for hiding this comment

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

If the policy passes, the developer will see a check mark next to that step, like this:

Screenshot from 2024-11-15 10-02-00

@@ -62,25 +56,50 @@ jobs:
echo "CANISTER=${{ github.event.inputs.canister }}" >> $GITHUB_ENV
fi

- name: Check release policy
run: |
if [[ "$NETWORK" == "staging" ]] && [[ "${{ github.ref }}" != "refs/heads/main" ]] ; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this include the check for beta?

for example, the check could pass if the network is beta, but the ref is not main, no? am i missing something?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no rule that beta may have only head of main. Indeed, there is an explicit expectation that we should be able to put feature branches and release candidates (that may not be head of main) on beta.

I have proposed that we have a test environment that always holds the latest release candidate (so that would be the latest tag of the form 1.2.3-rc-4), which is effectively what beta has most of the time at the moment, however that has not been approved.

@@ -142,6 +161,7 @@ jobs:
dfx identity import --disable-encryption --force default "$key_pem"
rm "$key_pem"
dfx identity use default
dfx identity get-principal
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is just a "good to have", right? it will print the principal so that we have more info, that's the idea?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct. It is not enough for the code to be correct, we need to be able to verify that it is working correctly. It's hard to verify that the expected principal is being used when it's invisible. :-) Another point where we need better visibility for verification is the env vars, but that will be a bigger change so I didn't commit that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants