Skip to content

Keep the number of ReplicaSets to a minimum #9771

Keep the number of ReplicaSets to a minimum

Keep the number of ReplicaSets to a minimum #9771

Workflow file for this run

name: e2e
on:
pull_request:
branches: [ 'main', 'release-*' ]
defaults:
run:
shell: bash
env:
# https://github.com/google/go-containerregistry/pull/125 allows insecure registry for
# '*.local' hostnames. This works both for `ko` and our own tag-to-digest resolution logic,
# thus allowing us to test without bypassing tag-to-digest resolution.
CLUSTER_DOMAIN: c${{ github.run_id }}.local
REGISTRY_NAME: registry.local
REGISTRY_PORT: 5000
KO_DOCKER_REPO: registry.local:5000/knative
GOTESTSUM_VERSION: 1.11.0
KO_FLAGS: --platform=linux/amd64
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup-go
uses: knative/actions/setup-go@main
- name: Setup Cache Directories
run: |
mkdir -p ~/artifacts/build
mkdir -p ~/artifacts/registry
- uses: actions/cache@v4
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]
- 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
./hack/generate-yamls.sh "$GITHUB_WORKSPACE" "$(mktemp)" $YAML_OUTPUT_DIR/env
- name: Build Test Images
run: |
./test/upload-test-images.sh
- uses: actions/upload-artifact@v4
with:
name: artifacts
path: ~/artifacts
retention-days: 1
test:
name: test
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
k8s-version:
- v1.28.x
- v1.29.x
ingress:
- kourier
- kourier-tls
- istio
- istio-tls
# Disabled due to flakiness: https://github.com/knative/serving/issues/14637
# - istio-ambient
- contour
- gateway_istio
- gateway_contour
test-suite:
- runtime
- api
- e2e
include:
- ingress: gateway_istio
ingress-class: gateway-api
test-flags: -enable-alpha -enable-beta
namespace-resources: httproute
- ingress: gateway_contour
ingress-class: gateway-api
gateway-api-implementation: contour
test-flags: -enable-alpha -enable-beta
namespace-resources: httproute
- ingress: contour
namespace-resources: httpproxy
- ingress: istio
namespace-resources: virtualservices
- ingress: istio-tls
ingress-class: istio
namespace-resources: virtualservices
enable-tls: 1
# Disabled due to flakiness: https://github.com/knative/serving/issues/14637
# - ingress: istio-ambient
# namespace-resources: virtualservices
# ingress-class: istio
# ambient: 1
- ingress: kourier-tls
ingress-class: kourier
enable-tls: 1
- test-suite: runtime
test-path: ./test/conformance/runtime/...
- test-suite: api
test-path: ./test/conformance/api/...
- test-suite: e2e
test-path: ./test/e2e
env:
KIND: 1
INGRESS_CLASS: ${{ matrix.ingress-class || matrix.ingress }}.ingress.networking.knative.dev
GATEWAY_API_IMPLEMENTATION: ${{ matrix.gateway-api-implementation }}
ENABLE_TLS: ${{ matrix.enable-tls || 0 }}
# Disabled due to flakiness: https://github.com/knative/serving/issues/14637
# AMBIENT: ${{ matrix.ambient || 0 }}
steps:
- name: setup-go
uses: knative/actions/setup-go@main
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/download-artifact@v4
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::"
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Serving & Ingress
run: |
set -x
# 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
- name: Test ${{ matrix.test-suite }}
run: |
gotestsum --format testname -- \
-race -count=1 -parallel=1 -tags=e2e \
-timeout=30m \
${{ matrix.test-path }} \
-skip-cleanup-on-fail \
-disable-logstream \
-enable-alpha -enable-beta \
--ingress-class=${{ matrix.ingress-class || matrix.ingress }}.ingress.networking.knative.dev \
${{ matrix.test-flags }}
- 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 }}