-
Notifications
You must be signed in to change notification settings - Fork 333
feat: git tag step + tag support for git push #5785
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
Open
fuskovic
wants to merge
35
commits into
main
Choose a base branch
from
fuskovic/git-tag
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+675
−76
Open
Changes from 24 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
cb32742
update git pusher config schema
fuskovic a114d13
update config validation tests
fuskovic 56b8fec
support pushing tags
fuskovic 28a5928
Merge branch 'main' into fuskovic/git-tag
fuskovic 777eb14
change non-tag case to default
fuskovic 8850aff
update git push config schema comments
fuskovic 5978215
update intro and add note to git-push step doc
fuskovic e60cdc9
codegen
fuskovic cbbee61
add Pushing tags example to git-push doc and place holder todo doc fo…
fuskovic 3808ae3
implement test suite for git pusher for testing various control flows…
fuskovic 564f0fe
git push tag test passing
fuskovic 70652bf
git push tag test passing
fuskovic 9e415e1
DRY refactor and fix lint issues
fuskovic 2a520e8
add t.helper to test suite helpers
fuskovic 556e7f7
parallelize git pusher tests
fuskovic a69bb9c
protect against panic
fuskovic c401a07
add git tag config schema + make codegen
fuskovic ea0e2bb
implement git tag step
fuskovic 6a26e40
add tests for git tag step
fuskovic ca59651
add git-tag doc
fuskovic 8435eb3
lint
fuskovic ac84f41
fix schema config constraint + improve error message
fuskovic c7df4da
fix: revert #5767 (#5795)
krancour ee5a4a9
Merge branch 'main' into fuskovic/git-tag
krancour 6789a7b
Apply suggestions from code review
fuskovic 3fceaca
keep original git push test convention
fuskovic 4f515eb
verify tag was created using workTree.Checkout
fuskovic 52d7630
make codegen
fuskovic 2a97b89
update comment to reflect PullRebase=true has no effect when Tag is set
fuskovic 0ec7081
move rebase logic into default case
fuskovic 64efdab
include the commit the tag points to in the git-tag output
fuskovic 7acaef5
conditionally set the tag key in git push output
fuskovic cd543a9
remove tag key in output var declaration
fuskovic f9cac23
add assertions for commit data in git push tag test
fuskovic b002dc5
dynamically provision output data
fuskovic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
73 changes: 73 additions & 0 deletions
73
docs/docs/50-user-guide/60-reference-docs/30-promotion-steps/git-tag.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| --- | ||
| sidebar_label: git-tag | ||
| description: Creates a new tag for the latest committed changes. | ||
| --- | ||
|
|
||
| # `git-tag` | ||
|
|
||
| The `git-tag` step creates a new tag in a local Git repository. This step is commonly used to mark specific commits with a tag, which can be useful for versioning or tracking changes in a repository. | ||
|
|
||
| ## Configuration | ||
|
|
||
| | Name | Type | Required | Description | | ||
| |--------|----------|----------|-----------------------------------------------------------------------------| | ||
| | `path` | `string` | Y | Path to the local Git repository where the tag should be created. This path is relative to the temporary workspace that Kargo provisions for use by the promotion process. | | ||
fuskovic marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | `tag` | `string` | Y | The name of the tag to create. | | ||
|
|
||
| ## Output | ||
|
|
||
| | Name | Type | Description | | ||
| |-------|----------|-----------------------------------------------------------------------------| | ||
| | `tag` | `string` | The name of the tag that was created by this step. This can be referenced in subsequent steps. | | ||
|
|
||
| :::caution | ||
|
|
||
| If the specified tag already exists, the git-tag step will fail. | ||
fuskovic marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ::: | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Basic Usage | ||
|
|
||
| In this example, the `git-tag` step creates a tag named `v1.0.0` in the local Git repository located at `./out`. | ||
fuskovic marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```yaml | ||
| steps: | ||
| - uses: git-tag | ||
| config: | ||
| path: ./out | ||
| tag: v1.0.0 | ||
| ``` | ||
|
|
||
| ### Tagging After a Commit | ||
|
|
||
| This example demonstrates how to use the git-tag step after a git-commit step to tag the latest commit with a version number. | ||
|
|
||
| ```yaml | ||
| steps: | ||
| - uses: git-commit | ||
| config: | ||
| path: ./out | ||
| message: "Committing changes for release v1.0.0" | ||
| - uses: git-tag | ||
| config: | ||
| path: ./out | ||
| tag: v1.0.0 | ||
| ``` | ||
|
|
||
| ### Pushing After Tagging | ||
|
|
||
| In this example, the `git-tag` step creates a tag, and the `git-push` step pushes the tag to the remote repository. | ||
|
|
||
| ```yaml | ||
| steps: | ||
| - uses: git-tag | ||
| config: | ||
| path: ./out | ||
| tag: v1.0.0 | ||
| - uses: git-push | ||
| config: | ||
| path: ./out | ||
| tag: v1.0.0 | ||
| ``` | ||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,8 +33,10 @@ func New(repoURL string, opts *Options) (Interface, error) { | |
| return nil, fmt.Errorf("no registered providers with name %q", opts.Name) | ||
| } | ||
| for _, reg := range registeredProviders { | ||
| if reg.Predicate(repoURL) { | ||
| return reg.NewProvider(repoURL, opts) | ||
| if reg.Predicate != nil && reg.NewProvider != nil { | ||
| if reg.Predicate(repoURL) { | ||
| return reg.NewProvider(repoURL, opts) | ||
| } | ||
|
Comment on lines
+36
to
+39
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Total aside and note to self... I realize this code wasn't ever refactored to use the PredicateBasedRegistry. Out of scope for this PR, but I should fix that. |
||
| } | ||
| } | ||
| return nil, fmt.Errorf("no registered providers for %s", repoURL) | ||
|
|
||
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.