8000 build: pass GIT_SHA into the image build, keep .git out of the context by Slach · Pull Request #2176 · Altinity/clickhouse-operator · GitHub
[go: up one dir, main page]

Skip to content

build: pass GIT_SHA into the image build, keep .git out of the context - #2176

Open
Slach wants to merge 2 commits into
0.28.0from
build-git-sha-arg
Open

Slach wants to merge 2 commits into
0.28.0from
build-git-sha-arg

Conversation

@Slach
@Slach Slach commented Nov 27, 2026 •
Copy link
Copy Markdown
Collaborator

dev/go_build_config.sh ran git rev-parse --short HEAD inside the docker build (dockerfile/*/Dockerfile runs dev/go_build_*.sh). In a git worktree .git is a file with gitdir: /host/path/..., which does not exist in the container, so git failed and the build stopped with GIT_SHA is empty.

Changes:

  • dev/go_build_config.sh: GIT_SHA keeps a value already set, else asks git.
  • dev/image_build_universal.sh and the CI workflows (build_branch, build_master, run_tests, check_helm) pass --build-arg GIT_SHA=..., computed on the host.
  • Both Dockerfiles take ARG GIT_SHA into the builder stage.
  • .dockerignore excludes .git, so the build context is smaller and does not depend on it.

Tested: TAG=dev-gitsha dev/image_build_operator_dev.sh from a git worktree builds, and --fips-info of the image shows the worktree git_sha.

Slach and others added 2 commits November 27, 2026 17:06
go_build_config.sh ran git rev-parse inside the docker build. In a git
worktree .git is a file pointing to a host path, so git failed there and
the build stopped with "GIT_SHA is empty". The host now computes GIT_SHA
and passes it as a build arg (image_build_universal.sh and the CI
workflows), and .git is in .dockerignore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Slach added a commit that referenced this pull request Nov 27, 2026
- Build from a git worktree: GIT_SHA is a build arg, .git is out of the
  docker context. #2176
- FIPS e2e run the extracted binaries in a container of the operator image,
  so they pass on macOS; get_obj_names skips stray shell lines.
  #2175

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant

0