Skip to content

Enable krel gcbmgr package and binary checks #1171

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

Merged
merged 1 commit into from
Mar 24, 2020
Merged
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
58 changes: 25 additions & 33 deletions cmd/krel/cmd/gcbmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"

"k8s.io/release/pkg/command"
"k8s.io/release/pkg/gcp/auth"
"k8s.io/release/pkg/gcp/build"
"k8s.io/release/pkg/git"
Expand All @@ -48,22 +49,17 @@ var (
gcbmgrOpts = &gcbmgrOptions{}
buildOpts = &build.Options{}

// TODO: Commenting these packages/commands out since they fail in CI.
// These can be fixed by changing the CI test image to one that includes the packages.
//nolint:gocritic
/*
requiredPackages = []string{
"jq",
"git",
"bsdmainutils",
}
requiredPackages = []string{
"bsdmainutils",
}

// TODO: Do we really need this if we use the Google Cloud SDK instead?
requiredCommands = []string{
"gsutil",
"gcloud",
}
*/
// TODO: Do we really need this if we use the Google Cloud SDK instead?
requiredCommands = []string{
"gcloud",
"git",
"gsutil",
"jq",
}
)

// gcbmgrCmd is a krel subcommand which invokes runGcbmgr()
Expand Down Expand Up @@ -151,26 +147,22 @@ func init() {
rootCmd.AddCommand(gcbmgrCmd)
}

// runGcbmgr is the function invoked by 'krel gcbmgr', responsible for submitting release jobs to GCB
// runGcbmgr is the function invoked by 'krel gcbmgr', responsible for
// submitting release jobs to GCB
func runGcbmgr() error {
// TODO: Commenting these checks out since they fail in CI.
// These can be fixed by changing the CI test image to one that includes the packages.
//nolint:gocritic
/*
logrus.Info("Checking for required packages...")
pkgAvailable, pkgAvailableErr := util.PackagesAvailable(requiredPackages...)
if pkgAvailableErr != nil {
return pkgAvailableErr
}
if !pkgAvailable {
return errors.New("packages required to run gcbmgr are not present; cannot continue")
}
logrus.Info("Checking for required packages")
ok, err := util.PackagesAvailable(requiredPackages...)
if err != nil {
return errors.Wrap(err, "unable to verify if packages are available")
}
if !ok {
return errors.New("packages required to run gcbmgr are not present")
}

logrus.Info("Checking for required commands...")
if cmdAvailable := command.Available(requiredCommands...); !cmdAvailable {
return errors.New("binaries required to run gcbmgr are not present; cannot continue")
}
*/
logrus.Info("Checking for required commands")
if cmdAvailable := command.Available(requiredCommands...); !cmdAvailable {
return errors.New("binaries required to run gcbmgr are not present")
}

// TODO: Add gitlib::repo_state check

Expand Down