fix: simplify Forge AWS deploy to branch and slot - #16252
Conversation
Keep only the slot input. Build the branch selected in Use workflow from. Hard-code region and stack name. Package without running Forge tests. Give the deploy role cloudformation:GetTemplate so UpdateEnvironment works. Stop re-declaring the Shadow plugin; configure shadowJar when Micronaut applies it.
fix: simplify Forge AWS deploy to branch and slot
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Simplifies the Forge AWS Elastic Beanstalk deploy workflow to be driven by the workflow’s selected branch (“Use workflow from”) plus a deployment slot, with fewer inputs and less work during deploy.
Changes:
- Remove deploy inputs (source ref/release/stack/region) and hard-code region/stack values in the workflow.
- Package only for EB deploy (skip tests) and streamline upload/deploy steps.
- Update IAM permissions and Gradle ShadowJar wiring to match the new deploy packaging behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
grails-forge/infrastructure/shared.yaml |
Expands CloudFormation permissions to support EB UpdateEnvironment behavior. |
grails-forge/grails-forge-web-netty/build.gradle |
Removes explicit Shadow plugin declaration and refactors ShadowJar/zip task wiring for EB packaging. |
grails-forge/docs/aws-elastic-beanstalk.md |
Updates deployment documentation to match branch+slot workflow dispatch model. |
.github/workflows/forge-deploy-aws.yml |
Simplifies dispatch inputs, hard-codes region/stack, and reduces deploy steps to packaging + upload/deploy. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| - Action: | ||
| - cloudformation:DescribeStacks | ||
| - cloudformation:DescribeStackResources | ||
| - cloudformation:GetTemplate | ||
| Effect: Allow | ||
| Resource: '*' |
| ['com.gradleup.shadow', 'com.github.johnrengelman.shadow'].each { pluginId -> | ||
| pluginManager.withPlugin(pluginId) { | ||
| tasks.named('shadowJar', ShadowJar).configure { | ||
| reproducibleFileOrder = true | ||
| preserveFileTimestamps = false | ||
| } | ||
| } | ||
| } | ||
|
|
||
| TaskProvider<Zip> awsElasticBeanstalk = tasks.register('awsElasticBeanstalk', Zip) { | ||
| dependsOn(shadowJarTask) | ||
| dependsOn('shadowJar') |
| from({ tasks.named('shadowJar').get().archiveFile.get() }) { | ||
| rename { 'app.jar' } | ||
| } |
| preserveFileTimestamps = false | ||
|
|
||
| from(shadowJarTask.flatMap { it.archiveFile }) { | ||
| from({ tasks.named('shadowJar').get().archiveFile.get() }) { |
| # reads javaVersion from gradle.properties. OIDC trusts refs/heads/*.x and | ||
| # refs/tags/v* in apache/grails-core, so new version branches need no template edit. | ||
| # Dispatch from the maintenance branch that should be built (Use workflow from). | ||
| # Choose the slot. Region, stack name, and JDK come from that branch. |
| AWS_REGION: us-east-1 | ||
| AWS_DEFAULT_REGION: us-east-1 | ||
| AWS_PAGER: "" | ||
| DEPLOY_ROLE_ARN: ${{ vars.AWS_FORGE_DEPLOY_ROLE_ARN }} | ||
| RELEASE: ${{ inputs.release }} | ||
| SHARED_STACK: ${{ inputs.shared_stack }} | ||
| SHARED_STACK: grails-forge-shared |
| - name: "Configure AWS credentials through OIDC" | ||
| uses: aws-actions/configure-aws-credentials@e7f100cf4c008499ea8adda475de1042d6975c7b # v6.2.0 | ||
| with: | ||
| role-to-assume: ${{ env.DEPLOY_ROLE_ARN }} | ||
| aws-region: ${{ inputs.aws_region }} | ||
| aws-region: us-east-1 | ||
|
|
||
| - name: "Discover shared deployment resources" | ||
| id: shared | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| if [[ -z "${DEPLOY_ROLE_ARN}" ]]; then | ||
| echo "AWS_FORGE_DEPLOY_ROLE_ARN must be configured as a repository variable." >&2 | ||
| exit 1 | ||
| fi |
| name: "Deploy ${{ inputs.slot }} to AWS Elastic Beanstalk" | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 75 | ||
| timeout-minutes: 40 |
| elif [[ "${update_started}" == true ]]; then | ||
| echo "Deployment failed, but no prior application version is available for rollback." >&2 | ||
| echo "Deployment failed. Rolling back ${ENVIRONMENT_NAME}." | ||
| aws elasticbeanstalk update-environment --environment-name "${ENVIRONMENT_NAME}" --version-label "${previous_version}" >/dev/null || true |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.1.x #16252 +/- ##
=============================================
Coverage 29.8834% 29.8834%
Complexity 509 509
=============================================
Files 79 79
Lines 4715 4715
Branches 814 814
=============================================
Hits 1409 1409
Misses 3063 3063
Partials 243 243 🚀 New features to boost your workflow:
|
Description
Simplify Forge AWS deploy to branch + slot.
source_ref, release, stack, and region inputs. Use the branch from Use workflow from.us-east-1andgrails-forge-shared.awsElasticBeanstalk); do not run Forge tests on deploy.cloudformation:GetTemplateso Elastic BeanstalkUpdateEnvironmentworks.com.gradleup.shadow(it is already on the Micronaut classpath).