Skip to content

Commit

Permalink
Fix reviewdog
Browse files Browse the repository at this point in the history
  • Loading branch information
houshengbo committed Apr 28, 2023
1 parent 61724b5 commit 13d9cfb
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ readonly PREVIOUS_EVENTING_RELEASE_VERSION="1.10"
readonly TARGET_RELEASE_VERSION="latest"
# This is the branch name of knative repos, where we run the upgrade tests.
readonly KNATIVE_REPO_BRANCH="${PULL_BASE_REF}"
export KNATIVE_REPO_BRANCH
# Namespaces used for tests
# This environment variable TEST_NAMESPACE defines the namespace to install Knative Serving.
export TEST_NAMESPACE="${TEST_NAMESPACE:-knative-operator-testing}"
Expand All @@ -40,12 +41,12 @@ export KO_FLAGS="${KO_FLAGS:-}"
export INGRESS_CLASS=${INGRESS_CLASS:-istio.ingress.networking.knative.dev}

# Boolean used to indicate whether to generate serving YAML based on the latest code in the branch KNATIVE_SERVING_REPO_BRANCH.
GENERATE_SERVING_YAML=0
export GENERATE_SERVING_YAML=0

readonly OPERATOR_DIR="$(dirname "${BASH_SOURCE[0]}")/.."
readonly KNATIVE_DIR=$(dirname "${OPERATOR_DIR}")
release_yaml="$(mktemp)"
release_eventing_yaml="$(mktemp)"
readonly OPERATOR_DIR
OPERATOR_DIR="$(dirname "${BASH_SOURCE[0]}")/.."
readonly KNATIVE_DIR
KNATIVE_DIR="$(dirname "${OPERATOR_DIR}")"

readonly SERVING_ARTIFACTS=("serving" "serving-crds.yaml" "serving-core.yaml" "serving-hpa.yaml" "serving-post-install-jobs.yaml")
readonly EVENTING_ARTIFACTS=("eventing" "eventing-crds.yaml" "eventing-core.yaml" "in-memory-channel.yaml" "mt-channel-broker.yaml"
Expand All @@ -61,11 +62,12 @@ function is_ingress_class() {
function add_trap() {
local cmd=$1
shift
for trap_signal in $@; do
local current_trap="$(trap -p "$trap_signal" | cut -d\' -f2)"
for trap_signal in "$@"; do
local current_trap
current_trap="$(trap -p "$trap_signal" | cut -d\' -f2)"
local new_cmd="($cmd)"
[[ -n "${current_trap}" ]] && new_cmd="${current_trap};${new_cmd}"
trap -- "${new_cmd}" "$trap_signal"
trap -- "${new_cmd}" "${trap_signal}"
done
}

Expand All @@ -80,7 +82,7 @@ function test_setup_logging() {
fi

# Capture all logs.
kail > "${ARTIFACTS}"/k8s.log-$(basename "${E2E_SCRIPT}").txt &
kail >"${ARTIFACTS}"/k8s.log-"$(basename "${E2E_SCRIPT}")".txt &
local kail_pid=$!
# Clean up kail so it doesn't interfere with job shutting down
add_trap "kill $kail_pid || true" EXIT
Expand Down Expand Up @@ -136,19 +138,18 @@ function download_latest_release() {
function download_nightly_artifacts() {
array=("$@")
component=${array[0]}
unset array[0]
unset "array[0]"
counter=0
linkprefix="https://storage.googleapis.com/knative-nightly/${component}/latest"
version_exists=$(if_version_exists ${TARGET_RELEASE_VERSION} "knative-${component}")
if [ "${version_exists}" == "no" ]; then
header "Download the nightly build as the target version for Knative ${component}"
knative_version_dir=${OPERATOR_DIR}/cmd/operator/kodata/knative-${component}/${TARGET_RELEASE_VERSION}
mkdir "${knative_version_dir}"
for artifact in "${array[@]}";
do
((counter=counter+1))
wget "${linkprefix}"/"${artifact}" -O "${knative_version_dir}"/${counter}-"${artifact}"
done
for artifact in "${array[@]}"; do
((counter=counter+1))
wget "${linkprefix}"/"${artifact}" -O "${knative_version_dir}"/${counter}-"${artifact}"
done
if [ "${component}" == "serving" ]; then
# Download the latest net-istio into the ingress directory.
ingress_version_dir=${OPERATOR_DIR}/cmd/operator/kodata/ingress/${TARGET_RELEASE_VERSION}/istio
Expand Down

0 comments on commit 13d9cfb

Please sign in to comment.