[master] Auto-update dependencies (#236)

Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
This commit is contained in:
Matt Moore 2020-03-24 08:24:09 -07:00 committed by GitHub
parent 495e087ad2
commit 17555f9c73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 6 deletions

6
Gopkg.lock generated
View File

@ -966,7 +966,7 @@
[[projects]]
branch = "master"
digest = "1:b866a374c5f954ec0830aa3c31962f4f8777624a77eba2b99fb19c732d5c2452"
digest = "1:7912249df5f43ca10fa1c3f8a3febdc3c0f7b320698787fa73c9fb1920a832d6"
name = "knative.dev/pkg"
packages = [
"apis",
@ -986,7 +986,7 @@
"reconciler",
]
pruneopts = "T"
revision = "aa5b1f2211ac4a538128a4a4e03797e9232b0431"
revision = "0840da9555a3a75f801abc1d654fb00dfe9a687a"
[[projects]]
branch = "master"
@ -997,7 +997,7 @@
"tools/dep-collector",
]
pruneopts = "UT"
revision = "0bc1e8bb1582a8738da1b5c485084a84bf76f17c"
revision = "0042e9ca752c8339c3c245e1d2c76b891a144b7e"
[[projects]]
digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c"

View File

@ -33,8 +33,25 @@ const (
separator = "\n"
)
// Option enables further configuration of a Cmd.
type Option func(cmd *exec.Cmd)
// WithEnvs returns an option that adds env vars for the given Cmd.
func WithEnvs(envs []string) Option {
return func(c *exec.Cmd) {
c.Env = envs
}
}
// WithDir returns an option that adds dir for the given Cmd.
func WithDir(dir string) Option {
return func(c *exec.Cmd) {
c.Dir = dir
}
}
// RunCommand will run the command and return the standard output, plus error if there is one.
func RunCommand(cmdLine string) (string, error) {
func RunCommand(cmdLine string, options ...Option) (string, error) {
cmdSplit, err := shell.Split(cmdLine)
if len(cmdSplit) == 0 || err != nil {
return "", &CommandLineError{
@ -47,6 +64,10 @@ func RunCommand(cmdLine string) (string, error) {
cmdName := cmdSplit[0]
args := cmdSplit[1:]
cmd := exec.Command(cmdName, args...)
for _, option := range options {
option(cmd)
}
var eb bytes.Buffer
cmd.Stderr = &eb

View File

@ -78,6 +78,8 @@ type GKECluster struct {
Request *GKERequest
// Project might be GKE specific, so put it here
Project string
// IsBoskos is true if the GCP project used is managed by boskos
IsBoskos bool
// NeedsCleanup tells whether the cluster needs to be deleted afterwards
// This probably should be part of task wrapper's logic
NeedsCleanup bool
@ -181,12 +183,13 @@ func (gc *GKECluster) Acquire() error {
// Get project name from boskos if running in Prow, otherwise it should fail
// since we don't know which project to use
if common.IsProw() {
if gc.Request.Project == "" && common.IsProw() {
project, err := gc.boskosOps.AcquireGKEProject(gc.Request.ResourceType)
if err != nil {
return fmt.Errorf("failed acquiring boskos project: '%v'", err)
}
gc.Project = project.Name
gc.IsBoskos = true
}
if gc.Project == "" {
return errors.New("GCP project must be set")
@ -268,7 +271,7 @@ func (gc *GKECluster) Delete() error {
gc.ensureProtected()
// Release Boskos if running in Prow, will let Janitor taking care of
// clusters deleting
if common.IsProw() {
if gc.IsBoskos {
log.Printf("Releasing Boskos resource: '%v'", gc.Project)
return gc.boskosOps.ReleaseGKEProject(gc.Project)
}