generated from knative-extensions/sample-controller
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release-1.14] Make the branch configurable for Serving
- Loading branch information
1 parent
a37e5e5
commit 7b40b37
Showing
1 changed file
with
184 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ env: | |
YTT_VERSION: 0.40.1 | ||
KO_FLAGS: --platform=linux/amd64 | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
KNATIVE_SERVING_BRANCH: release-1.14 | ||
KNATIVE_DIR: /home/runner/work/serving-progressive-rollout | ||
KNATIVE_SERVING_DIR: /home/runner/work/serving-progressive-rollout/serving | ||
|
||
|
@@ -43,69 +44,69 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: setup-go | ||
uses: knative/actions/setup-go@main | ||
|
||
- name: Setup Cache Directories | ||
run: | | ||
mkdir -p ~/artifacts/build | ||
mkdir -p ~/artifacts/build-extension | ||
mkdir -p ~/artifacts/registry | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
# Install the latest release of ko | ||
- name: Install ko | ||
uses: ko-build/[email protected] | ||
|
||
# Download the latest source code of Knative Serving | ||
- name: Download Knative Serving | ||
run: | | ||
cd ${KNATIVE_DIR} | ||
git clone https://github.com/knative/serving.git "serving" | ||
- name: Setup Registry | ||
run: | | ||
docker run -d --restart=always \ | ||
-p $REGISTRY_PORT:$REGISTRY_PORT \ | ||
-v ~/artifacts/registry:/var/lib/registry \ | ||
--name $REGISTRY_NAME registry:2 | ||
# Make the $REGISTRY_NAME -> 127.0.0.1, to tell `ko` to publish to | ||
# local reigstry, even when pushing $REGISTRY_NAME:$REGISTRY_PORT/some/image | ||
sudo echo "127.0.0.1 $REGISTRY_NAME" | sudo tee -a /etc/hosts | ||
- name: Build Knative | ||
run: | | ||
export YAML_OUTPUT_DIR=$HOME/artifacts/build | ||
cd ${KNATIVE_SERVING_DIR} | ||
./hack/generate-yamls.sh "${KNATIVE_SERVING_DIR}" "$(mktemp)" $YAML_OUTPUT_DIR/env | ||
- name: Build Knative Extension | ||
run: | | ||
export YAML_OUTPUT_DIR=$HOME/artifacts/build-extension | ||
ko resolve -f config/core/deployments/autoscaler.yaml --image-refs $YAML_OUTPUT_DIR/autoscaler | ||
ko resolve -f config/core/deployments/controller.yaml --image-refs $YAML_OUTPUT_DIR/controller | ||
- name: Build Test Images | ||
run: | | ||
cd ${KNATIVE_SERVING_DIR} | ||
./test/upload-test-images.sh | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifacts | ||
path: ~/artifacts | ||
retention-days: 1 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: setup-go | ||
uses: knative/actions/setup-go@main | ||
|
||
- name: Setup Cache Directories | ||
run: | | ||
mkdir -p ~/artifacts/build | ||
mkdir -p ~/artifacts/build-extension | ||
mkdir -p ~/artifacts/registry | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
# Install the latest release of ko | ||
- name: Install ko | ||
uses: ko-build/[email protected] | ||
|
||
# Download the latest source code of Knative Serving | ||
- name: Download Knative Serving | ||
run: | | ||
cd ${KNATIVE_DIR} | ||
git clone -b ${KNATIVE_SERVING_BRANCH} --single-branch https://github.com/knative/serving.git | ||
- name: Setup Registry | ||
run: | | ||
docker run -d --restart=always \ | ||
-p $REGISTRY_PORT:$REGISTRY_PORT \ | ||
-v ~/artifacts/registry:/var/lib/registry \ | ||
--name $REGISTRY_NAME registry:2 | ||
# Make the $REGISTRY_NAME -> 127.0.0.1, to tell `ko` to publish to | ||
# local reigstry, even when pushing $REGISTRY_NAME:$REGISTRY_PORT/some/image | ||
sudo echo "127.0.0.1 $REGISTRY_NAME" | sudo tee -a /etc/hosts | ||
- name: Build Knative | ||
run: | | ||
export YAML_OUTPUT_DIR=$HOME/artifacts/build | ||
cd ${KNATIVE_SERVING_DIR} | ||
./hack/generate-yamls.sh "${KNATIVE_SERVING_DIR}" "$(mktemp)" $YAML_OUTPUT_DIR/env | ||
- name: Build Knative Extension | ||
run: | | ||
export YAML_OUTPUT_DIR=$HOME/artifacts/build-extension | ||
ko resolve -f config/core/deployments/autoscaler.yaml --image-refs $YAML_OUTPUT_DIR/autoscaler | ||
ko resolve -f config/core/deployments/controller.yaml --image-refs $YAML_OUTPUT_DIR/controller | ||
- name: Build Test Images | ||
run: | | ||
cd ${KNATIVE_SERVING_DIR} | ||
./test/upload-test-images.sh | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifacts | ||
path: ~/artifacts | ||
retention-days: 1 | ||
|
||
test: | ||
name: test | ||
|
@@ -115,138 +116,138 @@ jobs: | |
fail-fast: false # Keep running if one leg fails. | ||
matrix: | ||
k8s-version: | ||
- v1.28.x | ||
- v1.28.x | ||
|
||
ingress: | ||
- istio | ||
- istio | ||
|
||
test-suite: | ||
- runtime | ||
- api | ||
- e2e | ||
- runtime | ||
- api | ||
- e2e | ||
|
||
include: | ||
- ingress: istio | ||
ingress-class: istio | ||
namespace-resources: virtualservices | ||
- ingress: istio | ||
ingress-class: istio | ||
namespace-resources: virtualservices | ||
|
||
- test-suite: runtime | ||
test-path: ./test/conformance/runtime/... | ||
- test-suite: runtime | ||
test-path: ./test/conformance/runtime/... | ||
|
||
- test-suite: api | ||
test-path: ./test/conformance/api/... | ||
- test-suite: api | ||
test-path: ./test/conformance/api/... | ||
|
||
- test-suite: e2e | ||
test-path: ./test/e2e | ||
- test-suite: e2e | ||
test-path: ./test/e2e | ||
|
||
env: | ||
KIND: 1 | ||
INGRESS_CLASS: ${{ matrix.ingress-class || matrix.ingress }}.ingress.networking.knative.dev | ||
|
||
steps: | ||
- name: setup-go | ||
uses: knative/actions/setup-go@main | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifacts | ||
path: ~/artifacts | ||
|
||
- name: Setup kind | ||
uses: chainguard-dev/actions/setup-kind@main | ||
with: | ||
k8s-version: ${{ matrix.k8s-version }} | ||
kind-worker-count: 4 | ||
cluster-suffix: c${{ github.run_id }}.local | ||
registry-volume: $HOME/artifacts/registry | ||
|
||
- name: Install Dependencies | ||
run: | | ||
set -x | ||
echo "::group:: install gotestsum ${GOTESTSUM_VERSION}" | ||
curl -L https://github.com/gotestyourself/gotestsum/releases/download/v${GOTESTSUM_VERSION}/gotestsum_${GOTESTSUM_VERSION}_linux_amd64.tar.gz | tar xzf - gotestsum | ||
chmod +x ./gotestsum | ||
sudo mv gotestsum /usr/local/bin | ||
echo "::endgroup::" | ||
echo "::group:: install kapp ${KAPP_VERSION}" | ||
curl -Lo ./kapp https://github.com/vmware-tanzu/carvel-kapp/releases/download/v${KAPP_VERSION}/kapp-linux-amd64 | ||
chmod +x ./kapp | ||
sudo mv kapp /usr/local/bin | ||
echo "::endgroup::" | ||
echo "::group:: install ytt ${YTT_VERSION}" | ||
curl -Lo ./ytt https://github.com/vmware-tanzu/carvel-ytt/releases/download/v${YTT_VERSION}/ytt-linux-amd64 | ||
chmod +x ./ytt | ||
sudo mv ytt /usr/local/bin | ||
echo "::endgroup::" | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# Download the latest source code of Knative Serving | ||
- name: Download Knative Serving | ||
run: | | ||
cd ${KNATIVE_DIR} | ||
git clone https://github.com/knative/serving.git "serving" | ||
- name: Install Serving & Ingress | ||
run: | | ||
set -x | ||
cd ${KNATIVE_SERVING_DIR} | ||
# Remove chaosduck since we don't use it and it'll skip the build | ||
rm ./test/config/chaosduck/chaosduck.yaml | ||
source ./test/e2e-common.sh | ||
export INSTALL_CUSTOM_YAMLS=$HOME/artifacts/build/env | ||
knative_setup | ||
# Run the tests tagged as e2e on the KinD cluster. | ||
echo "SYSTEM_NAMESPACE=$SYSTEM_NAMESPACE" >> $GITHUB_ENV | ||
echo "GATEWAY_OVERRIDE=$GATEWAY_OVERRIDE" >> $GITHUB_ENV | ||
echo "GATEWAY_NAMESPACE_OVERRIDE=$GATEWAY_NAMESPACE_OVERRIDE" >> $GITHUB_ENV | ||
echo "CA_CERT=$CA_CERT" >> $GITHUB_ENV | ||
echo "SERVER_NAME=$SERVER_NAME" >> $GITHUB_ENV | ||
# Install the CRDs of the serving-progressive-rollout | ||
cd ${KNATIVE_DIR}/serving-progressive-rollout | ||
kubectl apply -f config/core/300-resources | ||
# Install the ConfigMap | ||
sed -i "s/namespace: knative-serving/namespace: $SYSTEM_NAMESPACE/" config/core/configmaps/config-rolloutorchestrator.yaml | ||
kubectl apply -f config/core/configmaps/config-rolloutorchestrator.yaml | ||
# Replace the images of the controller and the autoscaler with the ones built from the extension | ||
export CONTROLLER_IMAGE=$(cat $HOME/artifacts/build-extension/controller | tr -d ' \t\n\r') | ||
export AUTOSCALER_IMAGE=$(cat $HOME/artifacts/build-extension/autoscaler | tr -d ' \t\n\r') | ||
kubectl patch deployment autoscaler -n $SYSTEM_NAMESPACE -p '{"spec":{"template":{"spec":{"containers":[{"name":"autoscaler","image":"'$AUTOSCALER_IMAGE'"}]}}}}' | ||
kubectl patch deployment controller -n $SYSTEM_NAMESPACE -p '{"spec":{"template":{"spec":{"containers":[{"name":"controller","image":"'$CONTROLLER_IMAGE'"}]}}}}' | ||
- name: Test ${{ matrix.test-suite }} | ||
run: | | ||
cd ${KNATIVE_SERVING_DIR} | ||
gotestsum --format testname -- \ | ||
-race -count=1 -parallel=1 -tags=e2e \ | ||
-timeout=30m \ | ||
${{ matrix.test-path }} \ | ||
-skip-cleanup-on-fail \ | ||
-enable-alpha -enable-beta \ | ||
--ingress-class=${{ matrix.ingress-class || matrix.ingress }}.ingress.networking.knative.dev | ||
- uses: chainguard-dev/actions/kind-diag@main | ||
# Only upload logs on failure. | ||
if: ${{ failure() }} | ||
with: | ||
cluster-resources: nodes,namespaces,crds | ||
namespace-resources: configmaps,pods,svc,ksvc,route,configuration,revision,king,${{ matrix.namespace-resources || '' }} | ||
artifact-name: logs-${{ matrix.k8s-version}}-${{ matrix.ingress }}-${{ matrix.test-suite }} | ||
- name: setup-go | ||
uses: knative/actions/setup-go@main | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifacts | ||
path: ~/artifacts | ||
|
||
- name: Setup kind | ||
uses: chainguard-dev/actions/setup-kind@main | ||
with: | ||
k8s-version: ${{ matrix.k8s-version }} | ||
kind-worker-count: 4 | ||
cluster-suffix: c${{ github.run_id }}.local | ||
registry-volume: $HOME/artifacts/registry | ||
|
||
- name: Install Dependencies | ||
run: | | ||
set -x | ||
echo "::group:: install gotestsum ${GOTESTSUM_VERSION}" | ||
curl -L https://github.com/gotestyourself/gotestsum/releases/download/v${GOTESTSUM_VERSION}/gotestsum_${GOTESTSUM_VERSION}_linux_amd64.tar.gz | tar xzf - gotestsum | ||
chmod +x ./gotestsum | ||
sudo mv gotestsum /usr/local/bin | ||
echo "::endgroup::" | ||
echo "::group:: install kapp ${KAPP_VERSION}" | ||
curl -Lo ./kapp https://github.com/vmware-tanzu/carvel-kapp/releases/download/v${KAPP_VERSION}/kapp-linux-amd64 | ||
chmod +x ./kapp | ||
sudo mv kapp /usr/local/bin | ||
echo "::endgroup::" | ||
echo "::group:: install ytt ${YTT_VERSION}" | ||
curl -Lo ./ytt https://github.com/vmware-tanzu/carvel-ytt/releases/download/v${YTT_VERSION}/ytt-linux-amd64 | ||
chmod +x ./ytt | ||
sudo mv ytt /usr/local/bin | ||
echo "::endgroup::" | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# Download the latest source code of Knative Serving | ||
- name: Download Knative Serving | ||
run: | | ||
cd ${KNATIVE_DIR} | ||
git clone https://github.com/knative/serving.git "serving" | ||
- name: Install Serving & Ingress | ||
run: | | ||
set -x | ||
cd ${KNATIVE_SERVING_DIR} | ||
# Remove chaosduck since we don't use it and it'll skip the build | ||
rm ./test/config/chaosduck/chaosduck.yaml | ||
source ./test/e2e-common.sh | ||
export INSTALL_CUSTOM_YAMLS=$HOME/artifacts/build/env | ||
knative_setup | ||
# Run the tests tagged as e2e on the KinD cluster. | ||
echo "SYSTEM_NAMESPACE=$SYSTEM_NAMESPACE" >> $GITHUB_ENV | ||
echo "GATEWAY_OVERRIDE=$GATEWAY_OVERRIDE" >> $GITHUB_ENV | ||
echo "GATEWAY_NAMESPACE_OVERRIDE=$GATEWAY_NAMESPACE_OVERRIDE" >> $GITHUB_ENV | ||
echo "CA_CERT=$CA_CERT" >> $GITHUB_ENV | ||
echo "SERVER_NAME=$SERVER_NAME" >> $GITHUB_ENV | ||
# Install the CRDs of the serving-progressive-rollout | ||
cd ${KNATIVE_DIR}/serving-progressive-rollout | ||
kubectl apply -f config/core/300-resources | ||
# Install the ConfigMap | ||
sed -i "s/namespace: knative-serving/namespace: $SYSTEM_NAMESPACE/" config/core/configmaps/config-rolloutorchestrator.yaml | ||
kubectl apply -f config/core/configmaps/config-rolloutorchestrator.yaml | ||
# Replace the images of the controller and the autoscaler with the ones built from the extension | ||
export CONTROLLER_IMAGE=$(cat $HOME/artifacts/build-extension/controller | tr -d ' \t\n\r') | ||
export AUTOSCALER_IMAGE=$(cat $HOME/artifacts/build-extension/autoscaler | tr -d ' \t\n\r') | ||
kubectl patch deployment autoscaler -n $SYSTEM_NAMESPACE -p '{"spec":{"template":{"spec":{"containers":[{"name":"autoscaler","image":"'$AUTOSCALER_IMAGE'"}]}}}}' | ||
kubectl patch deployment controller -n $SYSTEM_NAMESPACE -p '{"spec":{"template":{"spec":{"containers":[{"name":"controller","image":"'$CONTROLLER_IMAGE'"}]}}}}' | ||
- name: Test ${{ matrix.test-suite }} | ||
run: | | ||
cd ${KNATIVE_SERVING_DIR} | ||
gotestsum --format testname -- \ | ||
-race -count=1 -parallel=1 -tags=e2e \ | ||
-timeout=30m \ | ||
${{ matrix.test-path }} \ | ||
-skip-cleanup-on-fail \ | ||
-enable-alpha -enable-beta \ | ||
--ingress-class=${{ matrix.ingress-class || matrix.ingress }}.ingress.networking.knative.dev | ||
- uses: chainguard-dev/actions/kind-diag@main | ||
# Only upload logs on failure. | ||
if: ${{ failure() }} | ||
with: | ||
cluster-resources: nodes,namespaces,crds | ||
namespace-resources: configmaps,pods,svc,ksvc,route,configuration,revision,king,${{ matrix.namespace-resources || '' }} | ||
artifact-name: logs-${{ matrix.k8s-version}}-${{ matrix.ingress }}-${{ matrix.test-suite }} |