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

ci(frontend): workflow to auto-deploy frontend in staging [GIX-3078] #2700

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

Conversation

AntonioVentilii-DFINITY
Copy link
Collaborator

@AntonioVentilii-DFINITY AntonioVentilii-DFINITY commented Oct 7, 2024

Motivation

As discussed off-line, we aim to make Staging env up-to-date with the latest main commit, in order to make it a "real" staging env.

Changes

  • initial script with necessary steps
  • adjusted script with handling of envvars on step level
  • created and imported identity
  • added branch check
  • added envvars on job level

@AntonioVentilii-DFINITY
Copy link
Collaborator Author

AntonioVentilii-DFINITY commented Oct 7, 2024

@inc-man will take over this PR

Have a look at @lmuntaner 's suggestion: they are doing something similar here:

@AntonioVentilii-DFINITY AntonioVentilii-DFINITY changed the title ci(frontend): workflow to auto-deploy frontend in staging ci(frontend): workflow to auto-deploy frontend in staging [GIX-3078] Oct 7, 2024
@inc-man inc-man marked this pull request as ready for review October 9, 2024 07:16
@inc-man inc-man requested a review from a team as a code owner October 9, 2024 07:16
@inc-man inc-man requested a review from bitdivine October 9, 2024 07:16
Copy link
Member

@bitdivine bitdivine left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

Comment on lines +51 to +53
key_pem=$(mktemp)
printenv "DFX_DEPLOY_STAGING_KEY" > "$key_pem"
dfx identity import --disable-encryption --force default "$key_pem"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
key_pem=$(mktemp)
printenv "DFX_DEPLOY_STAGING_KEY" > "$key_pem"
dfx identity import --disable-encryption --force default "$key_pem"
dfx identity import --storage-mode=plaintext --force default <(printenv DFX_DEPLOY_STAGING_KEY)
  • --disable-encryption has been deprecated and replaced with --storage-mode=plaintext
  • If you like (not obligatory) you can use a herefile as shown. Normally when dealing with key material one avoids letting it touch disk, but in this case the key material is landing in plaintext on disk anyway so it's a moot point.

Copy link
Member

Choose a reason for hiding this comment

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

I see that Internet Identity still uses --disable-encryption. We should do a scan of all our repositories and update them all. I'll add a Jira ticket to do that.

- name: Deploy to Staging
env:
ENV: staging
run: dfx deploy frontend --network staging
Copy link
Member

Choose a reason for hiding this comment

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

I think we probably want to deploy the backend as well, however we can do that in another PR. That could be in this or another workflow. Here is an example of a workflow that deploys another project with 2 canisters to a test environment. It has a checklist for which canisters to deploy:

  workflow_dispatch:
    inputs:
      mode:
        type: choice
        description: "The dfx canister install mode.  See `dfx canister install --help` for details."
        options:
          - upgrade
          - reinstall
          - install
          - auto
      canisters:
        type: choice
        description: Which canisters to install
        options:
          - all
          - nns-dapp
          - sns_aggregator

push:
branches:
- main
workflow_dispatch:
Copy link
Member

Choose a reason for hiding this comment

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

For workflow dispatch it would be nice to be able to choose the target network, so that this can also be used to deploy to the mainnet test canisters test_fe_1..4 But this can be done in another PR.

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.

3 participants