diff --git a/commands/release/create/catalog/publish.go b/commands/release/create/catalog/publish.go index a14fece4bce9acb5d672ef787e3f70c2314abe9c..d14079e83e3d1a75201a413b2c08b470800efc55 100644 --- a/commands/release/create/catalog/publish.go +++ b/commands/release/create/catalog/publish.go @@ -40,7 +40,7 @@ func Publish(io *iostreams.IOStreams, client *gitlab.Client, repoName string, ta body, err := publishToCatalogRequestBody(tagName) if err != nil { - return cmdutils.WrapError(err, "failed to create a request body") + return cmdutils.WrapError(err, "failed to create a request body.") } path := fmt.Sprintf(publishToCatalogApiPath, url.PathEscape(repoName)) diff --git a/commands/release/create/create.go b/commands/release/create/create.go index 8f9d0e5bfd583a373d55df30616fd3ee620a3251..48e2a3f963897aa8af66262711f983da814eb21e 100644 --- a/commands/release/create/create.go +++ b/commands/release/create/create.go @@ -79,12 +79,12 @@ func NewCmdCreate(f *cmdutils.Factory) *cobra.Command { To fetch the new tag locally after the release, run %[1]sgit fetch --tags origin%[1]s. `, "`"), - Args: cmdutils.MinimumArgs(1, "no tag name provided"), + Args: cmdutils.MinimumArgs(1, "no tag name provided."), Example: heredoc.Docf(` - # Interactively create a release + # Create a release interactively $ glab release create v1.0.1 - # Non-interactively create a release by specifying a note + # Create a release non-interactively by specifying a note $ glab release create v1.0.1 --notes "bugfix release" # Use release notes from a file @@ -96,10 +96,10 @@ func NewCmdCreate(f *cmdutils.Factory) *cobra.Command { # Upload a release asset with a display name and type $ glab release create v1.0.1 '/path/to/asset.png#My display label#image' - # Upload all assets in a specified folder (types will default to 'other') + # Upload all assets in a specified folder (types default to 'other') $ glab release create v1.0.1 ./dist/* - # Upload all tarballs in a specified folder (types will default to 'other') + # Upload all tarballs in a specified folder (types default to 'other') $ glab release create v1.0.1 ./dist/*.tar.gz # Create a release with assets specified as JSON object @@ -114,19 +114,23 @@ func NewCmdCreate(f *cmdutils.Factory) *cobra.Command { ]' # [EXPERIMENTAL] Create a release and publish it to the GitLab CI/CD catalog - # This command should NOT be run manually, but rather as part of a CI/CD pipeline with the "release" keyword. - # The API endpoint accepts only "CI_JOB_TOKEN" as the authentication token. - # This command retrieves components from the current repository by searching for %[1]syml%[1]s files - # within the "templates" directory and its subdirectories. - # This flag will not work if the feature flag %[1]sci_release_cli_catalog_publish_option%[1]s is not enabled - # for the project in the GitLab instance. - - # Components can be defined; + # Requires the feature flag %[1]sci_release_cli_catalog_publish_option%[1]s to be enabled + # for this project in your GitLab instance. Do NOT run this manually. Use it as part + # of a CI/CD pipeline with the "release" keyword: + # + # - The API endpoint accepts only "CI_JOB_TOKEN" as the authentication token. + # - It retrieves components from the current repository by searching for + # %[1]syml%[1]s files within the "templates" directory and its subdirectories. + # - It fails if the feature flag %[1]sci_release_cli_catalog_publish_option%[1]s + # is not enabled for this project in your GitLab instance. + + # Components can be defined: # - In single files ending in %[1]s.yml%[1]s for each component, like %[1]stemplates/secret-detection.yml%[1]s. - # - In sub-directories containing %[1]stemplate.yml%[1]s files as entry points, - # for components that bundle together multiple related files. For example, - # %[1]stemplates/secret-detection/template.yml%[1]s. + # - In subdirectories containing %[1]stemplate.yml%[1]s files as entry points, + # for components that bundle together multiple related files. For example, + # %[1]stemplates/secret-detection/template.yml%[1]s. + $ glab release create v1.0.1 --publish-to-catalog `, "`"), RunE: func(cmd *cobra.Command, args []string) error { @@ -414,12 +418,12 @@ func createRun(opts *CreateOpts) error { } } } - opts.IO.Logf(color.Bold("%s Release succeeded after %0.2fs.\n"), color.GreenCheck(), time.Since(start).Seconds()) + opts.IO.Logf(color.Bold("%s Release succeeded after %0.2f seconds.\n"), color.GreenCheck(), time.Since(start).Seconds()) if opts.PublishToCatalog { err = catalog.Publish(opts.IO, client, repo.FullName(), release.TagName) if err != nil { - return cmdutils.WrapError(err, "failed to publish the release to the GitLab CI/CD catalog") + return cmdutils.WrapError(err, "failed to publish the release to the GitLab CI/CD catalog.") } } @@ -427,7 +431,7 @@ func createRun(opts *CreateOpts) error { } func releaseFailedErr(err error, start time.Time) error { - return cmdutils.WrapError(err, fmt.Sprintf("release failed after %0.2fs.", time.Since(start).Seconds())) + return cmdutils.WrapError(err, fmt.Sprintf("release failed after %0.2f seconds.", time.Since(start).Seconds())) } func getMilestoneByTitle(c *CreateOpts, title string) (*gitlab.Milestone, error) { diff --git a/docs/source/release/create.md b/docs/source/release/create.md index 8339d15950b3080376f915836a84860750dc19ff..77e57d5fc4a2a2fafcc09de2d4213d477dbf6ba2 100644 --- a/docs/source/release/create.md +++ b/docs/source/release/create.md @@ -36,10 +36,10 @@ glab release create [...] [flags] ## Examples ```plaintext -# Interactively create a release +# Create a release interactively $ glab release create v1.0.1 -# Non-interactively create a release by specifying a note +# Create a release non-interactively by specifying a note $ glab release create v1.0.1 --notes "bugfix release" # Use release notes from a file @@ -51,10 +51,10 @@ $ glab release create v1.0.1 '/path/to/asset.zip#My display label' # Upload a release asset with a display name and type $ glab release create v1.0.1 '/path/to/asset.png#My display label#image' -# Upload all assets in a specified folder (types will default to 'other') +# Upload all assets in a specified folder (types default to 'other') $ glab release create v1.0.1 ./dist/* -# Upload all tarballs in a specified folder (types will default to 'other') +# Upload all tarballs in a specified folder (types default to 'other') $ glab release create v1.0.1 ./dist/*.tar.gz # Create a release with assets specified as JSON object @@ -69,19 +69,23 @@ $ glab release create v1.0.1 --assets-links=' ]' # [EXPERIMENTAL] Create a release and publish it to the GitLab CI/CD catalog -# This command should NOT be run manually, but rather as part of a CI/CD pipeline with the "release" keyword. -# The API endpoint accepts only "CI_JOB_TOKEN" as the authentication token. -# This command retrieves components from the current repository by searching for `yml` files -# within the "templates" directory and its subdirectories. -# This flag will not work if the feature flag `ci_release_cli_catalog_publish_option` is not enabled -# for the project in the GitLab instance. - -# Components can be defined; +# Requires the feature flag `ci_release_cli_catalog_publish_option` to be enabled +# for this project in your GitLab instance. Do NOT run this manually. Use it as part +# of a CI/CD pipeline with the "release" keyword: +# +# - The API endpoint accepts only "CI_JOB_TOKEN" as the authentication token. +# - It retrieves components from the current repository by searching for +# `yml` files within the "templates" directory and its subdirectories. +# - It fails if the feature flag `ci_release_cli_catalog_publish_option` +# is not enabled for this project in your GitLab instance. + +# Components can be defined: # - In single files ending in `.yml` for each component, like `templates/secret-detection.yml`. -# - In sub-directories containing `template.yml` files as entry points, -# for components that bundle together multiple related files. For example, -# `templates/secret-detection/template.yml`. +# - In subdirectories containing `template.yml` files as entry points, +# for components that bundle together multiple related files. For example, +# `templates/secret-detection/template.yml`. + $ glab release create v1.0.1 --publish-to-catalog ```