Auto-update dependencies (#198)

Produced via:
  `dep ensure -update knative.dev/test-infra knative.dev/pkg`
/assign n3wscott
/cc n3wscott
This commit is contained in:
Matt Moore 2020-02-07 07:50:14 -08:00 committed by GitHub
parent 7d322015b5
commit 355618808e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 56 additions and 30 deletions

8
Gopkg.lock generated
View File

@ -966,7 +966,7 @@
[[projects]]
branch = "master"
digest = "1:ff64411674465bf00841fe71b154b7eb4fa3c0692e29c341e70e6e9834b8c974"
digest = "1:50ad80e619992aab730865192c7ea1f17359a14548760bb8360180eb0797f514"
name = "knative.dev/pkg"
packages = [
"apis",
@ -985,18 +985,18 @@
"metrics/metricskey",
]
pruneopts = "T"
revision = "79f10450c2609c682a2dae3762adb867c504f15b"
revision = "87875e3b427a09be8c6c688811a54c43ea8be1b1"
[[projects]]
branch = "master"
digest = "1:fdc3106893e9ad75a8615d1326df00899c519ea71684092b4a10b3260f3c0c15"
digest = "1:becb98d0dc7f7201c23df580e99e64253d79cf8894fa77bce76cfbf69009557d"
name = "knative.dev/test-infra"
packages = [
"scripts",
"tools/dep-collector",
]
pruneopts = "UT"
revision = "4b1d06a2c818a6c01c2934d4c27175f82e25975a"
revision = "b09617df210766782b2b8f164476ac3887c2baec"
[[projects]]
digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c"

View File

@ -65,8 +65,8 @@ func (kr *KReference) Validate(ctx context.Context) *apis.FieldError {
// Because things get defaulted in other cases, moving forward the
// kr.Namespace will not be empty.
if kr.Namespace != "" {
parentNS := apis.ParentMeta(ctx).Namespace
if !apis.IsDifferentNamespaceAllowed(ctx) {
parentNS := apis.ParentMeta(ctx).Namespace
if parentNS != "" && kr.Namespace != parentNS {
errs = errs.Also(&apis.FieldError{
Message: "mismatched namespaces",
@ -80,6 +80,7 @@ func (kr *KReference) Validate(ctx context.Context) *apis.FieldError {
return errs
}
// SetDefaults sets the default values on the KReference.
func (kr *KReference) SetDefaults(ctx context.Context) {
if kr.Namespace == "" {
kr.Namespace = apis.ParentMeta(ctx).Namespace

View File

@ -82,7 +82,7 @@ func (*Addressable) GetFullType() duck.Populatable {
// ConvertUp implements apis.Convertible
func (a *Addressable) ConvertUp(ctx context.Context, to apis.Convertible) error {
url := a.GetURL()
url := a.URL
switch sink := to.(type) {
case *v1.Addressable:
sink.URL = url.DeepCopy()

View File

@ -18,6 +18,7 @@ package generators
import (
"io"
"k8s.io/gengo/generator"
"k8s.io/gengo/namer"
"k8s.io/gengo/types"

View File

@ -77,9 +77,11 @@ func (c *Client) StoreAndHandleResult() error {
return c.alerter.HandleBenchmarkResult(c.benchmarkKey, c.benchmarkName, out, err)
}
var tagEscaper = strings.NewReplacer("+", "-", "\t", "_", " ", "_")
// EscapeTag replaces characters that Mako doesn't accept with ones it does.
func EscapeTag(tag string) string {
return strings.ReplaceAll(tag, ".", "_")
return tagEscaper.Replace(tag)
}
// SetupHelper sets up the mako client for the provided benchmarkKey.
@ -135,15 +137,16 @@ func SetupHelper(ctx context.Context, benchmarkKey *string, benchmarkName *strin
} else if parts := strings.Split(machineType, "/"); len(parts) != 4 {
tags = append(tags, "instanceType="+EscapeTag(parts[3]))
}
tags = append(tags,
"commit="+commitID,
"kubernetes="+EscapeTag(version.String()),
"goversion="+EscapeTag(runtime.Version()),
)
log.Printf("The tags for this run are: %+v", tags)
// Create a new Quickstore that connects to the microservice
qs, qclose, err := quickstore.NewAtAddress(ctx, &qpb.QuickstoreInput{
BenchmarkKey: benchmarkKey,
Tags: append(tags,
"commit="+commitID,
"kubernetes="+EscapeTag(version.String()),
EscapeTag(runtime.Version()),
),
Tags: tags,
}, sidecarAddress)
if err != nil {
return nil, err

View File

@ -307,6 +307,9 @@ This is a helper script for Knative release scripts. To use it:
if `--release-gcs` was passed, otherwise the default value
`knative-nightly/<repo>` will be used. It is empty if `--publish` was not
passed.
- `RELEASE_DIR`: contains the directory to store the manifests if
`--release-dir` was passed. Defaults to empty value, but if
`--nopublish` was passed then points to the repository root directory.
- `BUILD_COMMIT_HASH`: the commit short hash for the current repo. If the
current git tree is dirty, it will have `-dirty` appended to it.
- `BUILD_YYYYMMDD`: current UTC date in `YYYYMMDD` format.
@ -332,7 +335,7 @@ This is a helper script for Knative release scripts. To use it:
All environment variables above, except `KO_FLAGS`, are marked read-only once
`main()` is called (see below).
1. Call the `main()` function passing `$@` (without quotes).
1. Call the `main()` function passing `"$@"` (with quotes).
### Sample release script
@ -345,5 +348,5 @@ function build_release() {
ARTIFACTS_TO_PUBLISH="release.yaml"
}
main $@
main "$@"
```

View File

@ -93,9 +93,9 @@ RELEASE_VERSION=""
RELEASE_NOTES=""
RELEASE_BRANCH=""
RELEASE_GCS_BUCKET="knative-nightly/${REPO_NAME}"
RELEASE_DIR=""
KO_FLAGS="-P"
VALIDATION_TESTS="./test/presubmit-tests.sh"
YAMLS_TO_PUBLISH=""
ARTIFACTS_TO_PUBLISH=""
FROM_NIGHTLY_RELEASE=""
FROM_NIGHTLY_RELEASE_GCS=""
@ -334,6 +334,7 @@ function find_latest_nightly() {
function parse_flags() {
local has_gcr_flag=0
local has_gcs_flag=0
local has_dir_flag=0
local is_dot_release=0
local is_auto_release=0
@ -365,8 +366,14 @@ function parse_flags() {
;;
--release-gcs)
RELEASE_GCS_BUCKET=$1
RELEASE_DIR=""
has_gcs_flag=1
;;
--release-dir)
RELEASE_DIR=$1
RELEASE_GCS_BUCKET=""
has_dir_flag=1
;;
--version)
[[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || abort "version format must be '[0-9].[0-9].[0-9]'"
RELEASE_VERSION=$1
@ -389,6 +396,9 @@ function parse_flags() {
shift
done
(( has_gcs_flag )) && (( has_dir_flag )) && abort "cannot have both --release-gcs and --release-dir set simultaneously"
[[ -n "${RELEASE_GCS_BUCKET}" && -n "${RELEASE_DIR}" ]] && abort "cannot have both GCS and release directory set"
# Do auto release unless release is forced
if (( is_auto_release )); then
(( is_dot_release )) && abort "cannot have both --dot-release and --auto-release set simultaneously"
@ -422,8 +432,13 @@ function parse_flags() {
(( has_gcr_flag )) && echo "Not publishing the release, GCR flag is ignored"
(( has_gcs_flag )) && echo "Not publishing the release, GCS flag is ignored"
KO_DOCKER_REPO="ko.local"
KO_FLAGS="-L ${KO_FLAGS}"
RELEASE_GCS_BUCKET=""
[[ -z "${RELEASE_DIR}" ]] && RELEASE_DIR="${REPO_ROOT_DIR}"
fi
[[ -z "${RELEASE_GCS_BUCKET}" && -z "${RELEASE_DIR}" ]] && abort "--release-gcs or --release-dir must be used"
if [[ -n "${RELEASE_DIR}" ]]; then
mkdir -p "${RELEASE_DIR}" || abort "cannot create release dir '${RELEASE_DIR}'"
fi
# Get the commit, excluding any tags but keeping the "dirty" flag
@ -450,6 +465,7 @@ function parse_flags() {
readonly RELEASE_NOTES
readonly RELEASE_BRANCH
readonly RELEASE_GCS_BUCKET
readonly RELEASE_DIR
readonly KO_DOCKER_REPO
readonly VALIDATION_TESTS
readonly FROM_NIGHTLY_RELEASE
@ -458,22 +474,24 @@ function parse_flags() {
# Run tests (unless --skip-tests was passed). Conveniently displays a banner indicating so.
# Parameters: $1 - executable that runs the tests.
function run_validation_tests() {
if (( ! SKIP_TESTS )); then
banner "Running release validation tests"
# Run tests.
if ! $1; then
banner "Release validation tests failed, aborting"
exit 1
fi
(( SKIP_TESTS )) && return
banner "Running release validation tests"
# Run tests.
if ! $1; then
banner "Release validation tests failed, aborting"
abort "release validation tests failed"
fi
}
# Publishes the generated artifacts to GCS, GitHub, etc.
# Publishes the generated artifacts to directory, GCS, GitHub, etc.
# Parameters: $1..$n - files to add to the release.
function publish_artifacts() {
(( ! PUBLISH_RELEASE )) && return
tag_images_in_yamls ${ARTIFACTS_TO_PUBLISH}
publish_to_gcs ${ARTIFACTS_TO_PUBLISH}
if [[ -n "${RELEASE_DIR}" ]]; then
cp ${ARTIFACTS_TO_PUBLISH} ${RELEASE_DIR} || abort "cannot copy release to '${RELEASE_DIR}'"
fi
[[ -n "${RELEASE_GCS_BUCKET}" ]] && publish_to_gcs ${ARTIFACTS_TO_PUBLISH}
publish_to_github ${ARTIFACTS_TO_PUBLISH}
banner "New release published successfully"
}
@ -482,7 +500,7 @@ function publish_artifacts() {
function main() {
function_exists build_release || abort "function 'build_release()' not defined"
[[ -x ${VALIDATION_TESTS} ]] || abort "test script '${VALIDATION_TESTS}' doesn't exist"
parse_flags $@
parse_flags "$@"
# Log what will be done and where.
banner "Release configuration"
if which gcloud &>/dev/null ; then
@ -498,7 +516,9 @@ function main() {
echo "- Artifacts WILL NOT be tagged"
fi
if (( PUBLISH_RELEASE )); then
echo "- Release WILL BE published to '${RELEASE_GCS_BUCKET}'"
local dst="${RELEASE_DIR}"
[[ -z "${dst}" ]] && dst="${RELEASE_GCS_BUCKET}"
echo "- Release WILL BE published to '${dst}'"
else
echo "- Release will not be published"
fi
@ -527,8 +547,6 @@ function main() {
build_from_source
set +e +o pipefail
fi
# TODO(adrcunha): Remove once all repos use ARTIFACTS_TO_PUBLISH.
[[ -z "${ARTIFACTS_TO_PUBLISH}" ]] && ARTIFACTS_TO_PUBLISH="${YAMLS_TO_PUBLISH}"
[[ -z "${ARTIFACTS_TO_PUBLISH}" ]] && abort "no artifacts were generated"
# Ensure no empty file will be published.
for artifact in ${ARTIFACTS_TO_PUBLISH}; do