@@ -26,6 +26,7 @@ import (
2626 "github.com/sirupsen/logrus"
2727 "github.com/spf13/cobra"
2828
29+ "k8s.io/release/pkg/command"
2930 "k8s.io/release/pkg/gcp/auth"
3031 "k8s.io/release/pkg/gcp/build"
3132 "k8s.io/release/pkg/git"
@@ -48,22 +49,17 @@ var (
4849 gcbmgrOpts = & gcbmgrOptions {}
4950 buildOpts = & build.Options {}
5051
51- // TODO: Commenting these packages/commands out since they fail in CI.
52- // These can be fixed by changing the CI test image to one that includes the packages.
53- //nolint:gocritic
54- /*
55- requiredPackages = []string{
56- "jq",
57- "git",
58- "bsdmainutils",
59- }
52+ requiredPackages = []string {
53+ "bsdmainutils" ,
54+ }
6055
61- // TODO: Do we really need this if we use the Google Cloud SDK instead?
62- requiredCommands = []string{
63- "gsutil",
64- "gcloud",
65- }
66- */
56+ // TODO: Do we really need this if we use the Google Cloud SDK instead?
57+ requiredCommands = []string {
58+ "gcloud" ,
59+ "git" ,
60+ "gsutil" ,
61+ "jq" ,
62+ }
6763)
6864
6965// gcbmgrCmd is a krel subcommand which invokes runGcbmgr()
@@ -151,26 +147,22 @@ func init() {
151147 rootCmd .AddCommand (gcbmgrCmd )
152148}
153149
154- // runGcbmgr is the function invoked by 'krel gcbmgr', responsible for submitting release jobs to GCB
150+ // runGcbmgr is the function invoked by 'krel gcbmgr', responsible for
151+ // submitting release jobs to GCB
155152func runGcbmgr () error {
156- // TODO: Commenting these checks out since they fail in CI.
157- // These can be fixed by changing the CI test image to one that includes the packages.
158- //nolint:gocritic
159- /*
160- logrus.Info("Checking for required packages...")
161- pkgAvailable, pkgAvailableErr := util.PackagesAvailable(requiredPackages...)
162- if pkgAvailableErr != nil {
163- return pkgAvailableErr
164- }
165- if !pkgAvailable {
166- return errors.New("packages required to run gcbmgr are not present; cannot continue")
167- }
153+ logrus .Info ("Checking for required packages" )
154+ ok , err := util .PackagesAvailable (requiredPackages ... )
155+ if err != nil {
156+ return errors .Wrap (err , "unable to verify if packages are available" )
157+ }
158+ if ! ok {
159+ return errors .New ("packages required to run gcbmgr are not present" )
160+ }
168161
169- logrus.Info("Checking for required commands...")
170- if cmdAvailable := command.Available(requiredCommands...); !cmdAvailable {
171- return errors.New("binaries required to run gcbmgr are not present; cannot continue")
172- }
173- */
162+ logrus .Info ("Checking for required commands" )
163+ if cmdAvailable := command .Available (requiredCommands ... ); ! cmdAvailable {
164+ return errors .New ("binaries required to run gcbmgr are not present" )
165+ }
174166
175167 // TODO: Add gitlib::repo_state check
176168
0 commit comments