From 42892f7dcd4d6a7e762078861b6cce37c9d1ace5 Mon Sep 17 00:00:00 2001 From: Pedro Tashima Date: Tue, 21 Nov 2023 17:04:14 -0300 Subject: [PATCH] update error handling --- release/rke2/rke2.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/release/rke2/rke2.go b/release/rke2/rke2.go index 901ff5cf..121a5d0a 100644 --- a/release/rke2/rke2.go +++ b/release/rke2/rke2.go @@ -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 } @@ -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),