-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add rancher tag release command * add release body generation with rancher/rancher * add documentation * fix import * fix pull * move types to top * add tests * remove components file * remove unued struct run component files args --------- Co-authored-by: Pedro Tashima <[email protected]>
- Loading branch information
Showing
5 changed files
with
200 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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 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 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,75 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/rancher/ecm-distro-tools/release/rancher" | ||
"github.com/rancher/ecm-distro-tools/repository" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
func tagReleaseCommand() *cli.Command { | ||
return &cli.Command{ | ||
Name: "tag-release", | ||
Usage: "tag a rancher release", | ||
Flags: []cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "github-token", | ||
Aliases: []string{"g"}, | ||
EnvVars: []string{"GITHUB_TOKEN"}, | ||
Required: true, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "tag", | ||
Aliases: []string{"t"}, | ||
Usage: "release tag", | ||
Required: true, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "remote-branch", | ||
Aliases: []string{"b"}, | ||
Usage: "rancher remote branch", | ||
Required: true, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "repo-owner", | ||
Aliases: []string{"o"}, | ||
Usage: "repo owner for the rancher repo, default is rancher, this is only used for testing purposes", | ||
Value: "rancher", | ||
Required: false, | ||
}, | ||
&cli.BoolFlag{ | ||
Name: "general-availability", | ||
Aliases: []string{"a"}, | ||
Usage: "by default, the release will be created as a pre-release, make sure it absolutely needs to be a GA release before setting this", | ||
Required: false, | ||
}, | ||
&cli.BoolFlag{ | ||
Name: "ignore-draft", | ||
Aliases: []string{"d"}, | ||
Usage: "by default, the release will be created as a draft, so you can verify all information is correct before publishing it", | ||
Required: false, | ||
}, | ||
&cli.BoolFlag{ | ||
Name: "dry-run", | ||
Aliases: []string{"r"}, | ||
Usage: "skip all changes that have side effects, like creating a release in a remote repo.", | ||
Required: false, | ||
}, | ||
}, | ||
Action: tagRelease, | ||
} | ||
} | ||
|
||
func tagRelease(c *cli.Context) error { | ||
token := c.String("github-token") | ||
tag := c.String("tag") | ||
remoteBranch := c.String("remote-branch") | ||
repoOwner := c.String("repo-owner") | ||
generalAvailability := c.Bool("general-availability") | ||
ignoreDraft := c.Bool("ignore-draft") | ||
dryRun := c.Bool("dry-run") | ||
ctx := context.Background() | ||
ghClient := repository.NewGithub(ctx, token) | ||
return rancher.TagRancherRelease(ctx, ghClient, tag, remoteBranch, repoOwner, generalAvailability, ignoreDraft, dryRun) | ||
} |
This file contains 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 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