Skip to content

Commit

Permalink
update error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tashima42 committed Nov 21, 2023
1 parent a5233f9 commit 42892f7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions release/rke2/rke2.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ func ImageBuildBaseRelease(ctx context.Context, ghClient *github.Client, alpineV
version := strings.Split(version.Version, "go")[1]
alpineTag := version + "-alpine" + alpineVersion

err := docker.CheckImageArchs(ctx, "library", "golang", alpineTag, []string{"amd64", "arm64", "s390x"})
if err != nil {
if err := docker.CheckImageArchs(ctx, "library", "golang", alpineTag, []string{"amd64", "arm64", "s390x"}); err != nil {
return err
}

imageBuildBaseTag := "v" + version + "b1"
logrus.Info("stripped version: " + imageBuildBaseTag)
_, _, err = ghClient.Repositories.GetReleaseByTag(ctx, "rancher", imageBuildBaseRepo, imageBuildBaseTag)
if err == nil {
if _, _, err := ghClient.Repositories.GetReleaseByTag(ctx, "rancher", imageBuildBaseRepo, imageBuildBaseTag); err == nil {
logrus.Info("release " + imageBuildBaseTag + " already exists")
continue
}
Expand All @@ -57,7 +55,7 @@ func ImageBuildBaseRelease(ctx context.Context, ghClient *github.Client, alpineV
logrus.Infof("Release:\n Owner: rancher\n Repo: %s\n TagName: %s\n Name: %s\n", imageBuildBaseRepo, imageBuildBaseTag, imageBuildBaseTag)
return nil
}
_, _, err = ghClient.Repositories.CreateRelease(ctx, "rancher", imageBuildBaseRepo, &github.RepositoryRelease{
_, _, err := ghClient.Repositories.CreateRelease(ctx, "rancher", imageBuildBaseRepo, &github.RepositoryRelease{
TagName: github.String(imageBuildBaseTag),
Name: github.String(imageBuildBaseTag),
Prerelease: github.Bool(false),
Expand Down

0 comments on commit 42892f7

Please sign in to comment.