Fix CI issue by pulling download-istio.sh (#3182)

This commit is contained in:
Kenjiro Nakayama 2021-01-28 10:35:31 +09:00 committed by GitHub
parent 0f715413db
commit 8a4b4e8988
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 106 additions and 49 deletions

4
go.mod
View File

@ -17,8 +17,8 @@ require (
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/go-playground/webhooks.v3 v3.13.0 gopkg.in/go-playground/webhooks.v3 v3.13.0
gopkg.in/yaml.v2 v2.3.0 gopkg.in/yaml.v2 v2.3.0
knative.dev/hack v0.0.0-20210114150620-4422dcadb3c8 knative.dev/hack v0.0.0-20210120165453-8d623a0af457
knative.dev/net-istio v0.20.1-0.20210114170820-b4b1c95dc264 knative.dev/net-istio v0.20.1-0.20210121182253-79a9f7f6a067
) )
replace go.opencensus.io => go.opencensus.io v0.20.2 replace go.opencensus.io => go.opencensus.io v0.20.2

14
go.sum
View File

@ -1070,15 +1070,15 @@ k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C
k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29/go.mod h1:F+5wygcW0wmRTnM3cOgIqGivxkwSWIWT5YdsDbeAOaU= k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29/go.mod h1:F+5wygcW0wmRTnM3cOgIqGivxkwSWIWT5YdsDbeAOaU=
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20200603063816-c1c6865ac451/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
knative.dev/hack v0.0.0-20201214230143-4ed1ecb8db24 h1:kIztWfvnIFV8Lhlea02K3YO2mIzcDyQNzrBLn0Oq9sA=
knative.dev/hack v0.0.0-20201214230143-4ed1ecb8db24/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/hack v0.0.0-20210112093330-d946d2557383/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/hack v0.0.0-20210114150620-4422dcadb3c8 h1:N/Kt6C5zZzTtFcTntRThB+vEJ7WcLKaZ5Q2Jm7b23vw= knative.dev/hack v0.0.0-20210114150620-4422dcadb3c8 h1:N/Kt6C5zZzTtFcTntRThB+vEJ7WcLKaZ5Q2Jm7b23vw=
knative.dev/hack v0.0.0-20210114150620-4422dcadb3c8/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= knative.dev/hack v0.0.0-20210114150620-4422dcadb3c8/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/net-istio v0.20.1-0.20210114170820-b4b1c95dc264 h1:mcYdahUgJLQ8ThJL5TVEoh77uMvQ1I00LN3TMzof0rU= knative.dev/hack v0.0.0-20210120165453-8d623a0af457 h1:jEBITgx/lQydGncM0uetpv/ZqawRzb2aSfEaYoMeDjM=
knative.dev/net-istio v0.20.1-0.20210114170820-b4b1c95dc264/go.mod h1:Lum3PhFU7JweJQ1+sGka04/vphohTDhYRYqa3CfrYLU= knative.dev/hack v0.0.0-20210120165453-8d623a0af457/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/networking v0.0.0-20210113172032-07a8160d1971/go.mod h1:lAll0+JcN2iKex0P9hOXZ4siOdryW+HIuK4KBRM+ca4= knative.dev/net-istio v0.20.1-0.20210121182253-79a9f7f6a067 h1:y59Amw1hClEJOjnYVHtMx3iITHJxxu9VlPq+PTG1Y7U=
knative.dev/pkg v0.0.0-20210112143930-acbf2af596cf/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0= knative.dev/net-istio v0.20.1-0.20210121182253-79a9f7f6a067/go.mod h1:SnnQ05PEPAVUcgleQp9WfA/dtdEt/6er/JUHo1oEskw=
knative.dev/networking v0.0.0-20210121025453-4db00b8ae77a/go.mod h1:hVzeezXBzGbhKxNpG66/wNjDRiLwlWrVilunogWaKlo=
knative.dev/pkg v0.0.0-20210120200253-8cd47b5af35d/go.mod h1:cZdMjcJE6JGSNaEypgbUigX1TjteMIwQsW2woNBPVCA=
knative.dev/pkg v0.0.0-20210121025054-992644aa1905/go.mod h1:cZdMjcJE6JGSNaEypgbUigX1TjteMIwQsW2woNBPVCA=
pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU= pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=

View File

@ -22,5 +22,6 @@ import (
_ "knative.dev/hack" _ "knative.dev/hack"
// For istio installation // For istio installation
_ "knative.dev/net-istio/third_party"
_ "knative.dev/net-istio/third_party/istio-stable" _ "knative.dev/net-istio/third_party/istio-stable"
) )

View File

@ -794,11 +794,32 @@ function shellcheck_new_files() {
} }
function latest_version() { function latest_version() {
local semver=$(git describe --match "v[0-9]*" --abbrev=0) # This function works "best effort" and works on Prow but not necessarily locally.
local major_minor=$(echo "$semver" | cut -d. -f1-2) # The problem is finding the latest release. If a release occurs on the same commit which
# was branched from master, then the tag will be an ancestor to any commit derived from master.
# That was the original logic. Additionally in a release branch, the tag is always an ancestor.
# However, if the release commit ends up not the first commit from master, then the tag is not
# an ancestor of master, so we can't use `git describe` to find the most recent versioned tag. So
# we just sort all the tags and find the newest versioned one.
# But when running locally, we cannot(?) know if the current branch is a fork of master or a fork
# of a release branch. That's where this function will malfunction when the last release did not
# occur on the first commit -- it will try to run the upgrade tests from an older version instead
# of the most recent release.
# Workarounds include:
# Tag the first commit of the release branch. Say release-0.75 released v0.75.0 from the second commit
# Then tag the first commit in common between master and release-0.75 with `v0.75`.
# Always name your local fork master or main.
if [ $(current_branch) = "master" ] || [ $(current_branch) = "main" ]; then
# For main branch, simply use git tag without major version, this will work even
# if the release tag is not in the main
git tag -l "v[0-9]*" | sort -r --version-sort | head -n1
else
local semver=$(git describe --match "v[0-9]*" --abbrev=0)
local major_minor=$(echo "$semver" | cut -d. -f1-2)
# Get the latest patch release for the major minor # Get the latest patch release for the major minor
git tag -l "${major_minor}*" | sort -r --version-sort | head -n1 git tag -l "${major_minor}*" | sort -r --version-sort | head -n1
fi
} }
# Initializations that depend on previous functions. # Initializations that depend on previous functions.

View File

@ -0,0 +1,48 @@
#!/usr/bin/env bash
# Copyright 2021 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.
# See the License for the specific language governing permissions and
# limitations under the License.
function download_istio() {
# Find the right arch so we can download the correct istioctl version
case "${OSTYPE}" in
darwin*) ARCH=osx ;;
linux*) ARCH=linux-amd64 ;;
msys*) ARCH=win ;;
*) echo "** unknown OS '${OSTYPE}'" ; exit 1 ;;
esac
# Download and unpack Istio
ISTIO_VERSION=$1
ISTIO_TARBALL=istio-${ISTIO_VERSION}-${ARCH}.tar.gz
DOWNLOAD_URL=https://github.com/istio/istio/releases/download/${ISTIO_VERSION}/${ISTIO_TARBALL}
SYSTEM_NAMESPACE="${SYSTEM_NAMESPACE:-"knative-serving"}"
ISTIO_TMP=$(mktemp -d)
pushd $ISTIO_TMP
wget --no-check-certificate $DOWNLOAD_URL
if [ $? != 0 ]; then
echo "Failed to download Istio release: $DOWNLOAD_URL"
exit 1
fi
tar xzf ${ISTIO_TARBALL}
ISTIO_DIR="${ISTIO_TMP}/istio-${ISTIO_VERSION}"
echo "Istio was downloaded to ${ISTIO_TMP}"
popd
}
function cleanup_istio() {
echo "Deleting $ISTIO_TMP"
rm -rf $ISTIO_TMP
}

View File

@ -14,45 +14,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# Find the right arch so we can download the correct istioctl version source $(dirname $0)/../download-istio.sh
case "${OSTYPE}" in
darwin*) ARCH=osx ;;
linux*) ARCH=linux-amd64 ;;
msys*) ARCH=win ;;
*) echo "** unknown OS '${OSTYPE}'" ; exit 1 ;;
esac
# Download and unpack Istio # Download Istio
ISTIO_VERSION=1.7.6 download_istio 1.7.6
ISTIO_TARBALL=istio-${ISTIO_VERSION}-${ARCH}.tar.gz trap cleanup_istio EXIT
DOWNLOAD_URL=https://github.com/istio/istio/releases/download/${ISTIO_VERSION}/${ISTIO_TARBALL}
SYSTEM_NAMESPACE="${SYSTEM_NAMESPACE:-"knative-serving"}"
wget --no-check-certificate $DOWNLOAD_URL
if [ $? != 0 ]; then
echo "Failed to download Istio package"
exit 1
fi
tar xzf ${ISTIO_TARBALL}
# Install Istio # Install Istio
./istio-${ISTIO_VERSION}/bin/istioctl install -f "$(dirname $0)/$1" ${ISTIO_DIR}/bin/istioctl install -f "$(dirname $0)/$1"
# Enable mTLS STRICT in mesh mode # Enable mTLS STRICT in mesh mode
if [[ $MESH -eq 1 ]]; then if [[ $MESH -eq 1 ]]; then
kubectl apply -f "$(dirname $0)/extra/global-mtls.yaml" kubectl apply -f "$(dirname $0)/extra/global-mtls.yaml"
fi fi
# Clean up
rm -rf istio-${ISTIO_VERSION}
rm ${ISTIO_TARBALL}
## Add in the `istio-system` namespace to reduce number of commands.
#patch istio-crds.yaml namespace.yaml.patch
#patch istio-ci-mesh.yaml namespace.yaml.patch
#patch istio-ci-no-mesh.yaml namespace.yaml.patch
#patch istio-minimal.yaml namespace.yaml.patch
#
## Increase termination drain duration seconds.
#patch -l istio-ci-mesh.yaml drain-seconds.yaml.patch

View File

@ -0,0 +1,15 @@
/*
Copyright 2020 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
https://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.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package config exists to make the config directory importable.
package config

5
vendor/modules.txt vendored
View File

@ -268,10 +268,11 @@ gopkg.in/go-playground/webhooks.v3/github
# gopkg.in/yaml.v2 v2.3.0 # gopkg.in/yaml.v2 v2.3.0
## explicit ## explicit
gopkg.in/yaml.v2 gopkg.in/yaml.v2
# knative.dev/hack v0.0.0-20210114150620-4422dcadb3c8 # knative.dev/hack v0.0.0-20210120165453-8d623a0af457
## explicit ## explicit
knative.dev/hack knative.dev/hack
# knative.dev/net-istio v0.20.1-0.20210114170820-b4b1c95dc264 # knative.dev/net-istio v0.20.1-0.20210121182253-79a9f7f6a067
## explicit ## explicit
knative.dev/net-istio/third_party
knative.dev/net-istio/third_party/istio-stable knative.dev/net-istio/third_party/istio-stable
# go.opencensus.io => go.opencensus.io v0.20.2 # go.opencensus.io => go.opencensus.io v0.20.2