Skip to content

Commit cb3277d

Browse files
committed
fixup! ci: Remove unnecessary step to get CP endpoint IP
1 parent 0a2f9a3 commit cb3277d

File tree

2 files changed

+34
-32
lines changed

2 files changed

+34
-32
lines changed

.github/workflows/e2e.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,6 @@ jobs:
6969
echo "After removing files:"
7070
df -h
7171
72-
- name: Get Control Plane endpoint IP
73-
id: get-control-plane-endpoint-ip
74-
if: inputs.provider == 'Nutanix'
75-
run: |
76-
export CONTROL_PLANE_ENDPOINT_RANGE_START="${{ vars.NUTANIX_CONTROL_PLANE_ENDPOINT_RANGE_START }}"
77-
export CONTROL_PLANE_ENDPOINT_RANGE_END="${{ vars.NUTANIX_CONTROL_PLANE_ENDPOINT_RANGE_END }}"
78-
control_plane_endpoint_ip="$(devbox run -- make nutanix-cp-endpoint-ip)"
79-
echo "control_plane_endpoint_ip=${control_plane_endpoint_ip}" >> "${GITHUB_OUTPUT}"
80-
81-
- name: Check Control Plane endpoint IP
82-
if: inputs.provider == 'Nutanix'
83-
run: |
84-
if [[ -z "${{ steps.get-control-plane-endpoint-ip.outputs.control_plane_endpoint_ip }}" ]]; then
85-
echo "control_plane_endpoint_ip is empty; cannot proceed with e2e tests"
86-
exit 1
87-
fi
88-
8972
- name: Run e2e tests
9073
run: devbox run -- make e2e-test E2E_LABEL='provider:${{ inputs.provider }}' E2E_SKIP='${{ inputs.skip }}' E2E_FOCUS='${{ inputs.focus }}' E2E_VERBOSE=true
9174
env:
@@ -101,7 +84,6 @@ jobs:
10184
NUTANIX_SUBNET_NAME: ${{ vars.NUTANIX_SUBNET_NAME }}
10285
NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME: ${{ vars.NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME }}
10386
NUTANIX_STORAGE_CONTAINER_NAME: ${{ vars.NUTANIX_STORAGE_CONTAINER_NAME }}
104-
CONTROL_PLANE_ENDPOINT_IP: ${{ steps.get-control-plane-endpoint-ip.outputs.control_plane_endpoint_ip }}
10587

10688
- if: success() || failure() # always run even if the previous step fails
10789
name: Publish e2e test report

test/e2e/quick_start_test.go

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package e2e
77

88
import (
99
"fmt"
10+
"os"
1011
"slices"
1112
"strconv"
1213
"strings"
@@ -19,6 +20,7 @@ import (
1920
clusterctlcluster "sigs.k8s.io/cluster-api/cmd/clusterctl/client/cluster"
2021
capie2e "sigs.k8s.io/cluster-api/test/e2e"
2122
capiframework "sigs.k8s.io/cluster-api/test/framework"
23+
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
2224

2325
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/v1alpha1"
2426
apivariables "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/variables"
@@ -60,24 +62,20 @@ var _ = Describe("Quick start", func() {
6062
Context(
6163
flavour,
6264
func() {
63-
capie2e.QuickStartSpec(ctx, func() capie2e.QuickStartSpecInput {
64-
if !slices.Contains(
65-
e2eConfig.InfrastructureProviders(),
66-
lowercaseProvider,
67-
) {
68-
Fail(fmt.Sprintf(
69-
"provider %s is not enabled - check environment setup for provider specific requirements",
70-
lowercaseProvider,
71-
))
72-
}
65+
var (
66+
testE2EConfig *clusterctl.E2EConfig
67+
clusterLocalClusterctlConfigPath string
68+
)
69+
70+
BeforeEach(func() {
71+
testE2EConfig = e2eConfig.DeepCopy()
7372

7473
// Check if a provider-specific Kubernetes version is set in the environment and use that. This allows
7574
// for testing against different Kubernetes versions, as some providers (e.g. Docker) have machine images
7675
// available that are not available in other providers.
7776
// This version can be specified in `test/e2e/config/caren.yaml` with a variable named
7877
// `KUBERNETES_VERSION_<PROVIDER>`, where `<PROVIDER>` is the uppercase provider name, e.g.
7978
// `KUBERNETES_VERSION_DOCKER: v1.29.5`.
80-
testE2EConfig := e2eConfig.DeepCopy()
8179
varName := capie2e.KubernetesVersion + "_" + strings.ToUpper(
8280
lowercaseProvider,
8381
)
@@ -87,8 +85,8 @@ var _ = Describe("Quick start", func() {
8785
)
8886
}
8987

90-
// For Nutanix provider, reserve an IP address for the workload cluster control plane endpoint - remember
91-
// to unreserve it!
88+
// For Nutanix provider, reserve an IP address for the workload cluster control plane endpoint -
89+
// remember to unreserve it!
9290
if provider == "Nutanix" {
9391
By(
9492
"Reserving an IP address for the workload cluster control plane endpoint",
@@ -110,9 +108,31 @@ var _ = Describe("Quick start", func() {
110108
testE2EConfig.Variables["CONTROL_PLANE_ENDPOINT_IP"] = controlPlaneEndpointIP
111109
}
112110

111+
clusterLocalTempDir, err := os.MkdirTemp("", "clusterctl-")
112+
Expect(err).ToNot(HaveOccurred())
113+
DeferCleanup(func() {
114+
Expect(os.RemoveAll(clusterLocalTempDir)).To(Succeed())
115+
})
116+
clusterLocalClusterctlConfigPath = createClusterctlLocalRepository(
117+
testE2EConfig,
118+
clusterLocalTempDir,
119+
)
120+
})
121+
122+
capie2e.QuickStartSpec(ctx, func() capie2e.QuickStartSpecInput {
123+
if !slices.Contains(
124+
e2eConfig.InfrastructureProviders(),
125+
lowercaseProvider,
126+
) {
127+
Fail(fmt.Sprintf(
128+
"provider %s is not enabled - check environment setup for provider specific requirements",
129+
lowercaseProvider,
130+
))
131+
}
132+
113133
return capie2e.QuickStartSpecInput{
114134
E2EConfig: testE2EConfig,
115-
ClusterctlConfigPath: clusterctlConfigPath,
135+
ClusterctlConfigPath: clusterLocalClusterctlConfigPath,
116136
BootstrapClusterProxy: bootstrapClusterProxy,
117137
ArtifactFolder: artifactFolder,
118138
SkipCleanup: skipCleanup,

0 commit comments

Comments
 (0)