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

Convert remaining GH action scripts to env vars #1615

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

BedrockSquirrel
Copy link
Collaborator

Why this change is needed

Finish standardising the GH action scripts to use the same env variables.

What changes were made as part of this PR

  • delete unused old obscuroscan scripts
  • update obscuro scan and OG scripts to env vars

PR checks pre-merging

Please indicate below by ticking the checkbox that you have read and performed the required
PR checks

  • PR checks reviewed and performed

@coderabbitai
Copy link

coderabbitai bot commented Oct 20, 2023

Walkthrough

The changes across the three workflows focus on improving the clarity, maintainability, and debugging capabilities of the deployment process. This is achieved through better use of environment variables, enhanced Docker image handling, and improved Azure deployment commands. The changes also include better use of GitHub variables and input values for testnet types.

Changes

File Summary
.github/workflows/manual-deploy-obscuro-gateway-database.yml Improved environment variable handling based on testnet_type input, added debugging information, removed redundant Obscuro Gateway variable setting, and updated Azure CLI command and VM name.
.github/workflows/manual-deploy-obscuro-gateway.yml Enhanced environment variable setup, Docker image handling, and Azure VM creation. Updated use of GitHub variables and input values for testnet types.
.github/workflows/manual-deploy-obscuro-scan-2.yml Updated environment variable setup, Docker image handling, and Azure Container Instances deployment. Added debugging information and replaced Obscuro Scan variables with vars syntax.

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • Mention @coderabbitai in any review comment for bot assistance.
  • Note: Review comments are made on code diffs or files, not on the PR overview.

Pause Incremental Reviews

  • Insert @coderabbitai: ignore in the PR description to halt the bot's ongoing reviews. Remove the line to resume.
  • Additionally, enter @coderabbitai pause to halt the bot's ongoing reviews as any issue or review comment. To
    resume reviews, enter @coderabbitai resume as any issue or review comment.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Commits Files that changed from the base of the PR and between d494bc8 and b53e5a6.
Files selected for processing (3)
  • .github/workflows/manual-deploy-obscuro-gateway-database.yml (6 hunks)
  • .github/workflows/manual-deploy-obscuro-gateway.yml (5 hunks)
  • .github/workflows/manual-deploy-obscuro-scan-2.yml (3 hunks)
Files skipped from review due to trivial changes (1)
  • .github/workflows/manual-deploy-obscuro-gateway-database.yml
Additional comments (Suppressed): 8
.github/workflows/manual-deploy-obscuro-scan-2.yml (4)
  • 22-23: The environment name is set to the testnet_type input. Ensure that the environment names are unique for each testnet type and that they follow the naming conventions for GitHub environments.

  • 54-55: The Docker build and push steps now use the vars object to access the Docker build tags. Ensure that these variables are correctly set in the vars object before these steps are executed.

  • 77-77: The Docker images for the frontend and backend deployments are now retrieved from the vars object. Ensure that these variables are correctly set in the vars object before these steps are executed.

  • 81-81: The command-line argument for the backend deployment now uses the vars object to access the L2 RPC URL. Ensure that this variable is correctly set in the vars object before this step is executed.

.github/workflows/manual-deploy-obscuro-gateway.yml (4)
  • 19-28: The environment name is now set based on the testnet_type input, and GitHub variables are printed for debugging purposes. This is a good practice for debugging and understanding the state of the environment variables at the time the job ran. However, ensure that no sensitive information (like secrets or passwords) is being printed in the logs.

  • 38-43: The redundant code for setting Obscuro Gateway variables has been removed. This improves code maintainability. However, ensure that these variables are being set elsewhere in the code, as they are crucial for the correct functioning of the workflow.

  • 52-71: The Docker image building and pushing, VM deletion, and creation steps have been updated to use the new environment variables. This is a good practice as it makes the code more maintainable and less prone to errors. However, ensure that these new environment variables are being set correctly elsewhere in the code.

  • 120-127: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [97-127]

The command execution on the VM has been updated to use the new environment variables. This is a good practice as it makes the code more maintainable and less prone to errors. However, ensure that these new environment variables are being set correctly elsewhere in the code.

- name: 'Print GitHub variables'
# This is a useful record of what the environment variables were at the time the job ran, for debugging and reference
run: |
echo "GitHub Variables = ${{ toJSON(vars) }}"
Copy link

Choose a reason for hiding this comment

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

The toJSON(vars) function is used to print the GitHub variables. However, vars is not defined in the context of this workflow. If vars is intended to be a collection of environment variables, consider using env instead, which is a predefined object in GitHub Actions that contains the environment variables.

- echo "GitHub Variables = ${{ toJSON(vars) }}"
+ echo "GitHub Variables = ${{ toJSON(env) }}"

Copy link
Contributor

@otherview otherview left a comment

Choose a reason for hiding this comment

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

lgtm 👍

@BedrockSquirrel BedrockSquirrel merged commit 85f05f9 into main Oct 20, 2023
2 checks passed
@BedrockSquirrel BedrockSquirrel deleted the matt/standardise-remaining-gh-scripts branch October 20, 2023 13:37
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