Skip to content

sources: verify git refs with checksum#1059

Open
cpuguy83 wants to merge 2 commits into
project-dalec:mainfrom
cpuguy83:fetch_by_tag_with_checksum
Open

sources: verify git refs with checksum#1059
cpuguy83 wants to merge 2 commits into
project-dalec:mainfrom
cpuguy83:fetch_by_tag_with_checksum

Conversation

@cpuguy83
Copy link
Copy Markdown
Collaborator

@cpuguy83 cpuguy83 commented May 13, 2026

Summary

  • Add an optional git source checksum field that verifies a fetched ref resolves to the expected commit.
  • Preserve tag/ref checkout behavior so keepGitDir: true keeps useful git metadata for build tooling.

Copilot AI review requested due to automatic review settings May 13, 2026 20:00
@cpuguy83 cpuguy83 self-assigned this May 13, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 adds git source checksum support so tag/branch refs can be fetched while verifying they resolve to an expected commit, and updates docs/schema/tests around that behavior.

Changes:

  • Adds SourceGit.Checksum, validation, build-arg substitution, LLB GitChecksum wiring, and doc output.
  • Adds unit/integration coverage for checksum attributes and preserving tag metadata with keepGitDir.
  • Updates JSON schema and website docs with checksum/tag-pinning guidance.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
source_git.go Adds checksum field handling for git sources.
source_test.go Extends git source LLB assertions for checksum and keepGitDir.
load_test.go Adds checksum validation and substitution test cases.
test/source_test.go Adds integration test for checksum with tag metadata preservation.
docs/spec.schema.json Updates generated schema for git checksum and field descriptions.
website/docs/spec.md Updates sources example to show tag plus checksum usage.
website/docs/sources.md Documents git refs and checksum behavior.

Comment thread source_git.go Outdated
Comment thread load_test.go
Comment thread test/source_test.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@cpuguy83 cpuguy83 force-pushed the fetch_by_tag_with_checksum branch from 00f2ab3 to 8254914 Compare May 14, 2026 21:31
@cpuguy83 cpuguy83 force-pushed the fetch_by_tag_with_checksum branch from 8254914 to 9210be9 Compare May 14, 2026 21:50
@cpuguy83 cpuguy83 force-pushed the fetch_by_tag_with_checksum branch from 9210be9 to 81f0d10 Compare May 14, 2026 21:52
@cpuguy83 cpuguy83 force-pushed the fetch_by_tag_with_checksum branch from 81f0d10 to 0792097 Compare May 14, 2026 22:12
cpuguy83 added 2 commits May 14, 2026 15:44
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Add an optional git source checksum that is passed to BuildKit so tags and branches can be fetched by ref while ensuring they resolve to the expected commit.

This preserves .git tag metadata when keepGitDir is enabled, which lets tools derive version information from tags without giving up source pinning. If a tag or branch moves away from the expected commit, checksum verification fails the build.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83 cpuguy83 force-pushed the fetch_by_tag_with_checksum branch from 0792097 to a0562b1 Compare May 14, 2026 22:44
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.

2 participants