Skip to content

Commit e0cb0ff

Browse files
authored
refactor(internal/librarian): rename tag-and-release command to tag (#2731)
The release subcommand tag-and-release is renamed to tag for brevity and improved user experience. Functionality is not changed. Variables will be renamed in a follow up PR. For #1926
1 parent 17f5190 commit e0cb0ff

File tree

9 files changed

+26
-26
lines changed

9 files changed

+26
-26
lines changed

cmd/librarian/doc.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Usage:
144144
Commands:
145145
146146
init initiates a release by creating a release pull request.
147-
tag-and-release tags and creates a GitHub release for a merged pull request.
147+
tag tags and creates a GitHub release for a merged pull request.
148148
149149
# release init
150150
@@ -224,9 +224,9 @@ Flags:
224224
is configured as a language repository.
225225
-v enables verbose logging
226226
227-
# release tag-and-release
227+
# release tag
228228
229-
The 'tag-and-release' command is the final step in the release
229+
The 'tag' command is the final step in the release
230230
process. It is designed to be run after a release pull request, created by
231231
'release init', has been merged.
232232
@@ -245,14 +245,14 @@ merged pull requests with the 'release:pending' label from the last 30 days.
245245
Examples:
246246
247247
# Tag and create a GitHub release for a specific merged PR.
248-
librarian release tag-and-release --repo=https://github.com/googleapis/google-cloud-go --pr=https://github.com/googleapis/google-cloud-go/pull/123
248+
librarian release tag --repo=https://github.com/googleapis/google-cloud-go --pr=https://github.com/googleapis/google-cloud-go/pull/123
249249
250250
# Find and process all pending merged release PRs in a repository.
251-
librarian release tag-and-release --repo=https://github.com/googleapis/google-cloud-go
251+
librarian release tag --repo=https://github.com/googleapis/google-cloud-go
252252
253253
Usage:
254254
255-
librarian release tag-and-release [arguments]
255+
librarian release tag [arguments]
256256
257257
Flags:
258258

e2e_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ func TestReleaseTagAndRelease(t *testing.T) {
617617
// Set up a mock GitHub API server using httptest.
618618
// This server will intercept HTTP requests made by the librarian command
619619
// and provide canned responses, avoiding any real calls to the GitHub API.
620-
// The handlers below simulate the endpoints that 'release tag-and-release' interacts with.
620+
// The handlers below simulate the endpoints that 'release tag' interacts with.
621621
var server *httptest.Server
622622
server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
623623
// Verify that the GitHub token is being sent correctly.
@@ -727,7 +727,7 @@ libraries:
727727
"run",
728728
"github.com/googleapis/librarian/cmd/librarian",
729729
"release",
730-
"tag-and-release",
730+
"tag",
731731
fmt.Sprintf("--repo=%s", repo),
732732
fmt.Sprintf("--github-api-endpoint=%s/", server.URL),
733733
"--pr=https://github.com/googleapis/librarian/pull/123",
@@ -742,7 +742,7 @@ libraries:
742742
cmd.Stdout = os.Stdout
743743
if err := cmd.Run(); err != nil {
744744
if !test.wantErr {
745-
t.Fatalf("Failed to run release tag-and-release: %v", err)
745+
t.Fatalf("Failed to run release tag: %v", err)
746746
}
747747
}
748748
})

infra/prod/publish-release-worker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
#
15-
# This runs the `librarian release tag-and-release` command with a provided repository,
15+
# This runs the `librarian release tag` command with a provided repository,
1616
# secret name, and optional PR
1717
steps:
1818
- name: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/librarian-dispatcher

infra/prod/publish-release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# This Cloud Build configuration is used by a Louhi flow for the Artifact
1515
# Registry (AR) Exit Gate process (go/cloud-sdk-ar-exit-gate-onboarding).
1616
#
17-
# This runs the `librarian release tag-and-release` command with a provided repository,
17+
# This runs the `librarian release tag` command with a provided repository,
1818
# secret name, and optional PR
1919
steps:
2020
- name: gcr.io/cloud-builders/git
@@ -31,7 +31,7 @@ steps:
3131
waitFor: ['clone-language-repo']
3232
args:
3333
- 'release'
34-
- 'tag-and-release'
34+
- 'tag'
3535
- '-repo'
3636
- '/workspace/$_REPOSITORY'
3737
- '-pr'

internal/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ type Config struct {
190190
// PullRequest to target and operate one in the context of a release.
191191
//
192192
// The pull request should be in the format `https://github.com/{owner}/{repo}/pull/{number}`.
193-
// Setting this field for `tag-and-release` means librarian will only attempt
193+
// Setting this field for `tag` means librarian will only attempt
194194
// to process this exact pull request and not search for other pull requests
195195
// that may be ready for tagging and releasing.
196196
PullRequest string

internal/librarian/help.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Examples:
112112
# Manually specify a version for a single library, overriding the calculation.
113113
librarian release init --library=secretmanager --library-version=2.0.0 --push`
114114

115-
tagAndReleaseLongHelp = `The 'tag-and-release' command is the final step in the release
115+
tagAndReleaseLongHelp = `The 'tag' command is the final step in the release
116116
process. It is designed to be run after a release pull request, created by
117117
'release init', has been merged.
118118
@@ -130,10 +130,10 @@ merged pull requests with the 'release:pending' label from the last 30 days.
130130
131131
Examples:
132132
# Tag and create a GitHub release for a specific merged PR.
133-
librarian release tag-and-release --repo=https://github.com/googleapis/google-cloud-go --pr=https://github.com/googleapis/google-cloud-go/pull/123
133+
librarian release tag --repo=https://github.com/googleapis/google-cloud-go --pr=https://github.com/googleapis/google-cloud-go/pull/123
134134
135135
# Find and process all pending merged release PRs in a repository.
136-
librarian release tag-and-release --repo=https://github.com/googleapis/google-cloud-go`
136+
librarian release tag --repo=https://github.com/googleapis/google-cloud-go`
137137

138138
updateImageLongHelp = `The 'update-image' command is used to update the 'image' SHA
139139
of the language container for a language repository.

internal/librarian/librarian.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ func newCmdGenerate() *cli.Command {
119119
func newCmdTagAndRelease() *cli.Command {
120120
var verbose bool
121121
cmdTagAndRelease := &cli.Command{
122-
Short: "tag-and-release tags and creates a GitHub release for a merged pull request.",
123-
UsageLine: "librarian release tag-and-release [arguments]",
122+
Short: "tag tags and creates a GitHub release for a merged pull request.",
123+
UsageLine: "librarian release tag [arguments]",
124124
Long: tagAndReleaseLongHelp,
125125
Action: func(ctx context.Context, cmd *cli.Command) error {
126126
setupLogger(verbose)
127-
slog.Debug("tag-and-release command verbose logging")
127+
slog.Debug("tag command verbose logging")
128128
if err := cmd.Config.SetDefaults(); err != nil {
129129
return fmt.Errorf("failed to initialize config: %w", err)
130130
}

internal/librarian/librarian_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ func TestVerboseFlag(t *testing.T) {
7474
expectDebugLog: false,
7575
},
7676
{
77-
name: "release tag-and-release with -v flag",
78-
args: []string{"release", "tag-and-release", "-v"},
77+
name: "release tag with -v flag",
78+
args: []string{"release", "tag", "-v"},
7979
expectDebugLog: true,
80-
expectDebugSubstr: "tag-and-release command verbose logging",
80+
expectDebugSubstr: "tag command verbose logging",
8181
},
8282
{
83-
name: "release tag-and-release without -v flag",
84-
args: []string{"release", "tag-and-release"},
83+
name: "release tag without -v flag",
84+
args: []string{"release", "tag"},
8585
expectDebugLog: false,
8686
},
8787
} {

internal/librarian/tag_and_release.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import (
3737

3838
const (
3939
pullRequestSegments = 7
40-
tagAndReleaseCmdName = "tag-and-release"
40+
tagAndReleaseCmdName = "tag"
4141
releasePendingLabel = "release:pending"
4242
releaseDoneLabel = "release:done"
4343
)
@@ -120,7 +120,7 @@ func parseRemote(repo string) (*github.Repository, error) {
120120
}
121121

122122
func (r *tagAndReleaseRunner) run(ctx context.Context) error {
123-
slog.Info("running tag-and-release command")
123+
slog.Info("running tag command")
124124
prs, err := r.determinePullRequestsToProcess(ctx)
125125
if err != nil {
126126
return err

0 commit comments

Comments
 (0)