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

Automatically update bootstrap template #897

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open

Conversation

GarrettBeatty
Copy link
Contributor

@GarrettBeatty GarrettBeatty commented Mar 19, 2025

Issue #, if available:

Description of changes:

  1. Updated github workflow to be automatically ran every monday and will create a PR to update the CDK bootstrap template. It can also be ran manually if needed.
  2. Example PR that it made https://github.com/aws/aws-dotnet-deploy/pull/898/files. This was an old one that was made before i made more updates. I have to wait for a new version to be released to finally test.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@GarrettBeatty GarrettBeatty added the Release Not Needed Add this label if a PR does not need to be released. label Mar 19, 2025
@GarrettBeatty GarrettBeatty changed the title Automatically Update bootstrap file Automatically update bootstrap file Mar 19, 2025
@GarrettBeatty GarrettBeatty marked this pull request as ready for review March 19, 2025 17:31
@GarrettBeatty GarrettBeatty requested a review from philasmar March 19, 2025 17:31
@GarrettBeatty GarrettBeatty changed the title Automatically update bootstrap file Automatically update bootstrap template Mar 19, 2025
Copy link

codecov bot commented Mar 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.78%. Comparing base (7fb14e2) to head (c0fe42f).
Report is 1 commits behind head on dev.

Additional details and impacted files
@@             Coverage Diff             @@
##              dev     #897       +/-   ##
===========================================
+ Coverage   38.75%   62.78%   +24.02%     
===========================================
  Files         282      282               
  Lines       10922    10922               
  Branches     1517     1517               
===========================================
+ Hits         4233     6857     +2624     
+ Misses       6382     3526     -2856     
- Partials      307      539      +232     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ashishdhingra ashishdhingra requested a review from normj March 20, 2025 16:25
generate change file

use v8

use release workflow secret
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
AWS_SECRET, ${{ secrets.RELEASE_WORKFLOW_ACCESS_TOKEN_NAME }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

reusing the same token that sync-dev main workflow uses because thats the easiest


jobs:
detect-cdk-bootstrap-changes:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a v4 version available now. COuld you use that an pin it to a commit id?

ref: dev

- name: Setup .NET
uses: actions/setup-dotnet@v3
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a v4 version available now. COuld you use that an pin it to a commit id?

Comment on lines 42 to 59
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you need to install this now? It was natively available in the old version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

was just a precaution. ill remove it

echo "current-version=$(yq '.Resources.CdkBootstrapVersion.Properties.Value' 'src/AWS.Deploy.Orchestration/CDK/CDKBootstrapTemplate.yaml')" >> $GITHUB_OUTPUT
- name: Fail If CDK Bootstrap Template Changes Detected
if: steps.currentBootstrapVersion.outputs.current-version != steps.latestBootstrapVersion.outputs.latest-version
dotnet tool install -g autover
Copy link
Contributor

Choose a reason for hiding this comment

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

pin to a specific version

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated and also pinned rest of versions

env:
NEW_VERSION: ${{ steps.check_version.outputs.new_version }}
run: |
dotnet tool install -g autover
Copy link
Contributor

Choose a reason for hiding this comment

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

pin to a specific version


- name: Create Pull Request
if: steps.check_version.outputs.version_changed == 'true'
uses: peter-evans/create-pull-request@v5
Copy link
Contributor

Choose a reason for hiding this comment

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

use the GitHub CLI to create a PR instead of this action.

This PR automatically updates the CDK bootstrap template to version ${{ steps.check_version.outputs.new_version }}.
- Updates template to latest version
- Maintains DeletePolicy and UpdateReplacePolicy as "Delete" for StagingBucket
- Adds change file for version tracking
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: i'd remove this entry.

src/AWS.Deploy.Orchestration/CDK/CDKBootstrapTemplate.yaml
.autover/

- name: Cleanup
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this step is unnecessary. The container gets deleted when the workflow is done.

@GarrettBeatty GarrettBeatty requested a review from philasmar March 21, 2025 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release Not Needed Add this label if a PR does not need to be released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants