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

🌱 Run e2e tests always, de-duplicate hetzner-ci.yaml #1527

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion .github/actions/e2e/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ runs:
REGISTRY: ${{ env.REGISTRY }}
IMAGE_NAME: ${{ env.IMAGE_NAME }}
TAG: ${{ steps.meta.outputs.version }}
E2E_CONF_FILE_SOURCE: "${{ github.workspace }}/test/e2e/config/hetzner-ci.yaml"
MANIFEST_PATH: "../../../out"
HCLOUD_TOKEN: ${{ env.HCLOUD_TOKEN }}
HETZNER_ROBOT_USER: ${{ inputs.e2e_robot_user }}
Expand Down
13 changes: 2 additions & 11 deletions .github/workflows/pr-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,8 @@ on:
branches:
- main
- "releases/**"
paths:
- "**.go"
- "**go.mod"
- "**go.sum"
- "<templates|test>/**/*.<yml|yaml>"
- ".github/actions/**/*"
- ".github/workflows/e2e-*"
- ".github/workflows/pr-*"
- "images/caph/**"
- "!**/vendor/**"
- "test/e2e/**"
paths-ignore:
- "**/*.md"
env:
IMAGE_NAME: caph-staging
REGISTRY: ghcr.io/syself
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ config/samples

# test results
_artifacts
test/e2e/config/hetzner-ci-envsubst.yaml
test/e2e/config/hetzner.tmp.yaml
resp.json
**manifest.json

Expand Down
13 changes: 7 additions & 6 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ rules:
min-spaces-from-content: 1

yaml-files:
- '*.yaml'
- '*.yml'
- "*.yaml"
- "*.yml"

ignore:
- '**/vendor/**'
- '.cache'
- "**/vendor/**"
- ".cache"
- _artifacts
- tmp/**
- config/crd/**/*.yaml
- config/rbac/**/*.yaml
- config/webhook/**/*.yaml
- test/e2e/data/**/*.yaml
- test/e2e/config/hetzner-ci-envsubst.yaml
- baremetalhosts.yaml
- baremetalhosts.yaml
- test/e2e/config/hetzner.tmp.yaml
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ KUBEBUILDER_ASSETS ?= $(shell $(SETUP_ENVTEST) use --use-env --bin-dir $(abspath

E2E_DIR ?= $(ROOT_DIR)/test/e2e
E2E_CONF_FILE_SOURCE ?= $(E2E_DIR)/config/$(INFRA_PROVIDER).yaml
E2E_CONF_FILE ?= $(E2E_DIR)/config/$(INFRA_PROVIDER)-ci-envsubst.yaml
E2E_CONF_FILE ?= $(E2E_DIR)/config/$(INFRA_PROVIDER).tmp.yaml

.PHONY: test-unit
test-unit: $(SETUP_ENVTEST) $(GOTESTSUM) ## Run unit and integration tests
Expand All @@ -487,11 +487,11 @@ test-unit: $(SETUP_ENVTEST) $(GOTESTSUM) ## Run unit and integration tests
e2e-image: ## Build the e2e manager image
docker build --pull --build-arg ARCH=$(ARCH) --build-arg LDFLAGS="$(LDFLAGS)" -t $(IMAGE_PREFIX)/$(STAGING_IMAGE):e2e -f images/$(INFRA_SHORT)/Dockerfile .

.PHONY: $(E2E_CONF_FILE)
.PHONY: e2e-conf-file
e2e-conf-file: $(E2E_CONF_FILE)
$(E2E_CONF_FILE): $(ENVSUBST) $(E2E_CONF_FILE_SOURCE)
mkdir -p $(shell dirname $(E2E_CONF_FILE))
MANAGEMENT_CLUSTER_NAME="$(INFRA_SHORT)-e2e-$$(date +"%Y%m%d-%H%M%S")-$$USER" $(ENVSUBST) < $(E2E_CONF_FILE_SOURCE) > $(E2E_CONF_FILE)
$(E2E_CONF_FILE): $(ENVSUBST) $(E2E_CONF_FILE_SOURCE) ./hack/create-e2e-conf-file.sh
CAPH_LATEST_VERSION=$(CAPH_LATEST_VERSION) ENVSUBST=$(ENVSUBST) E2E_CONF_FILE_SOURCE=$(E2E_CONF_FILE_SOURCE) \
E2E_CONF_FILE=$(E2E_CONF_FILE) ./hack/create-e2e-conf-file.sh

.PHONY: test-e2e
test-e2e: $(E2E_CONF_FILE) $(if $(SKIP_IMAGE_BUILD),,e2e-image) $(ARTIFACTS)
Expand Down
29 changes: 29 additions & 0 deletions hack/create-e2e-conf-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Copyright 2022 The Kubernetes 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.

trap 'echo "ERROR: A command has failed. Exiting the script. Line was ($0:$LINENO): $(sed -n "${LINENO}p" "$0")"; exit 3' ERR
set -Eeuo pipefail

./hack/ensure-env-variables.sh CAPH_LATEST_VERSION ENVSUBST E2E_CONF_FILE_SOURCE E2E_CONF_FILE

# When called via CI, MANIFEST_PATH is already set. It points to the "out" directory
# created with the Github action "download-artifacts".
if [ -z "${MANIFEST_PATH:-}" ]; then
export MANIFEST_PATH="../../.."
fi

echo "# Created from $E2E_CONF_FILE_SOURCE by $0" >"$E2E_CONF_FILE"
$ENVSUBST <"$E2E_CONF_FILE_SOURCE" >>"$E2E_CONF_FILE"
80 changes: 40 additions & 40 deletions templates/cluster-templates/bases/kct-md-0-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,52 +53,52 @@ spec:
nameserver 1.0.0.1
nameserver 2606:4700:4700::1111
- content: |
# Copyright The containerd 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.
#
# https://raw.githubusercontent.com/containerd/containerd/main/containerd.service
# Copyright The containerd 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.
#
# https://raw.githubusercontent.com/containerd/containerd/main/containerd.service

[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target dbus.service
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target dbus.service

[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/containerd
[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/containerd

Type=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5
Type=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5

# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity

# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
OOMScoreAdjust=-999
# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
OOMScoreAdjust=-999

[Install]
WantedBy=multi-user.target
owner: root:root
path: /etc/systemd/system/containerd.service
permissions: "0744"
[Install]
WantedBy=multi-user.target
owner: root:root
path: /etc/systemd/system/containerd.service
permissions: "0744"
preKubeadmCommands:
- set -x
- grep VERSION= /etc/os-release; uname -a
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

.DEFAULT_GOAL:=help

SHELL = /usr/bin/env bash -o pipefail

REPO_ROOT := $(shell git rev-parse --show-toplevel)

help: ## Display this help
Expand Down Expand Up @@ -115,7 +117,7 @@ ARTIFACTS ?= $(ROOT_DIR)/_artifacts
SKIP_CLEANUP ?= false
SKIP_CREATE_MGMT_CLUSTER ?= false
E2E_DIR ?= $(REPO_ROOT)/test/e2e
E2E_CONF_FILE ?= $(E2E_DIR)/config/hetzner-ci-envsubst.yaml
E2E_CONF_FILE ?= $(E2E_DIR)/config/hetzner.tmp.yaml
KUBETEST_CONF_PATH ?= $(abspath $(E2E_DIR)/data/kubetest/conformance.yaml)

# # to set multiple ginkgo skip flags, if any
Expand Down
Loading
Loading