FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(gitcommit): add Git commit source resource by ihopenre-eng · Pull Request #9609 · updatecli/updatecli · GitHub

feat(gitcommit): add Git commit source resource - #9609

Merged
olblak merged 6 commits into
updatecli:mainfrom
ihopenre-eng:feat/git-commit-source
Jul 18, 2026
Merged

feat(gitcommit): add Git commit source resource#9609
olblak merged 6 commits into
updatecli:mainfrom
ihopenre-eng:feat/git-commit-source

Conversation

ihopenre-eng commented Jul 16, 2026
edited
Loading

Copy link
Copy Markdown
Member

Fix #2052

Add a gitcommit resource. The source returns the latest commit hash for a Git branch; the condition checks that a commit exists in a repository. Both support repository URLs, local paths, and SCM working directories. Branch lookup resolves local and origin refs without checking out the branch or modifying the working tree.

The condition hash defaults to the source output and can be overridden with spec.hash; abbreviated hashes are resolved with the Git revision syntax.

The resource is registered in the pipeline mapping and includes an end-to-end manifest covering URL, path, and SCM inputs plus two condition scenarios.

Test

go test ./pkg/plugins/resources/gitcommit -count=1
go test ./pkg/plugins/utils/gitgeneric -run '^TestGetCommitHash$|^TestIsCommitExist$' -count=1
go test ./pkg/core/pipeline/resource -count=1
go vet ./pkg/plugins/resources/gitcommit ./pkg/plugins/utils/gitgeneric ./pkg/core/pipeline/resource

Additional Information

Checklist

Tradeoff

The target stage returns an explicit unsupported error because a commit hash is immutable. The condition checks commit existence, defaulting to the source output with spec.hash as an override.

Potential improvement

A future changelog implementation could expose commits between two source revisions.

Signed-off-by: ihopenre-eng <247072151+ihopenre-eng@users.noreply.github.com>

olblak commented Jul 16, 2026

Copy link
Copy Markdown
Member

Thanks for the pullrequest, I'll try to find some time in the coming days to review it

olblak added enhancement New feature or request resource-gitcommit labels Jul 17, 2026

olblak commented Jul 17, 2026

Copy link
Copy Markdown
Member

I just gave a quick test and it works as expected thanks for the e2e tests.
I am happy to merge it as it is or wait for a condition if you are interested in it

mergify Bot commented Jul 17, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

The condition checks that a commit exists in the repository. The commit
hash defaults to the source output and can be overridden with spec.hash.
Repository selection follows the same order as the source: URL, path,
then SCM working directory. Abbreviated hashes are resolved with the
Git revision syntax.

Signed-off-by: ihopenre-eng <247072151+ihopenre-eng@users.noreply.github.com>

Copy link
Copy Markdown
Member Author

Thanks for testing it! I went ahead and added the condition in this PR (9b60f1d).

The condition checks that a commit exists in the repository: the commit hash defaults to the source output and can be overridden with spec.hash (abbreviated hashes are supported). Repository selection follows the same order as the source: spec.url, then spec.path, then the scmid working directory.

The e2e manifest now covers two condition scenarios — checking the source commit against the SCM working directory, and checking a pinned hash against a cloned URL — and the website documentation PR (updatecli/website#3563) is updated accordingly.

go test ./pkg/plugins/resources/gitcommit -count=1
go test ./pkg/plugins/utils/gitgeneric -run '^TestIsCommitExist$' -count=1
go run . diff --config e2e/updatecli.d/success.d/gitCommit.yaml

olblak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for the pull request

olblak enabled auto-merge (squash) July 18, 2026 11:25
olblak merged commit d75ef14 into updatecli:main Jul 18, 2026
8 checks passed
ihopenre-eng deleted the feat/git-commit-source branch July 18, 2026 12:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request resource-gitcommit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Git Commit Source

2 participants


Back | FazBrowse Home | New Git URL