Skip to content

Commit

Permalink
de-duplicate hetzner-ci.yaml.
Browse files Browse the repository at this point in the history
  • Loading branch information
guettli committed Jan 8, 2025
1 parent 20b0512 commit 594e762
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 215 deletions.
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
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
3 changes: 1 addition & 2 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ ignore:
- config/rbac/**/*.yaml
- config/webhook/**/*.yaml
- test/e2e/data/**/*.yaml
- test/e2e/config/hetzner-ci-envsubst.yaml
- baremetalhosts.yaml
- baremetalhosts.yaml
9 changes: 4 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 @@ -489,10 +489,9 @@ e2e-image: ## Build the e2e manager image

.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))
./hack/ensure-env-variables.sh CAPH_LATEST_VERSION
$(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"
2 changes: 1 addition & 1 deletion test/e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,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
176 changes: 0 additions & 176 deletions test/e2e/config/hetzner-ci.yaml

This file was deleted.

58 changes: 29 additions & 29 deletions test/e2e/config/hetzner.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
# CI E2E test test configuration scenario using locally build images and manifests for:
# - cluster-api
# - bootstrap kubeadm
Expand All @@ -7,7 +6,7 @@

# For creating local dev images run make e2e-image from the main CAPH repository
images:
- name: ghcr.io/syself/caph-staging:e2e
- name: ghcr.io/syself/caph-staging:${TAG:=e2e}
loadBehavior: mustLoad
providers:
- name: cluster-api
Expand Down Expand Up @@ -68,33 +67,7 @@ providers:
type: "url"
contract: v1beta1
files:
- sourcePath: "../../../metadata.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-k8s-upgrade.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-k8s-upgrade-kcp-scale-in.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hcloud-feature-packer.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hcloud-feature-csr-off.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hcloud-feature-load-balancer-extra-services.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hcloud-feature-placement-groups.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hcloud-feature-loadbalancer-off.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-network.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-node-drain.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-md-remediation.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-kcp-remediation.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hetzner-baremetal.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hetzner-baremetal-feature-raid-setup.yaml"
- name: v1.0.99 # next; use manifest from source files
value: ../../../config/default
contract: v1beta1
replacements:
- old: ghcr.io/syself/caph-staging:latest
new: ghcr.io/syself/caph-staging:e2e
- old: "imagePullPolicy: Always"
new: "imagePullPolicy: IfNotPresent"
- old: --metrics-bind-addr=localhost:8080
new: --metrics-bind-addr=:8080
files:
- sourcePath: "../../../metadata.yaml"
- sourcePath: "${MANIFEST_PATH}/metadata.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-k8s-upgrade.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-k8s-upgrade-kcp-scale-in.yaml"
Expand All @@ -109,6 +82,33 @@ providers:
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-kcp-remediation.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hetzner-baremetal.yaml"
- sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hetzner-baremetal-feature-raid-setup.yaml"
## Update and uncomment, if you want to do a caph upgrade test.

Check warning on line 85 in test/e2e/config/hetzner.yaml

View workflow job for this annotation

GitHub Actions / Lint Pull Request

85:7 [comments-indentation] comment not indented like content

Check warning on line 85 in test/e2e/config/hetzner.yaml

View workflow job for this annotation

GitHub Actions / Lint Pull Request

85:7 [comments-indentation] comment not indented like content

Check warning on line 85 in test/e2e/config/hetzner.yaml

View workflow job for this annotation

GitHub Actions / Lint Pull Request

85:7 [comments-indentation] comment not indented like content

Check warning on line 85 in test/e2e/config/hetzner.yaml

View workflow job for this annotation

GitHub Actions / Lint Pull Request

85:7 [comments-indentation] comment not indented like content
# - name: v1.0.99 # next; use manifest from source files
# value: ../../../config/default
# contract: v1beta1
# replacements:
# - old: ghcr.io/syself/caph-staging:latest
# new: ghcr.io/syself/caph-staging:e2e
# - old: "imagePullPolicy: Always"
# new: "imagePullPolicy: IfNotPresent"
# - old: --metrics-bind-addr=localhost:8080
# new: --metrics-bind-addr=:8080
# files:
# - sourcePath: "../../../metadata.yaml"
# - sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template.yaml"
# - sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-k8s-upgrade.yaml"
# - sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-k8s-upgrade-kcp-scale-in.yaml"
# - sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hcloud-feature-packer.yaml"
# - sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hcloud-feature-csr-off.yaml"
# - sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hcloud-feature-load-balancer-extra-services.yaml"
# - sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hcloud-feature-placement-groups.yaml"
# - sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hcloud-feature-loadbalancer-off.yaml"
# - sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-network.yaml"
# - sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-node-drain.yaml"
# - sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-md-remediation.yaml"
# - sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-kcp-remediation.yaml"
# - sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hetzner-baremetal.yaml"
# - sourcePath: "../data/infrastructure-hetzner/v1beta1/cluster-template-hetzner-baremetal-feature-raid-setup.yaml"

variables:
# Upgrade Test
Expand Down

0 comments on commit 594e762

Please sign in to comment.