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

feat(ci): build heighliner provenance docker image #1976

Merged
merged 1 commit into from
May 17, 2024

Conversation

scirner22
Copy link

@scirner22 scirner22 commented May 16, 2024

Description

Builds heighliner docker images and pushes to the official provenanceio registry rather than relying on heighliner ghcr.
This will allow us to better track when builds are failing and also allow us to push all previous tag builds.

Summary by CodeRabbit

  • Chores
    • Enhanced Docker setup and build process for continuous integration.
    • Enabled Docker image builds on pull requests.
    • Updated Docker workflow with improved trigger conditions and job configurations.

Copy link
Contributor

coderabbitai bot commented May 16, 2024

Walkthrough

The update brings significant improvements to Docker-related processes in the .github/workflows/docker.yml file. It introduces a new heighliner-docker job for Docker setup and builds, optimizes environment variables with a DOCKER_IMAGE declaration, and refines triggers to include pull_request alongside push.

Changes

File Change Summary
.github/workflows/docker.yml - Added pull_request trigger with specific paths
- Introduced env declaration for DOCKER_IMAGE: "provenanceio/provenance"
- Added a new job heighliner-docker with setup and build actions using Docker
- Integrated login and build actions for Docker within heighliner-docker job
- Removed DOCKER_IMAGE assignment in the Prepare step of the existing docker job

🐇
In the world of bits and bytes, where changes align,
A Docker job emerges, a process refined.
Triggers now dance for push and pull,
With Docker images, we're on a roll.
CodeRabbit's touch, a magical trace,
Efficiency and speed, all in place.
🐰🚢


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.

@scirner22 scirner22 marked this pull request as ready for review May 16, 2024 14:35
@scirner22 scirner22 requested a review from a team as a code owner May 16, 2024 14:35
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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 3feae77 and 86770bf.
Files selected for processing (1)
  • .github/workflows/docker.yml (3 hunks)
Additional comments not posted (2)
.github/workflows/docker.yml (2)

51-51: Ensure to remove or update the skip: true parameter before merging.

The skip: true parameter is used for testing purposes. Make sure to remove or update it to false before merging to enable the actual pushing of images.


12-13: Ensure the DOCKER_IMAGE variable is correctly defined and accessible.

The DOCKER_IMAGE variable is defined in the global environment. Verify that it is correctly referenced and accessible within the docker job.

Taztingo
Taztingo previously approved these changes May 16, 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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 86770bf and f9a5ec1.
Files selected for processing (1)
  • .github/workflows/docker.yml (2 hunks)
Additional comments not posted (14)
.github/workflows/docker.yml (14)

27-27: Standard checkout step.


28-28: Standard Docker Buildx setup step.


30-30: Standard QEMU setup step.


32-41: Metadata action configuration looks good.


42-45: Standard Docker login step.


55-55: Standard skip configuration.


60-60: Standard checkout step.


62-64: Standard Go setup step.


66-66: Standard Go modules vendor step.


68-68: Standard Docker Buildx setup step.


70-70: Standard QEMU setup step.


72-78: Metadata action configuration looks good.


80-83: Standard Docker login step.


Line range hint 85-93: Build and push action configuration looks good.

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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between f9a5ec1 and 39bc92e.
Files selected for processing (1)
  • .github/workflows/docker.yml (2 hunks)
Files not reviewed due to errors (1)
  • .github/workflows/docker.yml (no review received)

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: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 39bc92e and 6e9bf6f.
Files selected for processing (1)
  • .github/workflows/docker.yml (2 hunks)

.github/workflows/docker.yml Outdated Show resolved Hide resolved
.github/workflows/docker.yml Show resolved Hide resolved
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: 4

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 6e9bf6f and bfd72e3.
Files selected for processing (1)
  • .github/workflows/docker.yml (2 hunks)
Additional comments not posted (10)
.github/workflows/docker.yml (10)

29-29: LGTM! The actions/checkout@v4 step is correctly used.


30-30: LGTM! The docker/setup-buildx-action@v3 step is correctly used.


32-32: LGTM! The docker/setup-qemu-action@v2 step is correctly used.


45-48: LGTM! The docker/login-action@v3 step is correctly used.


59-59: LGTM! The skip parameter is correctly used to skip the build for pull requests.


64-64: LGTM! The actions/checkout@v4 step is correctly used.


66-68: LGTM! The actions/setup-go@v5 step is correctly used.


70-70: LGTM! The go mod vendor step is correctly used.


72-72: LGTM! The docker/setup-buildx-action@v3 step is correctly used.


74-74: LGTM! The docker/setup-qemu-action@v2 step is correctly used.

.github/workflows/docker.yml Outdated Show resolved Hide resolved
.github/workflows/docker.yml Outdated Show resolved Hide resolved
.github/workflows/docker.yml Outdated Show resolved Hide resolved
.github/workflows/docker.yml Show resolved Hide resolved
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: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between bfd72e3 and eba7407.
Files selected for processing (1)
  • .github/workflows/docker.yml (2 hunks)
Additional comments not posted (3)
.github/workflows/docker.yml (3)

14-14: Good practice to centralize Docker image naming.

Setting the DOCKER_IMAGE environment variable at the workflow level is a good practice as it centralizes the naming of the Docker image, making it easier to manage and modify if needed.


25-60: Review the new heighliner-docker job setup.

The new heighliner-docker job includes several steps crucial for Docker image building and pushing. Ensure that each step is configured correctly and that the overall flow aligns with the intended CI/CD pipeline enhancements.

Verification successful

The heighliner-docker job configuration appears to be correctly set up and aligned with the intended CI/CD pipeline enhancements. Each step uses the appropriate actions with proper syntax and logical flow.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the configuration and sequence of steps in the `heighliner-docker` job.

# Test: Check for any syntax errors or misconfigurations in the job setup.
rg --type yaml 'heighliner-docker' .github/workflows/docker.yml

Length of output: 84



Script:

#!/bin/bash
# Description: Extract and review the steps within the `heighliner-docker` job for correctness and alignment with the intended CI/CD pipeline enhancements.

# Extract the `heighliner-docker` job configuration
job_config=$(sed -n '/heighliner-docker:/,/^[^ ]/p' .github/workflows/docker.yml)

# Print the extracted job configuration
echo "$job_config"

Length of output: 7825


59-59: Ensure conditional logic for skipping Docker push on PR events is correct.

Using conditional logic to skip Docker image pushes during PR events is a prudent measure to prevent unintended updates to the Docker registry. This setup helps maintain a clean and controlled deployment process.

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: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between eba7407 and f6cb6bc.
Files selected for processing (1)
  • .github/workflows/docker.yml (2 hunks)
Additional comments not posted (2)
.github/workflows/docker.yml (2)

14-14: The environment variable DOCKER_IMAGE is set correctly to "provenanceio/provenance". This aligns with the PR's objective to push images to the provenanceio registry instead of ghcr.


25-63: The new job heighliner-docker is well-configured with steps for Docker setup, login, and build actions. However, the hardcoded heighliner-tag in line 53 might limit flexibility. If this is intentional due to specific versioning requirements from the Heighliner team, please add a comment explaining this decision to maintain clarity for future maintainers.

.github/workflows/docker.yml Outdated Show resolved Hide resolved
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: 0

Out of diff range and nitpick comments (2)
.github/workflows/docker.yml (2)

5-7: Clarify the purpose of the commented-out trigger.

The comments on lines 5-7 suggest that this trigger is for testing purposes and will not push images to Docker Hub. It might be beneficial to clarify this directly in the workflow file to avoid confusion for future maintainers or new team members.


53-53: Clarify the hardcoding of heighliner-tag.

The heighliner-tag is hardcoded to v1.5.5, which might limit flexibility. If this is intentional due to specific versioning requirements from the Heighliner team, please add a comment explaining this decision to maintain clarity for future maintainers.

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between f6cb6bc and 0075716.
Files selected for processing (1)
  • .github/workflows/docker.yml (2 hunks)
Additional comments not posted (2)
.github/workflows/docker.yml (2)

14-14: The environment variable DOCKER_IMAGE is correctly set to "provenanceio/provenance".

This aligns with the PR's objective to push Docker images to the provenanceio registry.


25-63: The heighliner-docker job setup appears robust and well-configured.

The steps for setting up Docker buildx, qemu, and metadata actions are correctly implemented. The Docker login and build actions are integrated effectively, ensuring secure and efficient Docker image building and pushing.

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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0075716 and c9b124a.
Files selected for processing (1)
  • .github/workflows/docker.yml (2 hunks)
Additional Context Used
Learnings (1)
.github/workflows/docker.yml (2)
User: SpicyLemon
PR: provenance-io/provenance#1976
File: .github/workflows/docker.yml:0-0
Timestamp: 2024-05-16T21:02:12.765Z
Learning: The `VERSION` value in the GitHub Actions workflow for building Docker images is dynamically set using `steps.meta.outputs.version` derived from the `docker/metadata-action`.
User: SpicyLemon
PR: provenance-io/provenance#1976
File: .github/workflows/docker.yml:0-0
Timestamp: 2024-05-16T20:54:09.533Z
Learning: The `heighliner-tag` field in the GitHub Actions workflow for building Docker images must be manually set to a specific version value based on external releases by the Heighliner team. Dynamic values are not suitable for this field.
Additional comments not posted (2)
.github/workflows/docker.yml (2)

25-61: Ensure the heighliner-tag is correctly set.

Verification successful

The heighliner-tag is correctly set to a specific version value (v1.5.5), which aligns with the requirement that it must be manually set based on external releases by the Heighliner team.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the `heighliner-tag` is set to a version that matches external releases by the Heighliner team.

# Test: Search for the `heighliner-tag` value in the workflow file. Expect: The tag matches a known Heighliner release.
rg --type yaml $'heighliner-tag: v1.5.5' .github/workflows/docker.yml

Length of output: 103


64-101: Review the Docker build and push configurations.

Ensure that the Docker image build and push steps are configured correctly, especially the push condition which prevents pushing on pull requests.

@scirner22 scirner22 requested review from SpicyLemon and Taztingo May 17, 2024 03:29
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: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between c9b124a and 7b6f812.
Files selected for processing (1)
  • .github/workflows/docker.yml (2 hunks)
Additional Context Used
Learnings (1)
.github/workflows/docker.yml (2)
User: SpicyLemon
PR: provenance-io/provenance#1976
File: .github/workflows/docker.yml:0-0
Timestamp: 2024-05-16T21:02:12.765Z
Learning: The `VERSION` value in the GitHub Actions workflow for building Docker images is dynamically set using `steps.meta.outputs.version` derived from the `docker/metadata-action`.
User: SpicyLemon
PR: provenance-io/provenance#1976
File: .github/workflows/docker.yml:0-0
Timestamp: 2024-05-16T20:54:09.533Z
Learning: The `heighliner-tag` field in the GitHub Actions workflow for building Docker images must be manually set to a specific version value based on external releases by the Heighliner team. Dynamic values are not suitable for this field.
Additional comments not posted (3)
.github/workflows/docker.yml (3)

15-15: The environment variable DOCKER_IMAGE is correctly set.


26-62: Review the new heighliner-docker job configuration for completeness and correctness.

Verification successful

To ensure the heighliner-docker job configuration is complete and correct, we need to verify each step and its parameters. Let's check for the presence and correctness of the following steps:

  1. actions/checkout@v4
  2. docker/setup-buildx-action@v3
  3. docker/setup-qemu-action@v2
  4. docker/metadata-action@v5
  5. docker/login-action@v3
  6. strangelove-ventures/heighliner-build-action@main

We will also verify the parameters for each step to ensure they are correctly configured.


Verification of heighliner-docker Job Configuration

The heighliner-docker job configuration in the .github/workflows/docker.yml file has been verified for completeness and correctness. The following steps and their parameters were checked:

  • actions/checkout@v4
  • docker/setup-buildx-action@v3
  • docker/setup-qemu-action@v2
  • docker/metadata-action@v5
  • docker/login-action@v3
  • strangelove-ventures/heighliner-build-action@main

All steps and their respective parameters are correctly configured and present in the workflow file.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the new `heighliner-docker` job configuration.

# Test: Check for any missing or incorrect configurations in the `heighliner-docker` job.
rg --type yaml 'heighliner-docker' .github/workflows/docker.yml

Length of output: 84



Script:

#!/bin/bash
# Verify the presence and correctness of each step in the `heighliner-docker` job configuration.

# Check for actions/checkout@v4
rg --type yaml 'uses: actions/checkout@v4' .github/workflows/docker.yml

# Check for docker/setup-buildx-action@v3
rg --type yaml 'uses: docker/setup-buildx-action@v3' .github/workflows/docker.yml

# Check for docker/setup-qemu-action@v2
rg --type yaml 'uses: docker/setup-qemu-action@v2' .github/workflows/docker.yml

# Check for docker/metadata-action@v5 and its parameters
rg --type yaml -A 10 'uses: docker/metadata-action@v5' .github/workflows/docker.yml

# Check for docker/login-action@v3 and its parameters
rg --type yaml -A 5 'uses: docker/login-action@v3' .github/workflows/docker.yml

# Check for strangelove-ventures/heighliner-build-action@main and its parameters
rg --type yaml -A 15 'uses: strangelove-ventures/heighliner-build-action@main' .github/workflows/docker.yml

Length of output: 2200


98-98: The VERSION value is dynamically set using steps.meta.outputs.version.

.github/workflows/docker.yml Show resolved Hide resolved
@scirner22 scirner22 requested a review from SpicyLemon May 17, 2024 19:31
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: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 7b6f812 and 0b59c1b.
Files selected for processing (1)
  • .github/workflows/docker.yml (2 hunks)
Additional Context Used
Learnings (1)
.github/workflows/docker.yml (2)
User: SpicyLemon
PR: provenance-io/provenance#1976
File: .github/workflows/docker.yml:0-0
Timestamp: 2024-05-16T21:02:12.765Z
Learning: The `VERSION` value in the GitHub Actions workflow for building Docker images is dynamically set using `steps.meta.outputs.version` derived from the `docker/metadata-action`.
User: SpicyLemon
PR: provenance-io/provenance#1976
File: .github/workflows/docker.yml:0-0
Timestamp: 2024-05-16T20:54:09.533Z
Learning: The `heighliner-tag` field in the GitHub Actions workflow for building Docker images must be manually set to a specific version value based on external releases by the Heighliner team. Dynamic values are not suitable for this field.
Additional comments not posted (2)
.github/workflows/docker.yml (2)

16-16: The environment variable DOCKER_IMAGE is correctly set to "provenanceio/provenance".


66-103: The docker job setup appears consistent and well-configured. The dynamic setting of the VERSION using steps.meta.outputs.version is a good practice, ensuring flexibility and maintainability.

.github/workflows/docker.yml Show resolved Hide resolved
.github/workflows/docker.yml Show resolved Hide resolved
@SpicyLemon SpicyLemon enabled auto-merge (squash) May 17, 2024 19:59
@SpicyLemon SpicyLemon disabled auto-merge May 17, 2024 20:03
@SpicyLemon SpicyLemon enabled auto-merge (squash) May 17, 2024 20:03
@scirner22 scirner22 force-pushed the scirner22/build-heighliner-image branch from 9b8ea32 to 9730318 Compare May 17, 2024 20:40
@SpicyLemon SpicyLemon merged commit e1471b2 into main May 17, 2024
23 checks passed
@SpicyLemon SpicyLemon deleted the scirner22/build-heighliner-image branch May 17, 2024 20:41
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

Out of diff range and nitpick comments (1)
.github/workflows/docker.yml (1)

5-8: The paths filter for pull requests is a good practice to limit workflow runs to relevant changes. However, consider expanding the paths to include other Docker-related files or workflows that might affect the Docker build process.

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0b59c1b and 9730318.
Files selected for processing (1)
  • .github/workflows/docker.yml (2 hunks)
Additional Context Used
Learnings (1)
.github/workflows/docker.yml (2)
User: SpicyLemon
PR: provenance-io/provenance#1976
File: .github/workflows/docker.yml:0-0
Timestamp: 2024-05-16T20:54:09.533Z
Learning: The `heighliner-tag` field in the GitHub Actions workflow for building Docker images must be manually set to a specific version value based on external releases by the Heighliner team. Dynamic values are not suitable for this field.
User: SpicyLemon
PR: provenance-io/provenance#1976
File: .github/workflows/docker.yml:0-0
Timestamp: 2024-05-16T21:02:12.765Z
Learning: The `VERSION` value in the GitHub Actions workflow for building Docker images is dynamically set using `steps.meta.outputs.version` derived from the `docker/metadata-action`.
Additional comments not posted (3)
.github/workflows/docker.yml (3)

16-16: The environment variable DOCKER_IMAGE is well-defined and aligns with the PR's objective to push images to the provenanceio registry.


63-63: The use of skip: ${{ github.event_name == 'pull_request' }} is a clever way to prevent pushing images on pull request events, aligning with best practices to avoid unintended pushes from feature branches.


66-103: The docker job is configured similarly to the heighliner-docker job but focuses on building and pushing the Docker image for the main application. The use of dynamic versioning with steps.meta.outputs.version is a good practice, ensuring that the build tags are aligned with the metadata generated by the docker/metadata-action.

.github/workflows/docker.yml Show resolved Hide resolved
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.

5 participants