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

automatically generate workflows #2595

Merged
merged 3 commits into from
Sep 10, 2024
Merged

Conversation

smorihira
Copy link
Collaborator

@smorihira smorihira commented Sep 4, 2024

  • write a go flie that automatically generates workflows for building docker images

Description

  • write hack/actions/gen/main.go
  • add a workflow recipe to Makefile to run hack/actions/gen/main.go

Related Issue

Versions

  • Vald Version: v1.7.13
  • Go Version: v1.23.0
  • Rust Version: v1.80.0
  • Docker Version: v27.1.1
  • Kubernetes Version: v1.30.3
  • Helm Version: v3.15.3
  • NGT Version: v2.2.4
  • Faiss Version: v1.8.0

Checklist

Special notes for your reviewer

  • considering whether to unify the Name field and the AppName field in Data type
    • the role is the same, but the naming rule is a little different
  • does it matter that failing actions test in Run formatter / check-format-diff?
  • not confident if the naming workflow or actions are appropriate
    • implemented an auto generation file of workflows for ONLY building docker image
  • decided not to do the followings:
    • extract map data of components in a single source file
    • implement the logic of judging if each component is depends on internal/k8s/**
      • in this PR, that is judged by manually adding components name to conditions of case sentence

Summary by CodeRabbit

  • New Features

    • Introduced multiple new workflows for building Docker images for various components (e.g., agent, benchmark job, index creation).
    • Enhanced automation for generating GitHub Actions workflow files.
  • Improvements

    • Expanded trigger paths for pull requests and pushes across several workflows, improving responsiveness to relevant changes.
    • Reformatted branch and tag patterns for consistency and clarity in workflow configurations.
  • Chores

    • Added a new target in the Makefile for generating workflows, streamlining development tasks.

@CLAassistant
Copy link

CLAassistant commented Sep 4, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ hlts2
❌ smorihira
You have signed the CLA already but the status is still pending? Let us recheck it.

@vdaas-ci
Copy link
Collaborator

vdaas-ci commented Sep 4, 2024

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • 🔚 2️⃣ 🔚 /label actions/e2e-deploy - run E2E deploy & integration test

Copy link
Contributor

coderabbitai bot commented Sep 4, 2024

Walkthrough

Walkthrough

The changes involve substantial updates to multiple GitHub Actions workflow files for building Docker images across various project components. New workflow files have been created, event triggers have been restructured, and monitored paths for pull requests have been expanded. Additionally, a Go program has been introduced to automate the generation of these workflow files based on specific configurations, enhancing the overall CI/CD process.

Changes

Files Change Summary
.github/workflows/... New workflow files added for various components; updates to event triggers and expanded paths for pull requests.
hack/actions/gen/main.go Introduced a Go program for generating GitHub Actions workflow files based on component configurations.
Makefile Added a target for generating workflows, enhancing automation in the build process.
Makefile.d/functions.mk Introduced a function to generate Docker workflows, streamlining the build management process.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHub
    participant CI/CD Pipeline
    participant Docker Image

    Developer->>GitHub: Push code changes
    GitHub->>CI/CD Pipeline: Trigger workflow based on events
    CI/CD Pipeline->>Docker Image: Build Docker image
    Docker Image-->>CI/CD Pipeline: Image built successfully
    CI/CD Pipeline-->>GitHub: Update status
Loading

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

CodeRabbit Configuration 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.

deepsource-autofix bot added a commit that referenced this pull request Sep 4, 2024
This commit fixes the style issues introduced in f990b3b according to the output
from Gofumpt and Prettier.

Details: #2595
Copy link

cloudflare-workers-and-pages bot commented Sep 4, 2024

Deploying vald with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0d3451c
Status: ✅  Deploy successful!
Preview URL: https://fe3e1a5d.vald.pages.dev
Branch Preview URL: https://feature-hack-autobuilding-wo.vald.pages.dev

View logs

deepsource-autofix bot added a commit that referenced this pull request Sep 4, 2024
This commit fixes the style issues introduced in e709f16 according to the output
from Gofumpt and Prettier.

Details: #2595
@github-actions github-actions bot added size/XL and removed size/L labels Sep 4, 2024
deepsource-autofix bot added a commit that referenced this pull request Sep 4, 2024
This commit fixes the style issues introduced in 5bc73a5 according to the output
from Gofumpt and Prettier.

Details: #2595
hack/actions/gen/main.go Outdated Show resolved Hide resolved
hack/actions/gen/main.go Outdated Show resolved Hide resolved
hack/actions/gen/main.go Outdated Show resolved Hide resolved
@smorihira smorihira marked this pull request as ready for review September 6, 2024 07:04
@smorihira smorihira changed the title [WIP]feature/hack/autobuilding-workflows feature/hack/autobuilding-workflows Sep 6, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 9, 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 b17cc73 and 01022fe.

Files selected for processing (27)
  • .github/workflows/dockers-agent-faiss-image.yml (1 hunks)
  • .github/workflows/dockers-agent-image.yml (1 hunks)
  • .github/workflows/dockers-agent-ngt-image.yml (1 hunks)
  • .github/workflows/dockers-agent-sidecar-image.yml (1 hunks)
  • .github/workflows/dockers-benchmark-job-image.yml (1 hunks)
  • .github/workflows/dockers-benchmark-operator-image.yml (1 hunks)
  • .github/workflows/dockers-binfmt-image.yml (1 hunks)
  • .github/workflows/dockers-buildbase-image.yml (1 hunks)
  • .github/workflows/dockers-buildkit-image.yml (1 hunks)
  • .github/workflows/dockers-buildkit-syft-scanner-image.yml (1 hunks)
  • .github/workflows/dockers-ci-container-image.yml (1 hunks)
  • .github/workflows/dockers-dev-container-image.yml (1 hunks)
  • .github/workflows/dockers-discoverer-k8s-image.yml (1 hunks)
  • .github/workflows/dockers-gateway-filter-image.yml (1 hunks)
  • .github/workflows/dockers-gateway-lb-image.yml (1 hunks)
  • .github/workflows/dockers-gateway-mirror-image.yml (1 hunks)
  • .github/workflows/dockers-helm-operator-image.yml (1 hunks)
  • .github/workflows/dockers-index-correction-image.yml (1 hunks)
  • .github/workflows/dockers-index-creation-image.yml (1 hunks)
  • .github/workflows/dockers-index-operator-image.yml (1 hunks)
  • .github/workflows/dockers-index-save-image.yml (1 hunks)
  • .github/workflows/dockers-loadtest-image.yml (1 hunks)
  • .github/workflows/dockers-manager-index-image.yml (1 hunks)
  • .github/workflows/dockers-readreplica-rotate-image.yml (1 hunks)
  • Makefile (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • hack/actions/gen/main.go (1 hunks)
Files skipped from review due to trivial changes (9)
  • .github/workflows/dockers-benchmark-operator-image.yml
  • .github/workflows/dockers-binfmt-image.yml
  • .github/workflows/dockers-buildkit-image.yml
  • .github/workflows/dockers-buildkit-syft-scanner-image.yml
  • .github/workflows/dockers-gateway-mirror-image.yml
  • .github/workflows/dockers-index-correction-image.yml
  • .github/workflows/dockers-index-operator-image.yml
  • .github/workflows/dockers-index-save-image.yml
  • .github/workflows/dockers-readreplica-rotate-image.yml
Additional comments not posted (56)
.github/workflows/dockers-dev-container-image.yml (3)

21-28: Approved: Expanded event triggers.

The modifications to the on: section, including more specific tag patterns and branch exclusions, enhance the workflow's flexibility and responsiveness. Ensure that the new patterns are correctly triggering builds as expected.

Run the following script to verify the new patterns:


31-42: Approved: Expanded monitoring paths for pull requests.

The expansion of paths under pull_request: ensures that changes in critical areas of the repository will appropriately trigger the workflow. Verify that these paths are correctly triggering the workflow as intended.

Run the following script to verify the new paths:


46-58: Approved: Consistent expansion of monitoring paths for pull_request_target.

The expansion of paths under pull_request_target: mirrors those under pull_request:, maintaining consistency and ensuring that the workflow is triggered by relevant changes across different PR contexts. Verify that these paths are correctly triggering the workflow as intended.

Run the following script to verify the new paths:

.github/workflows/dockers-ci-container-image.yml (3)

31-43: Approved: Expanded monitoring paths for pull requests.

The expansion of paths under pull_request: ensures that changes in critical areas of the repository will appropriately trigger the workflow. Verify that these paths are correctly triggering the workflow as intended.

Run the following script to verify the new paths:

Verification successful

Verified: Paths correctly configured to trigger workflow

The paths under pull_request: in the .github/workflows/dockers-ci-container-image.yml file are correctly set to trigger the workflow. This ensures that changes in critical areas of the repository will appropriately activate the workflow. No further action is needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new paths are correctly triggering the workflow.

# Test: Search for the workflow runs triggered by changes in the new paths. Expect: Correct triggers.
gh pr checks 2595

Length of output: 16708


Script:

#!/bin/bash
# Search for the pull_request paths configuration in the workflow file to verify if the expanded paths are correctly set to trigger the workflow.

# Use ripgrep to search for the pull_request paths configuration in the specified workflow file.
rg 'pull_request:' -A 10 .github/workflows/dockers-ci-container-image.yml

Length of output: 400


46-58: Approved: Consistent expansion of monitoring paths for pull_request_target.

The expansion of paths under pull_request_target: mirrors those under pull_request:, maintaining consistency and ensuring that the workflow is triggered by relevant changes across different PR contexts. Verify that these paths are correctly triggering the workflow as intended.

Run the following script to verify the new paths:

Verification successful

Verified: Paths under pull_request_target are correctly configured.

The paths listed under pull_request_target: in the .github/workflows/dockers-ci-container-image.yml file are consistent with the intended changes and match the paths mentioned in the review comment. This configuration ensures that the workflow is triggered by relevant changes, maintaining consistency across different workflow files.

  • .github/workflows/dockers-ci-container-image.yml: Paths are correctly listed and consistent with other workflow files.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new paths are correctly triggering the workflow.

# Test: Search for the workflow runs triggered by changes in the new paths. Expect: Correct triggers.
gh pr checks 2595

Length of output: 16708


Script:

#!/bin/bash
# Search for the `on` section in the workflow files to see how the paths are configured.
ast-grep --lang yaml --pattern $'on:\n  pull_request_target:\n    paths:\n      - $$$' .github/workflows/

# Check for any logs or metadata that might indicate which paths triggered the workflow.
rg 'triggered by' .github/workflows/

Length of output: 678


Script:

#!/bin/bash
# Search for the `pull_request_target` section in the YAML files to verify the paths configuration.
rg 'pull_request_target:' -A 10 .github/workflows/

Length of output: 21797


21-28: Approved: Enhanced event triggers for consistency and responsiveness.

The reformatting and expansion of the on: section improve readability and responsiveness. Ensure that the new patterns are correctly triggering builds as expected.

Run the following script to verify the new patterns:

.github/workflows/dockers-buildbase-image.yml (3)

53-70: Approved: Consistent expansion of monitoring paths for pull_request_target.

The expansion of paths under pull_request_target: mirrors those under pull_request:, maintaining consistency and ensuring that the workflow is triggered by relevant changes across different PR contexts. Verify that these paths are correctly triggering the workflow as intended.

Run the following script to verify the new paths:

Verification successful

Verified: Consistent path configuration for pull_request_target.

The paths specified under pull_request_target in the workflow file are correctly configured and consistent with those under pull_request. This ensures that the workflow is triggered appropriately for changes in the specified files and directories across different PR contexts. No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new paths are correctly triggering the workflow.

# Test: Search for the workflow runs triggered by changes in the new paths. Expect: Correct triggers.
gh pr checks 2595

Length of output: 16708


Script:

#!/bin/bash
# Search for the configuration of pull_request_target in the workflow file to verify the paths triggering the workflow.

# Find the workflow file
fd 'dockers-buildbase-image.yml' .github/workflows --exec cat

# Search for pull_request_target configuration in the workflow file
rg 'pull_request_target:' .github/workflows/dockers-buildbase-image.yml -A 10

Length of output: 2650


20-30: Approved: Enhanced event triggers for consistency and responsiveness.

The reformatting and expansion of the on: section improve readability and responsiveness. Ensure that the new patterns are correctly triggering builds as expected.

Run the following script to verify the new patterns:


33-50: Approved: Expanded monitoring paths for pull requests.

The expansion of paths under pull_request: ensures that changes in critical areas of the repository will appropriately trigger the workflow. Verify that these paths are correctly triggering the workflow as intended.

Run the following script to verify the new paths:

.github/workflows/dockers-discoverer-k8s-image.yml (4)

16-28: Workflow Configuration: Approved

The workflow name and trigger events are correctly configured. The branch and tag patterns are well-defined and consistent with typical YAML practices.


31-49: Pull Request Paths: Approved

The specified paths for pull_request events are comprehensive, covering all relevant files and directories to ensure the workflow triggers appropriately.


52-70: Pull Request Target Paths: Approved

The specified paths for pull_request_target events mirror those for pull_request, maintaining consistency and ensuring that the workflow triggers correctly across different event types.


69-70: Jobs Configuration: Approved

The use of the shared workflow file _docker-image.yaml for the build job is efficient and promotes reusability of workflow configurations.

.github/workflows/dockers-manager-index-image.yml (4)

16-28: Workflow Configuration: Approved

The workflow name and trigger events are correctly configured. The branch and tag patterns are well-defined and consistent with typical YAML practices.


31-50: Pull Request Paths: Approved

The specified paths for pull_request events are comprehensive, covering all relevant files and directories to ensure the workflow triggers appropriately.


53-72: Pull Request Target Paths: Approved

The specified paths for pull_request_target events mirror those for pull_request, maintaining consistency and ensuring that the workflow triggers correctly across different event types.


71-72: Jobs Configuration: Approved

The use of the shared workflow file _docker-image.yaml for the build job is efficient and promotes reusability of workflow configurations.

.github/workflows/dockers-gateway-lb-image.yml (4)

16-28: Workflow Configuration: Approved

The workflow name and trigger events are correctly configured. The branch and tag patterns are well-defined and consistent with typical YAML practices.


31-51: Pull Request Paths: Approved

The specified paths for pull_request events are comprehensive, covering all relevant files and directories to ensure the workflow triggers appropriately.


54-74: Pull Request Target Paths: Approved

The specified paths for pull_request_target events mirror those for pull_request, maintaining consistency and ensuring that the workflow triggers correctly across different event types.


73-74: Jobs Configuration: Approved

The use of the shared workflow file _docker-image.yaml for the build job is efficient and promotes reusability of workflow configurations.

.github/workflows/dockers-loadtest-image.yml (3)

21-28: Branch and tag patterns reformatted for consistency.

The removal of quotes around branch names and tags is a good cleanup practice. Ensure that these new patterns correctly trigger the workflow as expected.

Run the following script to verify the trigger patterns:

Verification successful

Branch and tag patterns are correctly specified and formatted.

The branch and tag patterns in the workflow file are correctly specified without quotes, which is a good practice for consistency and readability. These patterns should correctly trigger the workflow as intended.

  • Branch patterns: main, release/v*.*, !release/v*.*.*
  • Tag patterns: *.*.*, v*.*.*, *.*.*-*, v*.*.*-*
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the trigger patterns for branches and tags.

# Test: Search for the trigger patterns in the workflow file. Expect: Patterns without quotes.
rg --type yaml -A 5 $'branches:'

Length of output: 31


Script:

#!/bin/bash
# Description: Search for the `on` section in the workflow file to verify branch and tag patterns.

# Test: Search for the `on` section and its contents in the workflow file.
rg --type yaml -A 10 '^on:' .github/workflows/dockers-loadtest-image.yml

Length of output: 222


71-71: Job configuration remains unchanged.

Confirm that the job configuration aligns with the updated triggers and paths, ensuring that it correctly references the _docker-image.yaml workflow for the build process.

Run the following script to confirm the job configuration:

Verification successful

Job configuration is correct and aligns with the expected setup.

The job configuration in .github/workflows/dockers-loadtest-image.yml correctly references the _docker-image.yaml workflow for the build process with appropriate parameters. No issues were found.

  • File: .github/workflows/dockers-loadtest-image.yml
  • Job: build
  • Workflow Reference: ./.github/workflows/_docker-image.yaml
  • Parameters: target: loadtest, platforms: linux/amd64
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Confirm the job configuration.

# Test: Search for the job configuration in the workflow file. Expect: Correct reference to `_docker-image.yaml`.
rg --type yaml -A 5 $'jobs:'

Length of output: 2555


Script:

#!/bin/bash
# Description: Confirm the job configuration in the specific workflow file.

# Test: Search for the job configuration in the .github/workflows/dockers-loadtest-image.yml file.
rg --type yaml -A 5 'jobs:' .github/workflows/dockers-loadtest-image.yml

Length of output: 198


31-50: Expanded paths under pull_request and pull_request_target.

The addition of new files and directories to the paths is a strategic enhancement to ensure that relevant changes trigger the workflow. Verify that all specified paths are correct and relevant to the Docker image build process.

Run the following script to verify the relevance of the specified paths:

Also applies to: 53-72

Verification successful

Paths are relevant to the Docker image build process.

The specified paths in the workflow file contain Docker-related keywords, confirming their relevance to the Docker image build process. This ensures that changes in these paths appropriately trigger the workflow.

  • Relevant paths include dockers/tools/cli/loadtest/Dockerfile, hack/docker/gen/main.go, and others containing Docker-related configurations.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the relevance of the specified paths.

# Test: Search for the specified paths in the repository. Expect: Paths relevant to the Docker image build process.
rg --type yaml -A 5 $'paths:'

Length of output: 774


Script:

#!/bin/bash
# Description: Verify the relevance of the specified paths to the Docker image build process.

# List of paths to verify
paths=(
  "hack/docker/gen/main.go"
  "dockers/tools/cli/loadtest/Dockerfile"
  "hack/actions/gen/main.go"
  ".github/workflows/dockers-loadtest-image.yml"
  ".github/actions/docker-build/action.yaml"
  ".github/workflows/_docker-image.yaml"
  "cmd/tools/cli/loadtest/**"
  "pkg/tools/cli/loadtest/**"
  "apis/grpc/**"
  "apis/proto/**"
  "go.mod"
  "go.sum"
  "versions/GO_VERSION"
  "internal/**"
  "!internal/**/*_test.go"
  "!internal/**/*_mock.go"
  "!internal/db/**"
  "!internal/k8s/**"
  "Makefile"
  "Makefile.d/**"
)

# Search for each path in the repository to check their relevance
for path in "${paths[@]}"; do
  echo "Searching for path: $path"
  rg --glob "$path" -l
done

Length of output: 11597


Script:

#!/bin/bash
# Description: Verify the relevance of the specified paths to the Docker image build process by searching for Docker-related keywords.

# List of paths to verify
paths=(
  "hack/docker/gen/main.go"
  "dockers/tools/cli/loadtest/Dockerfile"
  "hack/actions/gen/main.go"
  ".github/workflows/dockers-loadtest-image.yml"
  ".github/actions/docker-build/action.yaml"
  ".github/workflows/_docker-image.yaml"
  "cmd/tools/cli/loadtest/**"
  "pkg/tools/cli/loadtest/**"
  "apis/grpc/**"
  "apis/proto/**"
  "go.mod"
  "go.sum"
  "versions/GO_VERSION"
  "internal/**"
  "!internal/**/*_test.go"
  "!internal/**/*_mock.go"
  "!internal/db/**"
  "!internal/k8s/**"
  "Makefile"
  "Makefile.d/**"
)

# Keywords to search for
keywords=("docker" "Dockerfile" "build" "image" "FROM" "RUN" "CMD" "ENTRYPOINT")

# Search for Docker-related keywords in the specified paths
for path in "${paths[@]}"; do
  echo "Searching for Docker-related keywords in path: $path"
  for keyword in "${keywords[@]}"; do
    rg "$keyword" --glob "$path" -l || true
  done
done

Length of output: 96551

.github/workflows/dockers-agent-sidecar-image.yml (4)

17-28: Confirm branch and tag patterns.

The reformatting of branch and tag patterns enhances readability and aligns with common YAML practices. Please ensure that these patterns are tested to confirm they trigger the workflow as expected.


31-51: Expanded paths for pull requests.

The expansion of paths and refinement of exclusion patterns are well-thought-out to capture more relevant changes. Please verify that these paths correctly trigger the workflow as intended and do not lead to unnecessary builds.


54-74: Review paths for pull_request_target.

The paths for pull_request_target have been appropriately expanded to align with the pull_request section. Ensure consistency between these sections to maintain coherent workflow triggers.


76-76: Good use of shared workflow file.

Utilizing a shared workflow file for building the Docker image promotes reusability and maintainability. This is a good practice.

.github/workflows/dockers-gateway-filter-image.yml (4)

17-28: Confirm branch and tag patterns.

The reformatting of branch and tag patterns enhances readability and aligns with common YAML practices. Please ensure that these patterns are tested to confirm they trigger the workflow as expected.


31-51: Expanded paths for pull requests.

The expansion of paths and refinement of exclusion patterns are well-thought-out to capture more relevant changes. Please verify that these paths correctly trigger the workflow as intended and do not lead to unnecessary builds.


54-74: Review paths for pull_request_target.

The paths for pull_request_target have been appropriately expanded to align with the pull_request section. Ensure consistency between these sections to maintain coherent workflow triggers.


76-76: Good use of shared workflow file.

Utilizing a shared workflow file for building the Docker image promotes reusability and maintainability. This is a good practice.

.github/workflows/dockers-agent-faiss-image.yml (4)

17-28: Confirm branch and tag patterns.

The reformatting of branch and tag patterns enhances readability and aligns with common YAML practices. Please ensure that these patterns are tested to confirm they trigger the workflow as expected.


31-52: Expanded paths for pull requests.

The expansion of paths and refinement of exclusion patterns are well-thought-out to capture more relevant changes. Please verify that these paths correctly trigger the workflow as intended and do not lead to unnecessary builds.


55-76: Review paths for pull_request_target.

The paths for pull_request_target have been appropriately expanded to align with the pull_request section. Ensure consistency between these sections to maintain coherent workflow triggers.


78-78: Good use of shared workflow file.

Utilizing a shared workflow file for building the Docker image promotes reusability and maintainability. This is a good practice.

.github/workflows/dockers-index-creation-image.yml (3)

16-16: Auto-generated file notice.

The comment clearly indicates that this file is auto-generated. Ensure that any modifications are made through the generator script to maintain consistency.


18-48: Review of trigger conditions and paths.

The workflow is triggered by pushes to main, release/v*.*, and specific tags, which is standard for CI/CD pipelines. The exclusion of certain paths like internal/db/** and internal/k8s/** in pull requests is appropriate to avoid unnecessary builds when changes are unrelated to the Docker image build process.


73-78: Usage of shared workflow template.

The workflow uses a shared YAML template (_docker-image.yaml) for building Docker images, which promotes reusability and consistency across different image builds. The secrets: inherit ensures that secrets are passed down, which is crucial for operations that may require access to private resources.

.github/workflows/dockers-benchmark-job-image.yml (3)

16-16: Auto-generated file notice.

The workflow file includes a clear notice that it is auto-generated. This is crucial for maintaining the integrity of the file and ensuring that changes are made through the appropriate automated processes.


17-74: Comprehensive review of workflow triggers and paths.

The workflow is configured to trigger on pushes to main and release/v*.* branches, excluding more specific release tags, which is a good practice to prevent unnecessary builds. The detailed inclusion and exclusion of paths in the pull_request and pull_request_target sections ensure that the workflow is triggered only by relevant changes, enhancing the efficiency of the CI process.


Line range hint 75-78: Use of shared workflow template for Docker builds.

Utilizing a shared YAML template (_docker-image.yaml) for Docker builds across different workflows is a good practice. It ensures consistency and reduces the likelihood of errors in defining build steps for each Docker image.

.github/workflows/dockers-agent-image.yml (3)

16-16: Auto-generated file notice.

This workflow file also includes a notice that it is auto-generated. This is important to ensure that manual edits are not made directly to the file, which could be overwritten by the generator script.


17-78: Detailed review of workflow triggers and paths.

The workflow is set to trigger on changes to branches and tags that are relevant to the project's release cycle. The extensive list of paths in the pull_request and pull_request_target sections is well-thought-out, covering a wide range of files and directories to ensure that any pertinent changes trigger the workflow. This setup is crucial for maintaining a robust and responsive CI/CD pipeline.


75-78: Consistent use of shared Docker build template.

The consistent use of a shared YAML template for Docker builds across workflows is observed here as well. This practice helps maintain consistency and reduces errors, ensuring that Docker images are built correctly across different workflows.

hack/actions/gen/main.go (1)

17-730: Overall Structure Review: Well-organized and modular.

The file hack/actions/gen/main.go is well-organized, with a clear separation of concerns and modular code. The use of types and constants enhances the readability and maintainability of the code.

Makefile (1)

445-448: New Target workflow: Correctly set up and functional.

The new workflow target in the Makefile is correctly set up to use the gen-workflow function. It passes appropriate parameters, aligning with the PR's objectives to automate workflow generation.

.github/workflows/dockers-helm-operator-image.yml (5)

21-28: ```shell
#!/bin/bash

Search for the 'on' section in the workflow file to understand how branch and tag patterns are used.

rg -A 10 '^on:' .github/workflows/dockers-helm-operator-image.yml


---

`16-17`: ```shell
#!/bin/bash
# Description: Search for the logic or templates in the generator script responsible for generating the specific workflow file.

# Test: Look for function definitions or template parsing related to the workflow file in the generator script.
rg --type go 'func|template' hack/actions/gen/main.go

17-17: ```shell
#!/bin/bash

Description: Verify that all workflow names in the .github/workflows directory use single quotes for consistency.

Test: Search for workflow names not using single quotes in the .github/workflows directory.

rg --glob '.github/workflows/*.yml' -A 1 $'name: "'


---

`71-71`: ```shell
#!/bin/bash
# Description: Verify that the Docker build configurations or scripts have been updated to reflect the new job target.

# Test: Search for outdated references to the old job target in all files, focusing on Dockerfiles and script files.
rg 'operator/helm' --type all -A 5

31-47: ```shell
#!/bin/bash

Description: Analyze the workflow run history to determine the frequency of triggers.

Fetch the workflow run history for the specific workflow file.

echo "Fetching workflow run history for dockers-helm-operator-image.yml..."
gh run list --workflow=dockers-helm-operator-image.yml --limit 100


</blockquote></details>
<details>
<summary>.github/workflows/dockers-agent-ngt-image.yml (4)</summary><blockquote>

`16-17`: **Clarify auto-generation source.**

The comment at line 16 indicates that this file is auto-generated. It's crucial to ensure that any manual changes are also reflected in the generator script to avoid future discrepancies.

```shell
#!/bin/bash
# Description: Verify that the generator script reflects the current workflow configuration.

# Test: Check if the generator script contains the necessary configurations.
rg --type go -A 5 $'gen/main.go'

17-17: Workflow name consistency check.

The workflow name has been changed to use single quotes for consistency. Ensure that this naming convention is consistently applied across all workflow files.

#!/bin/bash
# Description: Verify that all workflow names use single quotes for consistency.

# Test: Search for workflow names not using single quotes.
rg --type yaml -A 5 $'name: "'

21-28: Branch and tag trigger patterns.

The branch and tag patterns have been reformatted to remove quotes, which is a good practice for consistency. Ensure that these patterns are correctly triggering the workflows as expected.

#!/bin/bash
# Description: Verify that the branch and tag patterns trigger the workflows correctly.

# Test: Simulate push events to check if the workflow is triggered.
echo "Simulate push events with branches and tags to check workflow triggers."

31-51: Expanded monitoring paths with exclusions.

The paths monitored for pull requests and pull_request_target events have been expanded and reorganized, including new paths and exclusions. This is a positive change as it ensures that any relevant modifications in these paths will trigger the workflow. However, ensure that the exclusions are correctly preventing unnecessary workflow runs.

#!/bin/bash
# Description: Verify the impact of expanded paths and exclusions on workflow triggers.

# Test: Check the frequency of workflow triggers based on past commits and the effect of exclusions.
echo "Check the commit history to estimate the frequency of workflow triggers and the effect of exclusions."

Also applies to: 54-74

Comment on lines +329 to +344
define gen-workflow
BIN_PATH="$(TEMP_DIR)/vald-actions-gen"; \
rm -rf $$BIN_PATH; \
MAINTAINER=$2 \
GOPRIVATE=$(GOPRIVATE) \
GOARCH=$(GOARCH) \
GOOS=$(GOOS) \
go build -modcacherw \
-mod=readonly \
-a \
-tags "osusergo netgo static_build" \
-trimpath \
-o $$BIN_PATH $(ROOTDIR)/hack/actions/gen/main.go; \
$$BIN_PATH $1; \
rm -rf $$BIN_PATH
endef
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: Add error handling in gen-workflow.

The gen-workflow function is well-structured and aligns with the PR's objectives. However, it would be beneficial to add error handling for the go build and execution steps to ensure any issues are caught and handled appropriately.

hack/actions/gen/main.go 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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 01022fe and 51a2db4.

Files selected for processing (1)
  • hack/actions/gen/main.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • hack/actions/gen/main.go

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 51a2db4 and 3c40fe5.

Files selected for processing (1)
  • hack/actions/gen/main.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • hack/actions/gen/main.go

coderabbitai[bot]
coderabbitai bot previously requested changes Sep 9, 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: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3c40fe5 and 5203d39.

Files selected for processing (25)
  • .github/workflows/dockers-agent-faiss-image.yaml (1 hunks)
  • .github/workflows/dockers-agent-image.yaml (1 hunks)
  • .github/workflows/dockers-agent-ngt-image.yaml (1 hunks)
  • .github/workflows/dockers-agent-sidecar-image.yaml (1 hunks)
  • .github/workflows/dockers-benchmark-job-image.yaml (1 hunks)
  • .github/workflows/dockers-benchmark-operator-image.yaml (1 hunks)
  • .github/workflows/dockers-binfmt-image.yaml (1 hunks)
  • .github/workflows/dockers-buildbase-image.yaml (1 hunks)
  • .github/workflows/dockers-buildkit-image.yaml (1 hunks)
  • .github/workflows/dockers-buildkit-syft-scanner-image.yaml (1 hunks)
  • .github/workflows/dockers-ci-container-image.yaml (1 hunks)
  • .github/workflows/dockers-dev-container-image.yaml (1 hunks)
  • .github/workflows/dockers-discoverer-k8s-image.yaml (1 hunks)
  • .github/workflows/dockers-gateway-filter-image.yaml (1 hunks)
  • .github/workflows/dockers-gateway-lb-image.yaml (1 hunks)
  • .github/workflows/dockers-gateway-mirror-image.yaml (1 hunks)
  • .github/workflows/dockers-helm-operator-image.yaml (1 hunks)
  • .github/workflows/dockers-index-correction-image.yaml (1 hunks)
  • .github/workflows/dockers-index-creation-image.yaml (1 hunks)
  • .github/workflows/dockers-index-operator-image.yaml (1 hunks)
  • .github/workflows/dockers-index-save-image.yaml (1 hunks)
  • .github/workflows/dockers-loadtest-image.yaml (1 hunks)
  • .github/workflows/dockers-manager-index-image.yaml (1 hunks)
  • .github/workflows/dockers-readreplica-rotate-image.yaml (1 hunks)
  • hack/actions/gen/main.go (1 hunks)
Files skipped from review due to trivial changes (16)
  • .github/workflows/dockers-agent-faiss-image.yaml
  • .github/workflows/dockers-agent-image.yaml
  • .github/workflows/dockers-agent-ngt-image.yaml
  • .github/workflows/dockers-benchmark-job-image.yaml
  • .github/workflows/dockers-ci-container-image.yaml
  • .github/workflows/dockers-dev-container-image.yaml
  • .github/workflows/dockers-discoverer-k8s-image.yaml
  • .github/workflows/dockers-gateway-filter-image.yaml
  • .github/workflows/dockers-gateway-lb-image.yaml
  • .github/workflows/dockers-helm-operator-image.yaml
  • .github/workflows/dockers-index-correction-image.yaml
  • .github/workflows/dockers-index-operator-image.yaml
  • .github/workflows/dockers-index-save-image.yaml
  • .github/workflows/dockers-loadtest-image.yaml
  • .github/workflows/dockers-manager-index-image.yaml
  • .github/workflows/dockers-readreplica-rotate-image.yaml
Files skipped from review as they are similar to previous changes (1)
  • hack/actions/gen/main.go
Additional comments not posted (22)
.github/workflows/dockers-binfmt-image.yaml (3)

17-17: Approved stylistic change in workflow name.

The change from double quotes to single quotes is a minor stylistic adjustment that aligns with common YAML practices.


20-30: Approved changes in trigger configurations.

The removal of quotes around the cron expression and the reformatting of branch and tag patterns enhance clarity and consistency. Ensure the cron expression is tested to confirm it triggers as expected.

Run the following script to verify the cron expression:


33-70: Approved expanded paths with exclusions for test and mock files.

The changes to the paths monitored for pull_request and pull_request_target events are well-thought-out, aiming to improve the responsiveness and relevance of the workflow. Verify that the specified paths and exclusions are correctly triggering the workflow as intended.

Run the following script to verify the path triggers:

Verification successful

Paths and exclusions for workflow triggers are correctly configured.

The .github/workflows/dockers-binfmt-image.yaml file correctly specifies the paths and exclusions for both pull_request and pull_request_target events. This ensures that the workflow triggers appropriately based on changes to the specified files and directories.

  • The pull_request event includes specific paths.
  • The pull_request_target event includes paths with exclusions for test and mock files.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the specified paths and exclusions are correctly triggering the workflow.

# Test: Simulate changes in the specified paths and confirm the workflow triggers.
echo "Simulate changes in the specified paths and confirm the workflow triggers."

Length of output: 158


Script:

#!/bin/bash
# Search for the 'on' section in the workflow configuration files to verify paths and exclusions.
rg -A 10 'on:' .github/workflows/*.yaml

Length of output: 48637


Script:

#!/bin/bash
# Extract the 'on' section from the .github/workflows/dockers-binfmt-image.yaml file to verify paths and exclusions.
rg -A 20 '^on:' .github/workflows/dockers-binfmt-image.yaml

Length of output: 501


Script:

#!/bin/bash
# Search for the 'pull_request_target' event in the .github/workflows/dockers-binfmt-image.yaml file to verify its configuration.
rg -A 20 'pull_request_target:' .github/workflows/dockers-binfmt-image.yaml

Length of output: 608

.github/workflows/dockers-buildkit-image.yaml (3)

17-17: Approved stylistic change in workflow name.

The change from double quotes to single quotes is a minor stylistic adjustment that aligns with common YAML practices.


20-30: Approved changes in trigger configurations.

The removal of quotes around the cron expression and the reformatting of branch and tag patterns enhance clarity and consistency. Ensure the cron expression is tested to confirm it triggers as expected.

Run the following script to verify the cron expression:

Verification successful

Approved changes in trigger configurations.

The removal of quotes around the cron expression and the reformatting of branch and tag patterns enhance clarity and consistency. Ensure the cron expression is manually tested to confirm it triggers as expected.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the cron expression triggers as expected.

# Test: Manually trigger the workflow to confirm the cron setup.
echo "Manually trigger the workflow to confirm the cron setup."

Length of output: 122


33-70: Approved expanded paths with exclusions for test and mock files.

The changes to the paths monitored for pull_request and pull_request_target events are well-thought-out, aiming to improve the responsiveness and relevance of the workflow. Verify that the specified paths and exclusions are correctly triggering the workflow as intended.

Run the following script to verify the path triggers:

Verification successful

Paths and exclusions are correctly configured to trigger the workflow.

The paths specified for the pull_request and pull_request_target events in the workflow file are correctly set up, with appropriate exclusions for test and mock files. This configuration ensures that the workflow is triggered as intended when changes occur in the specified paths.

  • The paths sections include all necessary files and directories.
  • Exclusions are effectively managed within the paths list.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the specified paths and exclusions are correctly triggering the workflow.

# Test: Simulate changes in the specified paths and confirm the workflow triggers.
echo "Simulate changes in the specified paths and confirm the workflow triggers."

Length of output: 158


Script:

#!/bin/bash
# Search for the paths and paths-ignore sections in the workflow file to verify the configuration.
rg 'paths:|paths-ignore:' -A 10 .github/workflows/dockers-buildkit-image.yaml

Length of output: 744

.github/workflows/dockers-gateway-mirror-image.yaml (3)

17-17: Approved stylistic change in workflow name.

The change from double quotes to single quotes is a minor stylistic adjustment that aligns with common YAML practices.


31-72: Approved expanded paths with exclusions for test and mock files.

The changes to the paths monitored for pull_request and pull_request_target events are well-thought-out, aiming to improve the responsiveness and relevance of the workflow. Verify that the specified paths and exclusions are correctly triggering the workflow as intended.

Run the following script to verify the path triggers:

Verification successful

Paths and exclusions are correctly configured in the workflow YAML file.

The paths and exclusions specified for the pull_request and pull_request_target events in the .github/workflows/dockers-gateway-mirror-image.yaml file are correctly set up. This ensures that the workflow triggers appropriately based on changes to the specified files and directories.

  • The paths include relevant directories and files, ensuring comprehensive monitoring.
  • Exclusions for test and mock files are correctly applied.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the specified paths and exclusions are correctly triggering the workflow.

# Test: Simulate changes in the specified paths and confirm the workflow triggers.
echo "Simulate changes in the specified paths and confirm the workflow triggers."

Length of output: 158


Script:

#!/bin/bash
# Search the workflow YAML file for the specified paths and exclusions to ensure they are correctly configured.

# Use rg to search for the paths and exclusions in the workflow YAML file.
rg 'paths:' -A 20 .github/workflows/dockers-gateway-mirror-image.yaml

Length of output: 1224


21-28: Approved changes in trigger configurations.

The removal of quotes around the cron expression and the reformatting of branch and tag patterns enhance clarity and consistency. Ensure the cron expression is tested to confirm it triggers as expected.

Run the following script to verify the cron expression:

.github/workflows/dockers-buildbase-image.yaml (3)

17-17: Workflow name is clear and descriptive.

The workflow is appropriately named Build docker image: buildbase, which clearly describes its purpose.


71-77: Check job configuration for correctness.

The job configuration uses a shared workflow file, which promotes reusability. Ensure that the target and platforms parameters are correctly set for the buildbase Docker image build.

Verification successful

Job configuration is correct.

The target and platforms parameters are correctly set and used in the shared workflow file _docker-image.yaml. The values target: buildbase and platforms: linux/amd64,linux/arm64 are consistent with the expected usage in the workflow.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the parameters in the shared workflow file.

# Test: Check the shared workflow file for correct parameters.
cat ./.github/workflows/_docker-image.yaml

Length of output: 4525


18-50: Review trigger configurations for completeness and accuracy.

The triggers for schedule, push, pull_request, and pull_request_target are well-defined. However, ensure that the paths specified cover all relevant files and directories that could affect the Docker build process. The exclusion of certain files like *_test.go and *_mock.go is good practice to avoid unnecessary workflow runs.

Also applies to: 52-70

.github/workflows/dockers-buildkit-syft-scanner-image.yaml (3)

17-17: Workflow name is clear and descriptive.

The workflow is appropriately named Build docker image: buildkit-syft-scanner, which clearly describes its purpose.


Line range hint 71-77: Check job configuration for correctness.

The job configuration uses a shared workflow file, which promotes reusability. Ensure that the target and platforms parameters are correctly set for the buildkit-syft-scanner Docker image build.

Verification successful

Job configuration is correct. The target and platforms parameters are correctly set and used in the shared workflow file for building the buildkit-syft-scanner Docker image. The configuration promotes reusability and is consistent with the intended setup.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the parameters in the shared workflow file.

# Test: Check the shared workflow file for correct parameters.
cat ./.github/workflows/_docker-image.yaml

Length of output: 4525


20-50: Review trigger configurations for completeness and accuracy.

The changes to the trigger configurations are aimed at improving clarity and responsiveness. Ensure that the expanded paths cover all relevant files and directories. The exclusion of certain files is a good practice to avoid unnecessary workflow runs.

Also applies to: 53-70

Verification successful

Ensure all relevant files are included in workflow triggers.

Upon reviewing the paths specified in the workflow file against the list of files in the repository, it appears that the specified paths cover the necessary files and directories for triggering the workflow. The exclusions are appropriate and help avoid unnecessary workflow runs. No additional paths need to be included.

  • The paths specified in the workflow file are comprehensive and align with the files present in the repository.
  • The exclusions are correctly set to avoid triggering the workflow for test and mock files, as well as specific internal directories.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all necessary paths are included in the workflow triggers.

# Test: List all directories and files that should trigger the workflow.
fd --type f --exec echo {}

Length of output: 76227

.github/workflows/dockers-index-creation-image.yaml (3)

17-17: Workflow name is clear and descriptive.

The workflow is appropriately named Build docker image: index-creation, which clearly describes its purpose.


71-77: Check job configuration for correctness.

The job configuration uses a shared workflow file, which promotes reusability. Ensure that the target and platforms parameters are correctly set for the index-creation Docker image build.


18-48: Review trigger configurations for completeness and accuracy.

The triggers for push and pull_request are well-defined. However, ensure that the paths specified cover all relevant files and directories that could affect the Docker build process. The exclusion of certain files like *_test.go and *_mock.go is good practice to avoid unnecessary workflow runs.

Also applies to: 52-70

.github/workflows/dockers-benchmark-operator-image.yaml (2)

16-17: Auto-generated file notice and workflow name change approved.

The comment clearly indicates that this file is auto-generated, which is good practice to avoid manual edits. The change in the workflow name's quotes is stylistic and acceptable.


21-74: Expanded trigger conditions and paths approved, verify path completeness.

The updated trigger conditions and paths are comprehensive, enhancing the responsiveness of the workflow to changes across the project. Ensure that all necessary paths are included and that the exclusions do not omit important changes.

Run the following script to verify the completeness of the paths:

Verification successful

Paths in the workflow file are comprehensive and verified.

The paths specified in the GitHub Actions workflow file effectively cover the necessary files and directories that could impact the Docker build process. The exclusions are specific and intentional, ensuring efficient workflow runs. The verification confirms that the paths align with the files present in the repository.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the completeness of the paths in the workflow file.

# Test: List all directories and files under `cmd/` and `pkg/` to ensure they are covered by the workflow paths.
fd --type d --type f --exec echo {} \;

Length of output: 93644

.github/workflows/dockers-agent-sidecar-image.yaml (2)

16-17: Auto-generated file notice and workflow name change approved.

The comment clearly indicates that this file is auto-generated, which is good practice to avoid manual edits. The workflow name is appropriately descriptive.


19-74: Trigger conditions and paths approved, verify path completeness.

The trigger conditions and paths are well-defined, ensuring that the workflow responds appropriately to changes. Verify that all necessary paths are included and that the exclusions are appropriate.

Run the following script to verify the completeness of the paths:

Verification successful

Paths in the workflow file are verified and comprehensive.

The paths specified in the workflow file cover the necessary directories and files, particularly under cmd/agent/sidecar/ and pkg/agent/sidecar/. The exclusions are appropriate for excluding test and mock files. No further action is needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the completeness of the paths in the workflow file.

# Test: List all directories and files under `cmd/` and `pkg/` to ensure they are covered by the workflow paths.
fd --type d --type f --exec echo {} \;

Length of output: 93644

@smorihira smorihira changed the title feature/hack/autobuilding-workflows automatically generate workflows Sep 9, 2024
hack/actions/gen/main.go Outdated Show resolved Hide resolved
@smorihira smorihira force-pushed the feature/hack/autobuilding-workflows branch from f613df8 to a2b2772 Compare September 10, 2024 05:20
@smorihira smorihira force-pushed the feature/hack/autobuilding-workflows branch from a2b2772 to 8255e0e Compare September 10, 2024 05: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: 0

Outside diff range, codebase verification and nitpick comments (1)
Makefile.d/functions.mk (1)

329-344: LGTM! The gen-workflow function looks good.

The function is well-structured and aligns with the PR's objective of automating the generation of workflows for building Docker images. It effectively sets up a temporary binary path, cleans up existing binaries, and executes a Go build command with appropriate flags and environment variables. The parameterization of the binary argument and maintainer adds flexibility to the workflow generation process.

To further enhance the function's robustness, consider adding error handling for the go build and execution steps. This will ensure that any issues during the build or execution process are properly caught and handled.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a2b2772 and 8255e0e.

Files selected for processing (27)
  • .github/workflows/dockers-agent-faiss-image.yaml (1 hunks)
  • .github/workflows/dockers-agent-image.yaml (1 hunks)
  • .github/workflows/dockers-agent-ngt-image.yaml (1 hunks)
  • .github/workflows/dockers-agent-sidecar-image.yaml (1 hunks)
  • .github/workflows/dockers-benchmark-job-image.yaml (1 hunks)
  • .github/workflows/dockers-benchmark-operator-image.yaml (1 hunks)
  • .github/workflows/dockers-binfmt-image.yaml (1 hunks)
  • .github/workflows/dockers-buildbase-image.yaml (1 hunks)
  • .github/workflows/dockers-buildkit-image.yaml (1 hunks)
  • .github/workflows/dockers-buildkit-syft-scanner-image.yaml (1 hunks)
  • .github/workflows/dockers-ci-container-image.yaml (1 hunks)
  • .github/workflows/dockers-dev-container-image.yaml (1 hunks)
  • .github/workflows/dockers-discoverer-k8s-image.yaml (1 hunks)
  • .github/workflows/dockers-gateway-filter-image.yaml (1 hunks)
  • .github/workflows/dockers-gateway-lb-image.yaml (1 hunks)
  • .github/workflows/dockers-gateway-mirror-image.yaml (1 hunks)
  • .github/workflows/dockers-helm-operator-image.yaml (1 hunks)
  • .github/workflows/dockers-index-correction-image.yaml (1 hunks)
  • .github/workflows/dockers-index-creation-image.yaml (1 hunks)
  • .github/workflows/dockers-index-operator-image.yaml (1 hunks)
  • .github/workflows/dockers-index-save-image.yaml (1 hunks)
  • .github/workflows/dockers-loadtest-image.yaml (1 hunks)
  • .github/workflows/dockers-manager-index-image.yaml (1 hunks)
  • .github/workflows/dockers-readreplica-rotate-image.yaml (1 hunks)
  • Makefile (1 hunks)
  • Makefile.d/functions.mk (1 hunks)
  • hack/actions/gen/main.go (1 hunks)
Files skipped from review due to trivial changes (9)
  • .github/workflows/dockers-agent-ngt-image.yaml
  • .github/workflows/dockers-agent-sidecar-image.yaml
  • .github/workflows/dockers-buildbase-image.yaml
  • .github/workflows/dockers-ci-container-image.yaml
  • .github/workflows/dockers-discoverer-k8s-image.yaml
  • .github/workflows/dockers-helm-operator-image.yaml
  • .github/workflows/dockers-index-creation-image.yaml
  • .github/workflows/dockers-index-operator-image.yaml
  • .github/workflows/dockers-readreplica-rotate-image.yaml
Files skipped from review as they are similar to previous changes (14)
  • .github/workflows/dockers-agent-faiss-image.yaml
  • .github/workflows/dockers-agent-image.yaml
  • .github/workflows/dockers-benchmark-job-image.yaml
  • .github/workflows/dockers-binfmt-image.yaml
  • .github/workflows/dockers-buildkit-syft-scanner-image.yaml
  • .github/workflows/dockers-dev-container-image.yaml
  • .github/workflows/dockers-gateway-filter-image.yaml
  • .github/workflows/dockers-gateway-lb-image.yaml
  • .github/workflows/dockers-index-correction-image.yaml
  • .github/workflows/dockers-index-save-image.yaml
  • .github/workflows/dockers-loadtest-image.yaml
  • .github/workflows/dockers-manager-index-image.yaml
  • Makefile
  • hack/actions/gen/main.go
Additional comments not posted (10)
.github/workflows/dockers-buildkit-image.yaml (4)

17-17: LGTM!

The workflow name change is approved. The comment indicating that the file is auto-generated is a good addition to prevent manual edits.


20-20: LGTM!

The cron schedule format change is approved. Removing the quotes improves readability.


23-30: LGTM!

The push trigger changes are approved. The reformatting improves consistency and readability.


33-50: LGTM!

The pull_request and pull_request_target section changes are approved. The expanded paths and exclusions provide more refined control over the workflow triggers, enhancing clarity and functionality.

Also applies to: 53-70

.github/workflows/dockers-gateway-mirror-image.yaml (3)

21-23: LGTM!

The on.push.branches changes are approved. The additional branch patterns enhance the workflow's flexibility by responding to a broader range of branch events.


25-28: LGTM!

The on.push.tags changes are approved. The reformatting improves readability and consistency in the wildcard usage.


31-50: LGTM!

The on.pull_request and on.pull_request_target section changes are approved. The expanded paths facilitate more comprehensive testing and integration processes by responding to a broader range of changes. The consistency between the sections is crucial for maintaining the workflow's integrity across different event types.

Also applies to: 53-72

.github/workflows/dockers-benchmark-operator-image.yaml (3)

17-17: LGTM!

The workflow name change is approved. The comment indicating that the file is auto-generated is a good addition to prevent manual edits.


21-28: LGTM!

The on.push section changes are approved. The expanded trigger conditions enhance the workflow's responsiveness to a broader range of events, improving the automation and integration of the Docker image build process.


31-51: LGTM!

The on.pull_request and on.pull_request_target section changes are approved. The extensively revised paths and refined exclusions enhance the workflow's responsiveness to a broader range of events and files, improving the automation and integration of the Docker image build process within the development lifecycle.

Also applies to: 54-74

Copy link
Collaborator

@hlts2 hlts2 left a comment

Choose a reason for hiding this comment

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

LGTM!

@kpango
Copy link
Collaborator

kpango commented Sep 10, 2024

@all-contributors please add @smorihira for tool,code

Copy link
Contributor

@kpango

I've put up a pull request to add @smorihira! 🎉

@kpango kpango merged commit 7325841 into main Sep 10, 2024
136 of 153 checks passed
@kpango kpango deleted the feature/hack/autobuilding-workflows branch September 10, 2024 10:24
vdaas-ci pushed a commit that referenced this pull request Sep 10, 2024
* chore: add an actions/gen folder to hack

* feat: add a generator of docker image building workflows

---------

Co-authored-by: Hiroto Funakoshi <[email protected]>
kpango pushed a commit that referenced this pull request Sep 10, 2024
* chore: add an actions/gen folder to hack

* feat: add a generator of docker image building workflows

---------

Co-authored-by: Hiroto Funakoshi <[email protected]>
Signed-off-by: kpango <[email protected]>
vankichi added a commit that referenced this pull request Sep 11, 2024
* chore: add an actions/gen folder to hack

* feat: add a generator of docker image building workflows

---------

Co-authored-by: Shunya Morihira (森平 隼矢) <[email protected]>
Co-authored-by: Hiroto Funakoshi <[email protected]>
Co-authored-by: Kiichiro YUKAWA <[email protected]>
@kpango kpango mentioned this pull request Oct 11, 2024
@coderabbitai coderabbitai bot mentioned this pull request Oct 16, 2024
2 tasks
takuyaymd pushed a commit to takuyaymd/vald that referenced this pull request Dec 2, 2024
* chore: add an actions/gen folder to hack

* feat: add a generator of docker image building workflows

---------

Co-authored-by: Hiroto Funakoshi <[email protected]>
takuyaymd pushed a commit to takuyaymd/vald that referenced this pull request Dec 2, 2024
* chore: add an actions/gen folder to hack

* feat: add a generator of docker image building workflows

---------

Co-authored-by: Hiroto Funakoshi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants