Skip to content

Conversation

tolbrino
Copy link
Contributor

@tolbrino tolbrino commented Dec 5, 2024

By default PRs build docker images which include a hoprd debug build. This is done to have faster build times in the CI. This PR adds the option to build production images by adding the Github label docker-production-build to a PR and rebuilding the image.

@tolbrino tolbrino self-assigned this Dec 5, 2024
Copy link
Contributor

coderabbitai bot commented Dec 5, 2024

📝 Walkthrough

Walkthrough

The pull request modifies GitHub Actions workflows for building Docker images and DAppNode packages. In .github/workflows/build-docker.yaml, the logic for setting build options and environment variables is updated to enhance control flow based on pull request labels and input parameters. The .github/workflows/build.yaml file sees a minor formatting change in job dependencies. These adjustments aim to improve the clarity and functionality of the workflows without altering their core logic.

Changes

File Path Change Summary
.github/workflows/build-docker.yaml Updated conditions for nix_debug_option and HOPRD_CLUSTER_NAME; added new deployment trigger conditions.
.github/workflows/build.yaml Adjusted the needs attribute in the build-dappnode job for clearer job dependencies.

Possibly related PRs

  • Pipeline improvements #6551: The changes in this PR involve enhancements to the pipeline processes, including modifications to the Docker image tagging logic, which is directly related to the changes made in the main PR regarding Docker image build options and conditions.
  • Allow to launch binaries manually #6681: This PR introduces a manual invocation for building binaries, which includes changes to the workflow that may interact with the Docker build process, particularly in how binaries are managed and triggered in relation to Docker builds.

Suggested labels

devops, package:DAppNodePackage-Hopr-testnet

Suggested reviewers

  • Teebor-Choka

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.

@github-actions github-actions bot added the toolchain Developer and product happiness label Dec 5, 2024
@tolbrino tolbrino marked this pull request as ready for review December 5, 2024 08:22
@tolbrino tolbrino requested a review from a team December 5, 2024 08:22
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

🧹 Outside diff range and nitpick comments (2)
.github/workflows/build-docker.yaml (2)

Line range hint 134-134: Fix syntax error in deployment trigger condition

The current condition has a syntax error and might not evaluate as intended.

Apply this fix:

-      - name: Trigger deploy workflow if needed
-        if: (contains(github.event.pull_request.labels.*.name, 'deploy_nodes') || inputs.production ) && contains(inputs.package,'hoprd' && vars.CONTINUOUS_DEPLOYMENT_ENABLED == 'true')
+      - name: Trigger deploy workflow if needed
+        if: (contains(github.event.pull_request.labels.*.name, 'deploy_nodes') || inputs.production) && contains(inputs.package, 'hoprd') && vars.CONTINUOUS_DEPLOYMENT_ENABLED == 'true'

This fix:

  1. Properly separates the contains() check for 'hoprd'
  2. Correctly applies the logical operators
  3. Makes the condition more readable
🧰 Tools
🪛 actionlint (1.7.4)

67-67: shellcheck reported issue in this script: SC2078:error:2:7: This expression is constant. Did you forget a $ somewhere?

(shellcheck)


67-67: shellcheck reported issue in this script: SC2078:error:2:35: This expression is constant. Did you forget a $ somewhere?

(shellcheck)


67-67: shellcheck reported issue in this script: SC2129:style:9:3: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:9:38: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:10:44: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:11:95: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:14:29: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2001:style:15:16: See if you can use ${variable//search/replace} instead

(shellcheck)


67-67: shellcheck reported issue in this script: SC2001:style:16:19: See if you can use ${variable//search/replace} instead

(shellcheck)


67-67: shellcheck reported issue in this script: SC2129:style:17:3: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:17:38: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:18:44: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:19:95: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:28:42: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:30:65: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:32:66: Double quote to prevent globbing and word splitting

(shellcheck)


Line range hint 1-140: Consider workflow improvements

While the workflow functions correctly, consider these improvements for maintainability:

  1. Add comments explaining the purpose and format of different image tags
  2. Add a step to verify required environment variables at the start of the workflow

Example addition for environment variable verification:

      - name: Verify required environment variables
        run: |
          required_vars=(
            "DOCKER_IMAGE_REGISTRY"
            "BRANCH_MASTER_RELEASE_NAME"
            "BRANCH_RELEASE_RELEASE_NAME"
            "CONTINUOUS_DEPLOYMENT_ENABLED"
          )
          for var in "${required_vars[@]}"; do
            if [[ -z "${!var}" ]]; then
              echo "::error::Required environment variable $var is not set"
              exit 1
            fi
          done
🧰 Tools
🪛 actionlint (1.7.4)

67-67: shellcheck reported issue in this script: SC2078:error:2:7: This expression is constant. Did you forget a $ somewhere?

(shellcheck)


67-67: shellcheck reported issue in this script: SC2078:error:2:35: This expression is constant. Did you forget a $ somewhere?

(shellcheck)


67-67: shellcheck reported issue in this script: SC2129:style:9:3: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:9:38: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:10:44: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:11:95: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:14:29: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2001:style:15:16: See if you can use ${variable//search/replace} instead

(shellcheck)


67-67: shellcheck reported issue in this script: SC2001:style:16:19: See if you can use ${variable//search/replace} instead

(shellcheck)


67-67: shellcheck reported issue in this script: SC2129:style:17:3: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:17:38: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:18:44: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:19:95: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:28:42: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:30:65: Double quote to prevent globbing and word splitting

(shellcheck)


67-67: shellcheck reported issue in this script: SC2086:info:32:66: Double quote to prevent globbing and word splitting

(shellcheck)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ab6c923 and 801edb6.

📒 Files selected for processing (2)
  • .github/workflows/build-docker.yaml (1 hunks)
  • .github/workflows/build.yaml (1 hunks)
🔇 Additional comments (2)
.github/workflows/build.yaml (1)

42-42: LGTM: Improved YAML formatting

The change improves readability by explicitly using YAML list format for the job dependency.

.github/workflows/build-docker.yaml (1)

69-71: LGTM: Enhanced production build control

The condition correctly implements the PR objective by enabling production builds via either the input parameter or the 'docker-production-build' label.

@tolbrino tolbrino added this pull request to the merge queue Dec 5, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 5, 2024
@tolbrino tolbrino added this pull request to the merge queue Dec 5, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 5, 2024
@NumberFour8 NumberFour8 merged commit b198a06 into master Dec 5, 2024
46 of 47 checks passed
@NumberFour8 NumberFour8 deleted the tb/20241205-docker-prod branch December 5, 2024 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker-production-build toolchain Developer and product happiness
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants