project-infra icon indicating copy to clipboard operation
project-infra copied to clipboard

prototype: mount local directory for build

Open dhiller opened this issue 11 months ago • 1 comments

What this PR does / why we need it:

https://github.com/kubevirt/project-infra/issues/3868

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged): Fixes #3868

Special notes for your reviewer:

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR. Approvers are expected to review this list.

Release note:


dhiller avatar Jan 03 '25 12:01 dhiller

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kubevirt-bot avatar Apr 03 '25 12:04 kubevirt-bot

@sourcery-ai review

dhiller avatar Apr 08 '25 14:04 dhiller

Reviewer's Guide by Sourcery

This PR introduces changes to the image building process, specifically for the publish_image.sh script and the botreview container. It allows mounting a local project-infra directory during image builds and disables caching. The botreview container build process was also updated to support mounting a local project-infra directory and to use a newer base image.

Sequence diagram for building the image with a local project-infra directory

sequenceDiagram
  participant S as publish_image.sh
  participant P as podman

  S->>S: Parses arguments: -p <project_infra_dir>
  S->>P: build_image <no_cache> <build_target> <full_image_name> <project_infra_dir>
  alt project_infra_dir exists
    S->>P: podman build -v <project_infra_dir>:/project-infra . -t <image_name> -t <build_target>
  else project_infra_dir does not exist
    S->>P: podman build . -t <image_name> -t <build_target>
  end

File-Level Changes

Change Details Files
Added options to the publish_image.sh script to allow building images without cache and mounting a local project-infra directory.
  • Added -c option to disable caching during image build.
  • Added -p option to specify a local project-infra directory to mount.
  • Modified the build_image function to accept and use the no_cache and project_infra_dir parameters.
  • The build_image function now mounts the local project-infra directory into the container if the directory exists.
  • The build_image function now uses the --no-cache flag if the no_cache option is enabled.
images/publish_image.sh
Modified the botreview container build process to support mounting a local project-infra directory and updated the base image.
  • Updated the base image for the builder stage.
  • Added logic to clone the project-infra repository only if it doesn't exist, allowing for mounting a local directory.
  • Set environment variables for go proxy, flags, os, and architecture.
  • Set the go version using the GIMME_GO_VERSION environment variable.
  • Modified the build command to use /usr/local/bin/runner.sh.
images/botreview/Containerfile

Assessment against linked issues

Issue Objective Addressed Explanation
#3868 Use the local copy of project-infra instead of cloning it for each image build.
#3868 Build all images one after another. The PR focuses on using the local project-infra directory for builds, but it doesn't explicitly address building all images one after another. The changes in publish_image.sh modify how individual images are built, but not the overall orchestration of building multiple images in sequence.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar Apr 08 '25 14:04 sourcery-ai[bot]

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle rotten

kubevirt-bot avatar May 08 '25 15:05 kubevirt-bot

/remove-lifecycle rotten

dhiller avatar May 30 '25 07:05 dhiller

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kubevirt-bot avatar Aug 28 '25 07:08 kubevirt-bot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle rotten

kubevirt-bot avatar Sep 27 '25 08:09 kubevirt-bot

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

/close

kubevirt-bot avatar Oct 27 '25 08:10 kubevirt-bot

@kubevirt-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

kubevirt-bot avatar Oct 27 '25 08:10 kubevirt-bot

/reopen /remove-lifecycle rotten

dhiller avatar Oct 31 '25 10:10 dhiller

@dhiller: Reopened this PR.

In response to this:

/reopen /remove-lifecycle rotten

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

kubevirt-bot avatar Oct 31 '25 10:10 kubevirt-bot

/cc @brianmcarey

dhiller avatar Oct 31 '25 12:10 dhiller

/rehearse ?

dhiller avatar Oct 31 '25 12:10 dhiller

Rehearsal is available for the following jobs in this PR:


Further information on rehearsals

A rehearsal can be triggered for all jobs by commenting either /rehearse or /rehearse all on this PR.

A rehearsal for a specific job can be triggered by commenting /rehearse {job-name}.

Commenting /rehearse ? triggers a comment with a list of jobs that can be rehearsed.

A pull request can be rehearsed if either the user is authorized to rehearse or the pull request has the ok-to-rehearse label.

Authorized users are the group of users that are members of the KubeVirt GitHub organization AND either are approvers[1] for all files in the pull request or are top-level approvers[1] in the project-infra project.

[1]: see OWNERS file definition for reference.

kubevirt-bot avatar Oct 31 '25 12:10 kubevirt-bot

/rehearse ?

dhiller avatar Oct 31 '25 12:10 dhiller

Rehearsal is available for the following jobs in this PR:

build-phased-image
build-test-report-image
build-release-blocker-image
build-flake-report-creator-image
build-botreview-image
build-flakefinder-image
build-indexpagecreator-image
build-referee-image
build-rehearse-image
Further information on rehearsals

A rehearsal can be triggered for all jobs by commenting either /rehearse or /rehearse all on this PR.

A rehearsal for a specific job can be triggered by commenting /rehearse {job-name}.

Commenting /rehearse ? triggers a comment with a list of jobs that can be rehearsed.

A pull request can be rehearsed if either the user is authorized to rehearse or the pull request has the ok-to-rehearse label.

Authorized users are the group of users that are members of the KubeVirt GitHub organization AND either are approvers[1] for all files in the pull request or are top-level approvers[1] in the project-infra project.

[1]: see OWNERS file definition for reference.

kubevirt-bot avatar Oct 31 '25 12:10 kubevirt-bot

/rehearse

dhiller avatar Oct 31 '25 12:10 dhiller

Rehearsal jobs created for this PR:

rehearsal-build-referee-image
rehearsal-build-phased-image
rehearsal-build-indexpagecreator-image
rehearsal-build-rehearse-image
rehearsal-build-flakefinder-image
rehearsal-build-botreview-image
rehearsal-build-release-blocker-image
rehearsal-build-flake-report-creator-image
rehearsal-build-test-report-image
Further information on rehearsals

A rehearsal can be triggered for all jobs by commenting either /rehearse or /rehearse all on this PR.

A rehearsal for a specific job can be triggered by commenting /rehearse {job-name}.

Commenting /rehearse ? triggers a comment with a list of jobs that can be rehearsed.

A pull request can be rehearsed if either the user is authorized to rehearse or the pull request has the ok-to-rehearse label.

Authorized users are the group of users that are members of the KubeVirt GitHub organization AND either are approvers[1] for all files in the pull request or are top-level approvers[1] in the project-infra project.

[1]: see OWNERS file definition for reference.

kubevirt-bot avatar Oct 31 '25 12:10 kubevirt-bot

/rehearse ?

dhiller avatar Nov 04 '25 08:11 dhiller

Rehearsal is available for the following jobs in this PR:

build-flakefinder-image
build-rehearse-image
build-test-subset-image
build-indexpagecreator-image
build-release-tool-image
build-release-blocker-image
build-flake-report-creator-image
build-phased-image
build-botreview-image
build-test-report-image
build-referee-image
build-test-label-analyzer-image
Further information on rehearsals

A rehearsal can be triggered for all jobs by commenting either /rehearse or /rehearse all on this PR.

A rehearsal for a specific job can be triggered by commenting /rehearse {job-name}.

Commenting /rehearse ? triggers a comment with a list of jobs that can be rehearsed.

A pull request can be rehearsed if either the user is authorized to rehearse or the pull request has the ok-to-rehearse label.

Authorized users are the group of users that are members of the KubeVirt GitHub organization AND either are approvers[1] for all files in the pull request or are top-level approvers[1] in the project-infra project.

[1]: see OWNERS file definition for reference.

kubevirt-bot avatar Nov 04 '25 09:11 kubevirt-bot

/rehearse

brianmcarey avatar Nov 04 '25 12:11 brianmcarey

Rehearsal jobs created for this PR:

rehearsal-build-botreview-image
rehearsal-build-referee-image
rehearsal-build-release-tool-image
rehearsal-build-flake-report-creator-image
rehearsal-build-rehearse-image
rehearsal-build-test-subset-image
rehearsal-build-flakefinder-image
rehearsal-build-phased-image
rehearsal-build-test-label-analyzer-image
rehearsal-build-release-blocker-image
rehearsal-build-test-report-image
rehearsal-build-indexpagecreator-image
Further information on rehearsals

A rehearsal can be triggered for all jobs by commenting either /rehearse or /rehearse all on this PR.

A rehearsal for a specific job can be triggered by commenting /rehearse {job-name}.

Commenting /rehearse ? triggers a comment with a list of jobs that can be rehearsed.

A pull request can be rehearsed if either the user is authorized to rehearse or the pull request has the ok-to-rehearse label.

Authorized users are the group of users that are members of the KubeVirt GitHub organization AND either are approvers[1] for all files in the pull request or are top-level approvers[1] in the project-infra project.

[1]: see OWNERS file definition for reference.

kubevirt-bot avatar Nov 04 '25 12:11 kubevirt-bot

@brianmcarey updated the PR according to your comments, PTAL, thank you!

/rehearse

dhiller avatar Nov 06 '25 13:11 dhiller

Rehearsal jobs created for this PR:

rehearsal-build-botreview-image
rehearsal-build-test-report-image
rehearsal-build-flakefinder-image
rehearsal-build-referee-image
rehearsal-build-release-blocker-image
rehearsal-build-phased-image
rehearsal-build-test-label-analyzer-image
rehearsal-build-indexpagecreator-image
rehearsal-build-release-tool-image
rehearsal-build-flake-report-creator-image
rehearsal-build-rehearse-image
rehearsal-build-test-subset-image
Further information on rehearsals

A rehearsal can be triggered for all jobs by commenting either /rehearse or /rehearse all on this PR.

A rehearsal for a specific job can be triggered by commenting /rehearse {job-name}.

Commenting /rehearse ? triggers a comment with a list of jobs that can be rehearsed.

A pull request can be rehearsed if either the user is authorized to rehearse or the pull request has the ok-to-rehearse label.

Authorized users are the group of users that are members of the KubeVirt GitHub organization AND either are approvers[1] for all files in the pull request or are top-level approvers[1] in the project-infra project.

[1]: see OWNERS file definition for reference.

kubevirt-bot avatar Nov 06 '25 13:11 kubevirt-bot

/rehearse

dhiller avatar Nov 06 '25 13:11 dhiller

Rehearsal jobs created for this PR:

rehearsal-build-test-report-image
rehearsal-build-phased-image
rehearsal-build-botreview-image
rehearsal-build-indexpagecreator-image
rehearsal-build-test-label-analyzer-image
rehearsal-build-release-blocker-image
rehearsal-build-referee-image
rehearsal-build-flakefinder-image
rehearsal-build-rehearse-image
rehearsal-build-test-subset-image
rehearsal-build-release-tool-image
rehearsal-build-flake-report-creator-image
Further information on rehearsals

A rehearsal can be triggered for all jobs by commenting either /rehearse or /rehearse all on this PR.

A rehearsal for a specific job can be triggered by commenting /rehearse {job-name}.

Commenting /rehearse ? triggers a comment with a list of jobs that can be rehearsed.

A pull request can be rehearsed if either the user is authorized to rehearse or the pull request has the ok-to-rehearse label.

Authorized users are the group of users that are members of the KubeVirt GitHub organization AND either are approvers[1] for all files in the pull request or are top-level approvers[1] in the project-infra project.

[1]: see OWNERS file definition for reference.

kubevirt-bot avatar Nov 06 '25 13:11 kubevirt-bot

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brianmcarey

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

kubevirt-bot avatar Nov 07 '25 12:11 kubevirt-bot

@dhiller: Updated the following 2 configmaps:

  • job-config configmap in namespace kubevirt-prow at cluster default using the following files:
    • key project-infra-postsubmits.yaml using file github/ci/prow-deploy/files/jobs/kubevirt/project-infra/project-infra-postsubmits.yaml
    • key project-infra-presubmits.yaml using file github/ci/prow-deploy/files/jobs/kubevirt/project-infra/project-infra-presubmits.yaml
  • config configmap in namespace kubevirt-prow at cluster default using the following files:
    • key config.yaml using file github/ci/prow-deploy/kustom/base/configs/current/config/config.yaml

In response to this:

What this PR does / why we need it:

https://github.com/kubevirt/project-infra/issues/3868

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged): Fixes #3868

Special notes for your reviewer:

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR. Approvers are expected to review this list.

Release note:


Summary by Sourcery

Enhance the image build process to support mounting a local project-infra directory during builds

New Features:

  • Add option to disable build cache with -c flag
  • Allow specifying custom project-infra directory path with -p flag

Enhancements:

  • Add support for mounting a local project-infra directory during image builds
  • Introduce a new command-line option to specify a local project directory path

Chores:

  • Update Containerfile to use a more recent Golang base image
  • Modify build script to support optional local directory mounting

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

kubevirt-bot avatar Nov 07 '25 12:11 kubevirt-bot