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

CI: Add VERSION label to docker images #117

Merged
merged 1 commit into from
Apr 7, 2024
Merged

Conversation

glensc
Copy link
Collaborator

@glensc glensc commented Apr 7, 2024

No description provided.

Copy link

coderabbitai bot commented Apr 7, 2024

Walkthrough

The recent updates involve enhancements to Docker image management across three GitHub workflow files. A new flag has been introduced to the docker build command, allowing for the Docker images to be labeled with version information directly. This modification simplifies the process of tagging Docker images with their respective versions, making it more efficient and streamlined.

Changes

Files Change Summary
.github/workflows/docker-alpha.yml
.github/workflows/docker-beta.yml
.github/workflows/release-docker.yml
Added --label=VERSION=${DOCKER_TAG} flag to docker build command

Poem

🐇✨
In the land of code and docker files,
A rabbit hopped through digital miles.
"A label here, a tag now there,"
It sang, while hopping with flair.
"Now every image, clear as day,
Carries its version on its way."
🎉🐰

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link

@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: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4c43573 and 63c83e7.
Files selected for processing (3)
  • .github/workflows/docker-alpha.yml (1 hunks)
  • .github/workflows/docker-beta.yml (1 hunks)
  • .github/workflows/release-docker.yml (1 hunks)
Additional comments not posted (3)
.github/workflows/docker-beta.yml (1)

24-24: The addition of the --label=VERSION=${DOCKER_TAG} flag to the Docker build command is a good practice for version tracking. Ensure that the DOCKER_TAG environment variable is correctly set and used throughout the CI process.

Verification successful

The review comment is verified as accurate. The DOCKER_TAG environment variable is correctly set using a timestamp before its usage in the Docker build command, ensuring proper version tracking and consistency throughout the CI process. This setup aligns with best practices for dynamic and unique artifact tagging in CI/CD workflows.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify DOCKER_TAG is set before this step
grep -B3 'docker build' .github/workflows/docker-beta.yml | grep 'DOCKER_TAG'

Length of output: 201



Script:

#!/bin/bash
# Search for any explicit setting of DOCKER_TAG in the workflow file
grep 'DOCKER_TAG' .github/workflows/docker-beta.yml

# Search for steps that might dynamically set DOCKER_TAG
grep -A5 'run:' .github/workflows/docker-beta.yml | grep 'DOCKER_TAG'

Length of output: 761

.github/workflows/docker-alpha.yml (1)

24-24: The addition of the --label=VERSION=${DOCKER_TAG} flag to the Docker build command is a good practice for version tracking. Ensure that the DOCKER_TAG environment variable is correctly set and used throughout the CI process.

Verification successful

The DOCKER_TAG environment variable is correctly set using a timestamp before its usage in the Docker build command, as shown in the .github/workflows/docker-alpha.yml workflow. This ensures unique versioning for each build and confirms the appropriate setting and usage of DOCKER_TAG throughout the CI process. The initial review comment is thus verified.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify DOCKER_TAG is set before this step
grep -B3 'docker build' .github/workflows/docker-alpha.yml | grep 'DOCKER_TAG'

Length of output: 202



Script:

#!/bin/bash
# Search for any occurrences of DOCKER_TAG in the docker-alpha.yml workflow to understand its definition and usage
grep 'DOCKER_TAG' .github/workflows/docker-alpha.yml -A2 -B2

Length of output: 706

.github/workflows/release-docker.yml (1)

23-23: The addition of the --label=VERSION=${DOCKER_TAG} flag to the Docker build command is a good practice for version tracking, especially for release builds. Ensure that the DOCKER_TAG environment variable, derived from the GitHub release tag, is correctly used throughout the CI process.

Verification successful

The verification process confirms that the DOCKER_TAG environment variable is correctly set using the GitHub release tag (${{ github.event.release.tag_name }}) before its usage in the Docker build command. This aligns with best practices for version tracking in Docker images and confirms the accuracy of the initial review comment.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify DOCKER_TAG is set from the GitHub release tag before this step
grep -B3 'docker build' .github/workflows/release-docker.yml | grep 'DOCKER_TAG'

Length of output: 204



Script:

#!/bin/bash
# Search for the setting of DOCKER_TAG in the entire workflow file
grep 'DOCKER_TAG' .github/workflows/release-docker.yml

Length of output: 402

@nylonee
Copy link
Owner

nylonee commented Apr 7, 2024

Hmm, this PR looks good in theory, but looks like the CI/CD is failing here, I'll take a look

@nylonee
Copy link
Owner

nylonee commented Apr 7, 2024

Looks like you might need to be a 'collaborator'. I've sent you an invite, once you've accepted that try re-running the docker alpha release here and let's see if it works

@glensc
Copy link
Collaborator Author

glensc commented Apr 7, 2024

for reference, the error being unable to login to docker.io:

Run docker/login-action@v1
Error: Username and password required

Copy link

@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: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between f7eb987 and 12a8b01.
Files selected for processing (3)
  • .github/workflows/docker-alpha.yml (1 hunks)
  • .github/workflows/docker-beta.yml (1 hunks)
  • .github/workflows/release-docker.yml (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/docker-alpha.yml
  • .github/workflows/docker-beta.yml
  • .github/workflows/release-docker.yml

@nylonee
Copy link
Owner

nylonee commented Apr 7, 2024

Ah after some more digging, looks like it's because you're pushing from your repository to this one.

The Github Actions Secrets page has this:

Anyone with collaborator access to this repository can use these secrets and variables for actions. They are not passed to workflows that are triggered by a pull request from a fork.

I think this is reasonable, I certainly don't want my docker token to be used everywhere!

I can merge this PR for now, but if you need github actions to trigger in the future then it'd be better to use the nylonee/watchlistarr repository, or set up your own DOCKERHUB_TOKEN and DOCKERHUB_USERNAME (though it'll get pushed to your docker repository, at least that test will pass and you can test the docker image straight from a PR)

@nylonee nylonee merged commit 9b31fad into nylonee:main Apr 7, 2024
1 of 2 checks passed
@glensc glensc deleted the image-tag branch April 7, 2024 11:45
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