Skip to content

Commit 6024a54

Browse files
authored
🌱 Run e2e tests always, de-duplicate hetzner-ci.yaml (#1527)
* 🌱 Run e2e tests always, except only markdown files got changed. * ... fix indentation in kct-md-0-ubuntu.yaml * better err msg, if env var is missing. * de-duplicate hetzner-ci.yaml. * fix yaml lint.
1 parent e516b90 commit 6024a54

File tree

9 files changed

+83
-234
lines changed

9 files changed

+83
-234
lines changed

.github/actions/e2e/action.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ runs:
6969
REGISTRY: ${{ env.REGISTRY }}
7070
IMAGE_NAME: ${{ env.IMAGE_NAME }}
7171
TAG: ${{ steps.meta.outputs.version }}
72-
E2E_CONF_FILE_SOURCE: "${{ github.workspace }}/test/e2e/config/hetzner-ci.yaml"
7372
MANIFEST_PATH: "../../../out"
7473
HCLOUD_TOKEN: ${{ env.HCLOUD_TOKEN }}
7574
HETZNER_ROBOT_USER: ${{ inputs.e2e_robot_user }}

.github/workflows/pr-e2e.yaml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,8 @@ on:
55
branches:
66
- main
77
- "releases/**"
8-
paths:
9-
- "**.go"
10-
- "**go.mod"
11-
- "**go.sum"
12-
- "<templates|test>/**/*.<yml|yaml>"
13-
- ".github/actions/**/*"
14-
- ".github/workflows/e2e-*"
15-
- ".github/workflows/pr-*"
16-
- "images/caph/**"
17-
- "!**/vendor/**"
18-
- "test/e2e/**"
8+
paths-ignore:
9+
- "**/*.md"
1910
env:
2011
IMAGE_NAME: caph-staging
2112
REGISTRY: ghcr.io/syself

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ config/samples
5252

5353
# test results
5454
_artifacts
55-
test/e2e/config/hetzner-ci-envsubst.yaml
55+
test/e2e/config/hetzner.tmp.yaml
5656
resp.json
5757
**manifest.json
5858

.yamllint.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ rules:
1717
min-spaces-from-content: 1
1818

1919
yaml-files:
20-
- '*.yaml'
21-
- '*.yml'
20+
- "*.yaml"
21+
- "*.yml"
2222

2323
ignore:
24-
- '**/vendor/**'
25-
- '.cache'
24+
- "**/vendor/**"
25+
- ".cache"
2626
- _artifacts
27+
- tmp/**
2728
- config/crd/**/*.yaml
2829
- config/rbac/**/*.yaml
2930
- config/webhook/**/*.yaml
3031
- test/e2e/data/**/*.yaml
31-
- test/e2e/config/hetzner-ci-envsubst.yaml
32-
- baremetalhosts.yaml
32+
- baremetalhosts.yaml
33+
- test/e2e/config/hetzner.tmp.yaml

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ KUBEBUILDER_ASSETS ?= $(shell $(SETUP_ENVTEST) use --use-env --bin-dir $(abspath
476476

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

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

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

496496
.PHONY: test-e2e
497497
test-e2e: $(E2E_CONF_FILE) $(if $(SKIP_IMAGE_BUILD),,e2e-image) $(ARTIFACTS)

hack/create-e2e-conf-file.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# Copyright 2022 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
trap 'echo "ERROR: A command has failed. Exiting the script. Line was ($0:$LINENO): $(sed -n "${LINENO}p" "$0")"; exit 3' ERR
18+
set -Eeuo pipefail
19+
20+
./hack/ensure-env-variables.sh CAPH_LATEST_VERSION ENVSUBST E2E_CONF_FILE_SOURCE E2E_CONF_FILE
21+
22+
# When called via CI, MANIFEST_PATH is already set. It points to the "out" directory
23+
# created with the Github action "download-artifacts".
24+
if [ -z "${MANIFEST_PATH:-}" ]; then
25+
export MANIFEST_PATH="../../.."
26+
fi
27+
28+
echo "# Created from $E2E_CONF_FILE_SOURCE by $0" >"$E2E_CONF_FILE"
29+
$ENVSUBST <"$E2E_CONF_FILE_SOURCE" >>"$E2E_CONF_FILE"

test/e2e/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
.DEFAULT_GOAL:=help
2020

21+
SHELL = /usr/bin/env bash -o pipefail
22+
2123
REPO_ROOT := $(shell git rev-parse --show-toplevel)
2224

2325
help: ## Display this help
@@ -115,7 +117,7 @@ ARTIFACTS ?= $(ROOT_DIR)/_artifacts
115117
SKIP_CLEANUP ?= false
116118
SKIP_CREATE_MGMT_CLUSTER ?= false
117119
E2E_DIR ?= $(REPO_ROOT)/test/e2e
118-
E2E_CONF_FILE ?= $(E2E_DIR)/config/hetzner-ci-envsubst.yaml
120+
E2E_CONF_FILE ?= $(E2E_DIR)/config/hetzner.tmp.yaml
119121
KUBETEST_CONF_PATH ?= $(abspath $(E2E_DIR)/data/kubetest/conformance.yaml)
120122

121123
# # to set multiple ginkgo skip flags, if any

test/e2e/config/hetzner-ci.yaml

Lines changed: 0 additions & 176 deletions
This file was deleted.

0 commit comments

Comments
 (0)