Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#246: Remove docker check from rancher image check #288

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions cmd/rancher_release/check_rancher_image.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
package main

import (
"context"

"github.com/rancher/ecm-distro-tools/release/rancher"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
)

const (
rancherOrg = "rancher"
rancherRepo = rancherOrg
)

func checkRancherImageCommand() *cli.Command {
return &cli.Command{
Name: "check-rancher-image",
Expand All @@ -32,9 +25,5 @@ func checkRancherImageCommand() *cli.Command {
func checkRancherImage(c *cli.Context) error {
tag := c.String("tag")
logrus.Debug("tag: " + tag)
rancherArchs := []string{"amd64", "arm64", "s390x"}
if err := rancher.CheckRancherDockerImage(context.Background(), rancherOrg, rancherRepo, tag, rancherArchs); err != nil {
return err
}
return rancher.CheckHelmChartVersion(tag)
}
9 changes: 2 additions & 7 deletions release/rancher/rancher.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"time"

"github.com/google/go-github/v39/github"
"github.com/rancher/ecm-distro-tools/docker"
"github.com/rancher/ecm-distro-tools/exec"
ecmHTTP "github.com/rancher/ecm-distro-tools/http"
"github.com/rancher/ecm-distro-tools/repository"
Expand Down Expand Up @@ -163,18 +162,14 @@ func rancherImages(imagesURL string) (string, error) {
return string(images), nil
}

func CheckRancherDockerImage(ctx context.Context, org, repo, tag string, archs []string) error {
return docker.CheckImageArchs(ctx, org, repo, tag, archs)
}

func CheckHelmChartVersion(tag string) error {
versions, err := rancherHelmChartVersions(rancherHelmRepositoryURL)
if err != nil {
return err
}
var foundVersion bool
for _, version := range versions {
logrus.Debug("checking version " + version)
logrus.Info("checking version " + version)
if tag == version {
logrus.Info("found chart for version " + version)
foundVersion = true
Expand All @@ -189,7 +184,7 @@ func CheckHelmChartVersion(tag string) error {

func rancherHelmChartVersions(repoURL string) ([]string, error) {
httpClient := ecmHTTP.NewClient(time.Second * 15)
logrus.Debug("downloading: " + repoURL)
logrus.Info("downloading: " + repoURL)
resp, err := httpClient.Get(repoURL)
if err != nil {
return nil, err
Expand Down