Skip to content

build: replace Dapper with single-Dockerfile build system#26

Open
bk201 wants to merge 1 commit into
harvester:mainfrom
bk201:buildx
Open

build: replace Dapper with single-Dockerfile build system#26
bk201 wants to merge 1 commit into
harvester:mainfrom
bk201:buildx

Conversation

@bk201

@bk201 bk201 commented Jun 9, 2026

Copy link
Copy Markdown

Remove the Dapper-based build setup and replace it with a Docker BuildKit single-Dockerfile approach driven directly from the Makefile.

Changes:

  • Add Dockerfile with builder, base, build/build-output, validate, validate-ci and test stages; BuildKit cache mounts scoped per repo via MK_REPO_ID
  • Rewrite Makefile: drop Dapper download logic; add DOCKER_BUILD, MK_HOST_ARCH, MK_REPO_ID, MK_DOCKER_PROGRESS, MK_DOCKER_RUN_OPTS_TTY, BANNER and per-target rules (build, test, validate, validate-ci, package, gen-version-env, clean, clean-all)
  • Delete Dockerfile.dapper and orchestration scripts (ci, entry, package); package_lvmplugin, package_lvm_provisioner and package_lvm_webhook are now invoked as host-side targets directly from the Makefile
  • Update scripts/version: add git-unavailable fallback that reads/writes scripts/.version_env so container builds and git worktree checkouts work without access to .git; replace go env GOHOSTARCH with uname -m | sed ... so the script runs on hosts without Go installed
  • Update .dockerignore: exclude .git (stages needing git use git-init); keep /bin visible for package Dockerfiles
  • Add scripts/.version_env to .gitignore

Related Issue(s):

harvester/harvester#10622

Copilot AI review requested due to automatic review settings June 9, 2026 09:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR replaces the previous Dapper-based build workflow with a Docker BuildKit, single-Dockerfile build pipeline driven directly by the project Makefile, and updates version/package scripts to work when .git isn’t available in the Docker build context.

Changes:

  • Added a multi-stage Dockerfile implementing build, test, validate, and validate-ci stages with BuildKit cache mounts.
  • Rewrote the Makefile to run build/test/validate targets via docker build targets and to run packaging scripts host-side.
  • Updated scripts/version to support a .git-less build context via a generated scripts/.version_env, and adjusted ignore rules accordingly.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/version Adds .version_env fallback for builds without .git and updates host arch detection.
scripts/package Removes Dapper-era packaging wrapper script.
scripts/entry Removes Dapper entrypoint script.
scripts/ci Removes Dapper-era CI wrapper script.
Makefile Replaces Dapper invocation with direct Docker BuildKit build/test/validate targets and host-side package targets.
Dockerfile.dapper Removes the legacy Dapper build image definition.
Dockerfile Introduces multi-stage BuildKit Dockerfile for build, validate, validate-ci, and test.
.gitignore Ignores generated scripts/.version_env and normalizes .idea/.
.dockerignore Excludes .git from context and adjusts ignore set for the new Docker-based build flow.
Comments suppressed due to low confidence (1)

scripts/version:25

  • scripts/version computes TOP_DIR and uses git -C "${TOP_DIR}" ... for the initial availability check, but subsequent git commands run without -C. If the script is sourced/executed from a different working directory, those commands may operate on the wrong repo or fail despite TOP_DIR being known. Use -C "${TOP_DIR}" consistently.
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
    DIRTY="-dirty"
fi

COMMIT=$(git rev-parse --short HEAD)
GIT_TAG=${DRONE_TAG:-$(git tag -l --contains HEAD | head -n 1)}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile
Comment thread Makefile
Comment thread scripts/version
Comment on lines +9 to +18
if ! git -C "${TOP_DIR}" rev-parse HEAD &>/dev/null 2>&1; then
if [[ -f "${_VERSION_ENV}" ]]; then
# shellcheck source=/dev/null
source "${_VERSION_ENV}"
return 0 2>/dev/null || true
fi
echo "ERROR: git is unavailable and no pre-generated scripts/.version_env was found." >&2
echo "Run 'scripts/version' (or 'make gen-version-env') on a host with git access first." >&2
return 1 2>/dev/null || exit 1
fi
Comment thread .dockerignore Outdated
Remove the Dapper-based build setup and replace it with a Docker
BuildKit single-Dockerfile approach driven directly from the Makefile.

Changes:
- Add Dockerfile with builder, base, build/build-output, validate,
  validate-ci and test stages; BuildKit cache mounts scoped per repo
  via MK_REPO_ID
- Rewrite Makefile: drop Dapper download logic; add DOCKER_BUILD,
  MK_HOST_ARCH, MK_REPO_ID, MK_DOCKER_PROGRESS, MK_DOCKER_RUN_OPTS_TTY,
  BANNER and per-target rules (build, test, validate, validate-ci,
  package, gen-version-env, clean, clean-all)
- Delete Dockerfile.dapper and orchestration scripts (ci, entry, package);
  package_lvmplugin, package_lvm_provisioner and package_lvm_webhook are
  now invoked as host-side targets directly from the Makefile
- Update scripts/version: add git-unavailable fallback that reads/writes
  scripts/.version_env so container builds and git worktree checkouts
  work without access to .git; replace `go env GOHOSTARCH` with
  `uname -m | sed ...` so the script runs on hosts without Go installed
- Update .dockerignore: exclude .git (stages needing git use git-init);
  keep /bin visible for package Dockerfiles
- Add scripts/.version_env to .gitignore

Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants