-
Notifications
You must be signed in to change notification settings - Fork 0
Added spinup-destroy.yml workflow #4
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @msalsouri, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new GitHub Actions workflow designed to automate the lifecycle management of Azure environments directly from pull requests. By leveraging specific labels, developers can now effortlessly provision temporary Azure resources for testing and development, and subsequently dismantle them, thereby streamlining the development process and ensuring efficient resource utilization. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request adds a new workflow file spinup-destroy.yml to configure and destroy Azure resources based on pull request labels. The workflow includes jobs for setting up Azure resources (creating resource group, app service plan, and webapp) and destroying them. The workflow is triggered when a pull request is labeled with 'spin up environment' or 'destroy environment'. I have identified a potential issue with the hardcoded username in the AZURE_WEBAPP_NAME environment variable, which could lead to naming conflicts.
| ############################################### | ||
| ### Replace <username> with GitHub username ### | ||
| ############################################### | ||
| AZURE_WEBAPP_NAME: <username>-ttt-app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AZURE_WEBAPP_NAME includes a hardcoded <username> placeholder. This will likely cause naming conflicts when multiple users try to spin up environments. Consider using a more unique identifier, such as the GitHub user's ID or the pull request number, to ensure unique web app names. This is a critical issue because it prevents the workflow from functioning correctly in a multi-user environment.
I suggest using the GitHub user's ID or the pull request number in combination with the username to ensure uniqueness. For example, you could use ${{ github.actor }}-${{ github.event.pull_request.number }}-ttt-app.
AZURE_WEBAPP_NAME: ${{ github.actor }}-${{ github.event.pull_request.number }}-ttt-app| IMAGE_REGISTRY_URL: ghcr.io | ||
| AZURE_RESOURCE_GROUP: cd-with-actions | ||
| AZURE_APP_PLAN: actions-ttt-deployment | ||
| AZURE_LOCATION: '"East US"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AZURE_LOCATION is hardcoded as '"East US"'. While this works, it might be beneficial to allow users to configure this via a repository secret or workflow input. This would provide more flexibility and allow the workflow to be used in different Azure regions. Consider making this configurable.
AZURE_LOCATION: ${{ secrets.AZURE_LOCATION || '"East US"' }}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| setup-up-azure-resources: | ||
| runs-on: ubuntu-latest | ||
| if: contains(github.event.pull_request.labels.*.name, 'spin up environment') | ||
| steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gate setup job on the label that triggered the event
The workflow fires on every pull_request "labeled" event, but the job condition checks contains(github.event.pull_request.labels.*.name, 'spin up environment'). After a PR receives the spin up environment label, any subsequent label addition (including adding destroy environment) still satisfies this predicate and reruns the provisioning job, racing with the destroy job or repeatedly recreating the same infrastructure. The condition should compare against github.event.label.name (or similar) so the job runs only when that specific label is added.
Useful? React with 👍 / 👎.
No description provided.