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

[docker] Enable image builds from git worktrees #3660

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marun
Copy link
Contributor

@marun marun commented Jan 19, 2025

Why this should be merged

This change enables docker image builds from git worktrees. This required discoverying the git commit used to configure the avalanchego build script in advance of image build and providing it as an argument to image build.

Previously, it was impossible to build docker images from a git worktree:

  • the avalanchego build script needed to discover the git commit to configure the binary with for traceability
  • the build script assumed a .git directory to discover the git commit
  • the dockerfile copied the working tree into the image prior to running the avalanchego build script
  • if the working tree was for a git worktree, the resulting copy wouldn't have a .git directory to discovery the git commit from
    • instead of a regular .git directory, a non-primary worktree has a .git file referencing a path in the primary worktree's .git directory.

How this was tested

CI

Need to be documented in RELEASES.md?

N/A

@marun marun added the testing This primarily focuses on testing label Jan 19, 2025
@marun marun self-assigned this Jan 19, 2025
@marun marun force-pushed the worktree-image-builds branch 4 times, most recently from 37144d8 to 4573e47 Compare January 19, 2025 05:02
This change enables docker image builds from [git
worktrees](https://git-scm.com/docs/git-worktree). This required
discoverying the git commit used to configure the avalanchego build
script in advance of image build and providing it as an argument to
image build.

Previously, it was impossible to build docker images from a git
worktree:

 - the avalanchego build script needed to discover the git commit to
 configure the binary with for traceability

 - the build script assumed a .git directory to discover the git
 commit

 - the dockerfile copied the working tree into the image prior to
 running the avalanchego build script

 - if the working tree was for a git worktree, the resulting copy
 wouldn't have a .git directory to discovery the git commit from

  - instead of a regular .git directory, a non-primary worktree has a
  .git file referencing a path in the primary worktree's .git
  directory.
@marun marun force-pushed the worktree-image-builds branch from 4573e47 to f32daa7 Compare January 19, 2025 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing This primarily focuses on testing
Projects
Status: In Review 👀
Development

Successfully merging this pull request may close these issues.

1 participant