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

Update cdk ecr images when docker hash changes #1080

Conversation

AndreKurait
Copy link
Member

@AndreKurait AndreKurait commented Oct 18, 2024

Description

The ECR cdk constructs need an identifier to detect changes in docker images and republish.
This will cause stale images during updates since #1061

  • Category: Bug Fix
  • Why these changes are required? Trigger cdk to check and update docker images
  • What is the old behavior before changes and new behavior after changes? ecr assets weren't being updated

Issues Resolved

MIGRATIONS-2123

Is this a backport? If so, please add backport PR # and/or commits #

Testing

Unit testing, tested in bootstrap box in Migration Assistant.

Tested in bootstrap box with cases:

  • Update in image showed new uploaded asset
  • No Image Update gave no uploaded asset
App Registry mode is enabled for CFN stack tracking. Will attempt to import the App Registry application from the MIGRATIONS_APP_REGISTRY_ARN env variable of arn:aws:servicecatalog:us-east-1:767398060394:/applications/04dyc62dnah9wna7b4bv297vtf and looking in the configured region of us-east-1
start: Building c3444a85bee243ed616eb59bacec6765ee4d6c18345523c1b386c573c13824bf:767398060394-us-east-1
success: Built c3444a85bee243ed616eb59bacec6765ee4d6c18345523c1b386c573c13824bf:767398060394-us-east-1
start: Publishing c3444a85bee243ed616eb59bacec6765ee4d6c18345523c1b386c573c13824bf:767398060394-us-east-1
success: Published c3444a85bee243ed616eb59bacec6765ee4d6c18345523c1b386c573c13824bf:767398060394-us-east-1
Hold on while we create a read-only change set to get a diff with accurate replacement information (use --no-change-set to use a less accurate but faster template-only diff)
Stack migration-console (OSMigrations-blog-rfs-us-east-1-MigrationConsole)
Resources
[~] AWS::ECS::TaskDefinition ServiceTaskDef ServiceTaskDef35F813FB replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -36,7 +36,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "767398060394.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-767398060394-us-east-1:ac187202d10451949d9fd84b295f2153667490b2026fa399d4e5a23b47290b1d"
        [+]   "Fn::Sub": "767398060394.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-767398060394-us-east-1:652e54d12c4ea1000a4ca4425a84c15d75e169a435e622a17850e54d73227315"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",


✨  Number of stacks with differences: 1

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

codecov bot commented Oct 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.63%. Comparing base (d7224ce) to head (9bc8bb6).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1080   +/-   ##
=========================================
  Coverage     80.63%   80.63%           
  Complexity     2893     2893           
=========================================
  Files           383      383           
  Lines         14342    14342           
  Branches        989      989           
=========================================
  Hits          11565    11565           
  Misses         2184     2184           
  Partials        593      593           
Flag Coverage Δ
gradle-test 78.75% <ø> (ø)
python-test 90.24% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Signed-off-by: Andre Kurait <akurait@amazon.com>
Signed-off-by: Andre Kurait <akurait@amazon.com>
@AndreKurait AndreKurait force-pushed the UpdateDockerImagesWhenSourceChanges branch from 1c377a2 to 9bc8bb6 Compare October 18, 2024 16:55
Copy link
Collaborator

@gregschohn gregschohn left a comment

Choose a reason for hiding this comment

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

Please see the comment about logging when we do the docker pull. This fixes a critical, non-obvious gap though.

Comment on lines -203 to -214
- name: Mock Docker Images for CDK Tests
run: |
image=$(docker images --format '{{.Repository}}:{{.Tag}}' | head -n 1)
echo "Using image for mocked tags: $image"
docker tag $image migrations/capture_proxy:latest
docker tag $image migrations/capture_proxy_es:latest
docker tag $image opensearchproject/opensearch:2
docker tag $image migrations/elasticsearch_searchguard:latest
docker tag $image docker.io/apache/kafka:3.7.0
docker tag $image migrations/migration_console:latest
docker tag $image migrations/reindex_from_snapshot:latest
docker tag $image migrations/traffic_replayer:latest
Copy link
Collaborator

Choose a reason for hiding this comment

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

thanks for removing this

@AndreKurait AndreKurait merged commit 43913b1 into opensearch-project:main Oct 18, 2024
14 checks passed
@AndreKurait AndreKurait deleted the UpdateDockerImagesWhenSourceChanges branch October 18, 2024 18:22
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