Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix release script #23

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 41 additions & 9 deletions hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,49 @@

source $(dirname $0)/../vendor/knative.dev/hack/release.sh

# Yaml files to generate, and the source config dir for them.
declare -A COMPONENTS
COMPONENTS=(
["autoscaler-keda.yaml"]="config"
)
readonly COMPONENTS

declare -A RELEASES
RELEASES=(
["release.yaml"]="autoscaler-keda.yaml"
)
readonly RELEASES

function build_release() {
# Run `generate-yamls.sh`, which should be versioned with the
# branch since the detail of building may change over time.
local YAML_LIST="$(mktemp)"
export TAG
$(dirname $0)/generate-yamls.sh "${REPO_ROOT_DIR}" "${YAML_LIST}"
ARTIFACTS_TO_PUBLISH=$(cat "${YAML_LIST}" | tr '\n' ' ')
if (( ! PUBLISH_RELEASE )); then
# Copy the generated YAML files to the repo root dir if not publishing.
cp ${ARTIFACTS_TO_PUBLISH} ${REPO_ROOT_DIR}
# Update release labels if this is a tagged release
if [[ -n "${TAG}" ]]; then
echo "Tagged release, updating release labels to app.kubernetes.io/version: \"${TAG}\""
LABEL_YAML_CMD=(sed -e "s|app.kubernetes.io/version: devel|app.kubernetes.io/version: \"${TAG:1}\"|")
else
echo "Untagged release, will NOT update release labels"
LABEL_YAML_CMD=(cat)
fi

# Build the components
local all_yamls=()
for yaml in "${!COMPONENTS[@]}"; do
local config="${COMPONENTS[${yaml}]}"
echo "Building Knative autoscaler-keda - ${config}"
ko resolve ${KO_FLAGS} -f ${config}/ | "${LABEL_YAML_CMD[@]}" > ${yaml}
all_yamls+=(${yaml})
done
# Assemble the release
for yaml in "${!RELEASES[@]}"; do
echo "Assembling Knative autoscaler-keda - ${yaml}"
echo "" > ${yaml}
for component in ${RELEASES[${yaml}]}; do
echo "---" >> ${yaml}
echo "# ${component}" >> ${yaml}
cat ${component} >> ${yaml}
done
all_yamls+=(${yaml})
done
ARTIFACTS_TO_PUBLISH="${all_yamls[@]}"
}

main $@
11 changes: 4 additions & 7 deletions test/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ KEDA_NS="keda"
initialize --num-nodes=4 --cluster-version=1.28 "$@"

git clone https://github.com/knative/serving.git "serving"
cd serving
pushd serving
rm ./test/config/chaosduck/chaosduck.yaml

# Disable HPA manifests
Expand All @@ -45,6 +45,7 @@ knative_setup

echo ">> Uploading test images..."
ko resolve --jobs=4 -RBf ./test/test_images/autoscale > /dev/null
popd

# Setup Helm - TODO move to the infra image

Expand All @@ -70,24 +71,20 @@ kubectl wait deployment.apps/keda-operator -n "${KEDA_NS}" --for condition=avail
kubectl wait deployment.apps/keda-operator-metrics-apiserver -n "${KEDA_NS}" --for condition=available --timeout=600s

#Setup Autoscaler KEDA
cd ..
ko resolve -f ./config | sed "s/namespace: knative-serving/namespace: ${SYSTEM_NAMESPACE}/" | kubectl apply -f-

# Wait for the Autoscaler KEDA deployment to be available
kubectl wait deployments.apps/autoscaler-keda -n "${SYSTEM_NAMESPACE}" --for condition=available --timeout=600s

pushd serving
# Run the HPA tests
header "Running HPA tests"
cd serving

# Needed for HPA Mem test, see https://keda.sh/docs/2.14/scalers/memory/#prerequisites
toggle_feature queueproxy.resource-defaults "enabled" config-features
go_test_e2e -timeout=30m -tags=hpa ./test/e2e "${E2E_TEST_FLAGS[@]}" || failed=1

(( failed )) && fail_test

# Remove the kail log file if the test flow passes.
# This is for preventing too many large log files to be uploaded to GCS in CI.
rm "${ARTIFACTS}/k8s.log-$(basename "${E2E_SCRIPT}").txt"

popd
success
Loading