From 8130780f6ed917a3cf6c99fe44f375b46b0d775f Mon Sep 17 00:00:00 2001 From: mattmoor-sockpuppet Date: Mon, 19 Aug 2019 07:20:55 -0700 Subject: [PATCH] Auto-update dependencies (#75) Produced via: `dep ensure -update knative.dev/test-infra knative.dev/pkg` /assign mattmoor --- Gopkg.lock | 6 +- vendor/knative.dev/pkg/Gopkg.lock | 58 ++++++++++++++++++ vendor/knative.dev/pkg/Gopkg.toml | 1 + .../pkg/configmap/testing/configmap.go | 4 +- .../testutils/clustermanager/boskos/boskos.go | 60 ++++++++++++++++--- .../pkg/testutils/clustermanager/gke.go | 4 +- 6 files changed, 120 insertions(+), 13 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 647c2fcc..8af6b21c 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -927,7 +927,7 @@ [[projects]] branch = "master" - digest = "1:9d7c900ebc70071471915d9cb9eecc67039ded90c553bfb985a45c06555ff864" + digest = "1:5da0a8b3fcf5178669cae546550202e793c50a963fb4df388cec1614f79aaaa6" name = "knative.dev/pkg" packages = [ "apis", @@ -946,7 +946,7 @@ "metrics/metricskey", ] pruneopts = "T" - revision = "7e6f1f48c9c4cdb1a3a09628986e7e706c82ceab" + revision = "12ee58e32cc8bfaaf88b057be003611e6b7d867d" [[projects]] branch = "master" @@ -957,7 +957,7 @@ "tools/dep-collector", ] pruneopts = "UT" - revision = "3543363d1b8d074deaa57081a53af9113074eeda" + revision = "4f77ef4432b3f1faea39ede0a705a029f3cd3cc8" [solve-meta] analyzer-name = "dep" diff --git a/vendor/knative.dev/pkg/Gopkg.lock b/vendor/knative.dev/pkg/Gopkg.lock index 0193dd05..3c7e41cd 100644 --- a/vendor/knative.dev/pkg/Gopkg.lock +++ b/vendor/knative.dev/pkg/Gopkg.lock @@ -270,6 +270,22 @@ pruneopts = "NUT" revision = "901d90724c7919163f472a9812253fb26761123d" +[[projects]] + digest = "1:f0d9d74edbd40fdeada436d5ac9cb5197407899af3fef85ff0137077ffe8ae19" + name = "github.com/hashicorp/errwrap" + packages = ["."] + pruneopts = "NUT" + revision = "8a6fb523712970c966eefc6b39ed2c5e74880354" + version = "v1.0.0" + +[[projects]] + digest = "1:2ed138049ab373f696db2081ca48f15c5abdf20893803612a284f2bdce2bf443" + name = "github.com/hashicorp/go-multierror" + packages = ["."] + pruneopts = "NUT" + revision = "886a7fbe3eb1c874d46f623bfa70af45f425b3d1" + version = "v1.0.0" + [[projects]] digest = "1:52094d0f8bdf831d1a2401e9b6fee5795fdc0b2a2d1f8bb1980834c289e79129" name = "github.com/hashicorp/golang-lru" @@ -319,6 +335,14 @@ pruneopts = "NUT" revision = "f2b4162afba35581b6d4a50d3b8f34e33c144682" +[[projects]] + digest = "1:58999a98719fddbac6303cb17e8d85b945f60b72f48e3a2df6b950b97fa926f1" + name = "github.com/konsorten/go-windows-terminal-sequences" + packages = ["."] + pruneopts = "NUT" + revision = "f55edac94c9bbba5d6182a4be46d86a2c9b5b50e" + version = "v1.0.2" + [[projects]] branch = "master" digest = "1:927762c6729b4e72957ba3310e485ed09cf8451c5a637a52fd016a9fe09e7936" @@ -474,6 +498,14 @@ revision = "1744e2970ca51c86172c8190fadad617561ed6e7" version = "v1.0.0" +[[projects]] + digest = "1:f4aaa07a6c33f2b354726d0571acbc8ca118837c75709f6353203ae1a3f8eeab" + name = "github.com/sirupsen/logrus" + packages = ["."] + pruneopts = "NUT" + revision = "839c75faf7f98a33d445d181f3018b5c3409a45e" + version = "v1.4.2" + [[projects]] digest = "1:9d8420bbf131d1618bde6530af37c3799340d3762cc47210c1d9532a4c3a2779" name = "github.com/spf13/pflag" @@ -1150,6 +1182,21 @@ pruneopts = "NUT" revision = "33be087ad058f99c78e067996202b60230737e49" +[[projects]] + branch = "master" + digest = "1:013d8728ceab59db2a90db464dc0d3c1f677bdf95f974fed26fe6094b5504cf2" + name = "k8s.io/test-infra" + packages = [ + "boskos", + "boskos/client", + "boskos/common", + "boskos/crds", + "boskos/ranch", + "boskos/storage", + ] + pruneopts = "NUT" + revision = "356470ae778d26af50f27ff8673434bf5cf73c07" + [[projects]] branch = "master" digest = "1:39bb1014c454fbf9d8f4eab62a44fcf8d3ade774e2b42015e533e5d9f3fe23d9" @@ -1161,6 +1208,14 @@ pruneopts = "UT" revision = "d65201fadb82dbdc5713f9ba9a1313150c7aa9b5" +[[projects]] + digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c" + name = "sigs.k8s.io/yaml" + packages = ["."] + pruneopts = "NUT" + revision = "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" + version = "v1.1.0" + [solve-meta] analyzer-name = "dep" analyzer-version = 1 @@ -1268,6 +1323,9 @@ "k8s.io/gengo/namer", "k8s.io/gengo/types", "k8s.io/klog", + "k8s.io/test-infra/boskos", + "k8s.io/test-infra/boskos/client", + "k8s.io/test-infra/boskos/common", "knative.dev/test-infra/scripts", "knative.dev/test-infra/tools/dep-collector", ] diff --git a/vendor/knative.dev/pkg/Gopkg.toml b/vendor/knative.dev/pkg/Gopkg.toml index d1e06392..fe631ab0 100644 --- a/vendor/knative.dev/pkg/Gopkg.toml +++ b/vendor/knative.dev/pkg/Gopkg.toml @@ -8,6 +8,7 @@ required = [ "k8s.io/code-generator/cmd/client-gen", "k8s.io/code-generator/cmd/lister-gen", "k8s.io/code-generator/cmd/informer-gen", + "k8s.io/test-infra/boskos", "github.com/evanphx/json-patch", "knative.dev/test-infra/scripts", "knative.dev/test-infra/tools/dep-collector", diff --git a/vendor/knative.dev/pkg/configmap/testing/configmap.go b/vendor/knative.dev/pkg/configmap/testing/configmap.go index 2e1932bf..e303574e 100644 --- a/vendor/knative.dev/pkg/configmap/testing/configmap.go +++ b/vendor/knative.dev/pkg/configmap/testing/configmap.go @@ -3,7 +3,9 @@ Copyright 2019 The Knative Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,7 +36,7 @@ func ConfigMapFromTestFile(t *testing.T, name string, allowed ...string) *corev1 return cm } -// configMapsFromTestFile creates two corev1.ConfigMap resources from the config +// ConfigMapsFromTestFile creates two corev1.ConfigMap resources from the config // file read from the testdata directory: // 1. The raw configmap read in. // 2. A second version of the configmap augmenting `data:` with what's parsed from the value of `_example:` diff --git a/vendor/knative.dev/pkg/testutils/clustermanager/boskos/boskos.go b/vendor/knative.dev/pkg/testutils/clustermanager/boskos/boskos.go index c74c6519..4a45089b 100644 --- a/vendor/knative.dev/pkg/testutils/clustermanager/boskos/boskos.go +++ b/vendor/knative.dev/pkg/testutils/clustermanager/boskos/boskos.go @@ -16,14 +16,60 @@ limitations under the License. package boskos -// AcquireGKEProject acquires GKE Boskos Project -func AcquireGKEProject() (string, error) { - // TODO: implement the logic - return "", nil +import ( + "context" + "fmt" + "time" + + "knative.dev/pkg/testutils/common" + + boskosclient "k8s.io/test-infra/boskos/client" + boskoscommon "k8s.io/test-infra/boskos/common" +) + +const ( + // GKEProjectResource is resource type defined for GKE projects + GKEProjectResource = "gke-project" +) + +var ( + boskosURI = "http://boskos.test-pods.svc.cluster.local." + defaultWaitDuration = time.Minute * 20 +) + +func newClient(host *string) *boskosclient.Client { + if nil == host { + hostName := common.GetOSEnv("JOB_NAME") + host = &hostName + } + return boskosclient.NewClient(*host, boskosURI) } -// ReleaseGKEProject releases project -func ReleaseGKEProject(name string) error { - // TODO: implement the logic +// AcquireGKEProject acquires GKE Boskos Project with "free" state, and not +// owned by anyone, sets its state to "busy" and assign it an owner of *host, +// which by default is env var `JOB_NAME`. +func AcquireGKEProject(host *string) (*boskoscommon.Resource, error) { + ctx, cancel := context.WithTimeout(context.Background(), defaultWaitDuration) + defer cancel() + p, err := newClient(host).AcquireWait(ctx, GKEProjectResource, boskoscommon.Free, boskoscommon.Busy) + if nil != err { + return nil, fmt.Errorf("boskos failed to acquire GKE project: %v", err) + } + if p == nil { + return nil, fmt.Errorf("boskos does not have a free %s at the moment", GKEProjectResource) + } + return p, nil +} + +// ReleaseGKEProject releases project, the host must match with the host name that acquired +// the project, which by default is env var `JOB_NAME`. The state is set to +// "dirty" for Janitor picking up. +// This function is very powerful, it can release Boskos resource acquired by +// other processes, regardless of where the other process is running. +func ReleaseGKEProject(host *string, name string) error { + client := newClient(host) + if err := client.Release(name, boskoscommon.Dirty); nil != err { + return fmt.Errorf("boskos failed to release GKE project '%s': %v", name, err) + } return nil } diff --git a/vendor/knative.dev/pkg/testutils/clustermanager/gke.go b/vendor/knative.dev/pkg/testutils/clustermanager/gke.go index e03f4dd7..033afe07 100644 --- a/vendor/knative.dev/pkg/testutils/clustermanager/gke.go +++ b/vendor/knative.dev/pkg/testutils/clustermanager/gke.go @@ -57,11 +57,11 @@ func (gs *GKEClient) Setup(numNodes *int, nodeType *string, region *string, zone } // check for Prow if common.IsProw() { - project, err := boskos.AcquireGKEProject() + boskosRes, err := boskos.AcquireGKEProject(nil) if nil != err { return nil, fmt.Errorf("failed acquire boskos project: '%v'", err) } - gc.Project = &project + gc.Project = &boskosRes.Name } if nil == gc.Project || "" == *gc.Project { return nil, fmt.Errorf("gcp project must be set")