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

chore(ci): Use DOCKER_REGISTRY, and compat #17051

Merged
merged 5 commits into from
Nov 27, 2024
Merged

Conversation

AndesKrrrrrrrrrrr
Copy link
Member

@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr commented Nov 27, 2024

When developing locally, setting the correct registry is annoying. With this we can build locally more easily with --build-arg DOCKER_REGISTRY=docker.io when needed.

Summary by CodeRabbit

  • Chores
    • Updated Dockerfile to improve clarity and maintainability of image registry arguments.
    • Introduced new registry arguments for backward compatibility while standardizing references.

This is so the registry is always postfixed with `/docker`, unless you
set the `DOCKER_REGISTRY` build-arg (never done in CI, but used locally)
Copy link
Contributor

coderabbitai bot commented Nov 27, 2024

Walkthrough

The pull request modifies the scripts/ci/Dockerfile to enhance the handling of Docker image registry arguments. The existing DOCKER_IMAGE_REGISTRY argument has been replaced with DOCKER_ECR_REGISTRY, which now includes /docker in its path. A new DOCKER_REGISTRY argument has been added for backward compatibility. All FROM statements referencing DOCKER_IMAGE_REGISTRY have been updated to use DOCKER_REGISTRY. The multi-stage build structure remains unchanged, with consistent propagation of environment variables related to Git information.

Changes

File Change Summary
scripts/ci/Dockerfile - Replaced DOCKER_IMAGE_REGISTRY with DOCKER_ECR_REGISTRY including /docker in its path.
- Added DOCKER_IMAGE_REGISTRY for backward compatibility.
- Introduced DOCKER_REGISTRY pointing to the updated DOCKER_IMAGE_REGISTRY.
- Updated FROM statements to use DOCKER_REGISTRY.
- Maintained multi-stage build structure and environment variable propagation.

Possibly related PRs

Suggested labels

deploy-feature

Suggested reviewers

  • busla
  • svanaeinars

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr marked this pull request as ready for review November 27, 2024 15:32
@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr requested a review from a team as a code owner November 27, 2024 15:32
@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr added the automerge Merge this PR as soon as all checks pass label Nov 27, 2024
Copy link
Contributor

@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.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
scripts/ci/Dockerfile (1)

3-6: Consider improving the clarity of registry path manipulation

While the implementation is correct, the string manipulation ${DOCKER_ECR_REGISTRY%/docker} might not be immediately clear to all developers.

Consider either:

  1. Adding a comment explaining the %/docker operation:
 ARG DOCKER_ECR_REGISTRY=public.ecr.aws/docker
+# Remove '/docker' suffix from DOCKER_ECR_REGISTRY to maintain compatibility
 ARG DOCKER_IMAGE_REGISTRY=${DOCKER_ECR_REGISTRY%/docker}
  1. Or using a more explicit approach:
 ARG DOCKER_ECR_REGISTRY=public.ecr.aws/docker
-ARG DOCKER_IMAGE_REGISTRY=${DOCKER_ECR_REGISTRY%/docker}
+ARG DOCKER_IMAGE_REGISTRY=public.ecr.aws
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 15571ef and f0b821c.

📒 Files selected for processing (1)
  • scripts/ci/Dockerfile (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
scripts/ci/Dockerfile (1)

Pattern scripts/**/*: "Confirm that the code adheres to the following:

  • Script efficiency, readability, and maintainability.
  • Usage of environmental variables and configuration files for flexibility.
  • Integration with NX workspace utilities and commands."
🔇 Additional comments (1)
scripts/ci/Dockerfile (1)

3-6: Verify documentation and build script updates

The registry changes require verification of related documentation and build scripts to ensure a smooth local development experience.

✅ Verification successful

Registry changes are properly handled across build scripts

The registry changes in the Dockerfile are well-integrated with the build system:

  • The new registry variables are properly referenced in the CI scripts
  • Default fallbacks are in place in _common.sh for backward compatibility
  • Build scripts use the registry variables consistently
  • Local development is supported through the DOCKER_REGISTRY environment variable with proper defaults

The only affected files are build-related scripts, and they handle the changes appropriately. No documentation updates are required as the changes are transparent to users due to the backward compatibility layer.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if documentation and build scripts are updated for the new registry variables

# Look for related documentation
echo "Checking documentation..."
rg -l "DOCKER_IMAGE_REGISTRY|DOCKER_ECR_REGISTRY|DOCKER_REGISTRY" "*.md" "docs/"

# Check build scripts
echo "Checking build scripts..."
rg -l "DOCKER_IMAGE_REGISTRY|DOCKER_ECR_REGISTRY|DOCKER_REGISTRY" "scripts/"

Length of output: 492


Script:

#!/bin/bash
# Let's check the content of these files to understand the usage and potential impact

echo "=== Checking docker-login-ecr.sh ==="
cat scripts/ci/docker-login-ecr.sh

echo -e "\n=== Checking _common.sh ==="
cat scripts/ci/_common.sh

echo -e "\n=== Checking _docker.sh ==="
cat scripts/ci/_docker.sh

echo -e "\n=== Checking Dockerfile.proxy ==="
cat scripts/Dockerfile.proxy

Length of output: 3880

scripts/ci/Dockerfile Show resolved Hide resolved
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 35.69%. Comparing base (34a9064) to head (94e28d5).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #17051   +/-   ##
=======================================
  Coverage   35.69%   35.69%           
=======================================
  Files        6939     6939           
  Lines      147081   147081           
  Branches    41832    41832           
=======================================
+ Hits        52495    52498    +3     
+ Misses      94586    94583    -3     
Flag Coverage Δ
api 3.34% <ø> (ø)
application-system-api 38.73% <ø> (-0.01%) ⬇️
application-template-api-modules 27.78% <ø> (ø)
message-queue 68.87% <ø> (+0.73%) ⬆️
services-user-notification 46.76% <ø> (ø)

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

see 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 34a9064...94e28d5. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Nov 27, 2024

Datadog Report

All test runs 212712b 🔗

5 Total Test Services: 0 Failed, 5 Passed
⬆️ Test Sessions change in coverage: 1 increased (+0.83%), 7 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 2.39s 1 no change Link
application-system-api 0 0 0 40 0 2m 17.22s 1 no change Link
application-template-api-modules 0 0 0 118 0 2m 4.45s 1 no change Link
message-queue 0 0 0 10 0 41.29s 1 increased (+0.83%) Link
services-user-notification 0 0 0 51 0 1m 20.99s 1 no change Link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants