mirror of https://github.com/knative/caching.git
[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:
parent
495e087ad2
commit
17555f9c73
|
@ -966,7 +966,7 @@
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
digest = "1:b866a374c5f954ec0830aa3c31962f4f8777624a77eba2b99fb19c732d5c2452"
|
digest = "1:7912249df5f43ca10fa1c3f8a3febdc3c0f7b320698787fa73c9fb1920a832d6"
|
||||||
name = "knative.dev/pkg"
|
name = "knative.dev/pkg"
|
||||||
packages = [
|
packages = [
|
||||||
"apis",
|
"apis",
|
||||||
|
@ -986,7 +986,7 @@
|
||||||
"reconciler",
|
"reconciler",
|
||||||
]
|
]
|
||||||
pruneopts = "T"
|
pruneopts = "T"
|
||||||
revision = "aa5b1f2211ac4a538128a4a4e03797e9232b0431"
|
revision = "0840da9555a3a75f801abc1d654fb00dfe9a687a"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
@ -997,7 +997,7 @@
|
||||||
"tools/dep-collector",
|
"tools/dep-collector",
|
||||||
]
|
]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "0bc1e8bb1582a8738da1b5c485084a84bf76f17c"
|
revision = "0042e9ca752c8339c3c245e1d2c76b891a144b7e"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c"
|
digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c"
|
||||||
|
|
|
@ -33,8 +33,25 @@ const (
|
||||||
separator = "\n"
|
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.
|
// 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)
|
cmdSplit, err := shell.Split(cmdLine)
|
||||||
if len(cmdSplit) == 0 || err != nil {
|
if len(cmdSplit) == 0 || err != nil {
|
||||||
return "", &CommandLineError{
|
return "", &CommandLineError{
|
||||||
|
@ -47,6 +64,10 @@ func RunCommand(cmdLine string) (string, error) {
|
||||||
cmdName := cmdSplit[0]
|
cmdName := cmdSplit[0]
|
||||||
args := cmdSplit[1:]
|
args := cmdSplit[1:]
|
||||||
cmd := exec.Command(cmdName, args...)
|
cmd := exec.Command(cmdName, args...)
|
||||||
|
for _, option := range options {
|
||||||
|
option(cmd)
|
||||||
|
}
|
||||||
|
|
||||||
var eb bytes.Buffer
|
var eb bytes.Buffer
|
||||||
cmd.Stderr = &eb
|
cmd.Stderr = &eb
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,8 @@ type GKECluster struct {
|
||||||
Request *GKERequest
|
Request *GKERequest
|
||||||
// Project might be GKE specific, so put it here
|
// Project might be GKE specific, so put it here
|
||||||
Project string
|
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
|
// NeedsCleanup tells whether the cluster needs to be deleted afterwards
|
||||||
// This probably should be part of task wrapper's logic
|
// This probably should be part of task wrapper's logic
|
||||||
NeedsCleanup bool
|
NeedsCleanup bool
|
||||||
|
@ -181,12 +183,13 @@ func (gc *GKECluster) Acquire() error {
|
||||||
|
|
||||||
// Get project name from boskos if running in Prow, otherwise it should fail
|
// Get project name from boskos if running in Prow, otherwise it should fail
|
||||||
// since we don't know which project to use
|
// 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)
|
project, err := gc.boskosOps.AcquireGKEProject(gc.Request.ResourceType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed acquiring boskos project: '%v'", err)
|
return fmt.Errorf("failed acquiring boskos project: '%v'", err)
|
||||||
}
|
}
|
||||||
gc.Project = project.Name
|
gc.Project = project.Name
|
||||||
|
gc.IsBoskos = true
|
||||||
}
|
}
|
||||||
if gc.Project == "" {
|
if gc.Project == "" {
|
||||||
return errors.New("GCP project must be set")
|
return errors.New("GCP project must be set")
|
||||||
|
@ -268,7 +271,7 @@ func (gc *GKECluster) Delete() error {
|
||||||
gc.ensureProtected()
|
gc.ensureProtected()
|
||||||
// Release Boskos if running in Prow, will let Janitor taking care of
|
// Release Boskos if running in Prow, will let Janitor taking care of
|
||||||
// clusters deleting
|
// clusters deleting
|
||||||
if common.IsProw() {
|
if gc.IsBoskos {
|
||||||
log.Printf("Releasing Boskos resource: '%v'", gc.Project)
|
log.Printf("Releasing Boskos resource: '%v'", gc.Project)
|
||||||
return gc.boskosOps.ReleaseGKEProject(gc.Project)
|
return gc.boskosOps.ReleaseGKEProject(gc.Project)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue