Skip to content

Commit 5f9e618

Browse files
ci(e2e): shared e2e composite action (#24)
* (chore): e2e composite action * (chore): add outputs to composite action * (chore): removes secret
1 parent 413b040 commit 5f9e618

File tree

2 files changed

+77
-80
lines changed

2 files changed

+77
-80
lines changed

.gitignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Mac OS
2+
.DS_Store
3+
4+
# IDEs and editors
5+
.idea
6+
.project
7+
.classpath
8+
.c9/
9+
*.launch
10+
.settings/
11+
*.sublime-workspace
12+
13+
# ignore vscode debug binary
14+
__debug_bin
15+
16+
# ignore vscode workspaces of individual users
17+
*.code-workspace
18+
19+
# IDE - VSCode
20+
.vscode/*
21+
!.vscode/settings.json
22+
!.vscode/tasks.json
23+
!.vscode/launch.json
24+
!.vscode/extensions.json
25+
.history/*

workflows/e2e/action.yaml

+52-80
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "e2e-workflow"
1+
name: "E2E Workflow"
22
description: "Run Greenhouse E2E test against a Kubernetes cluster"
33
inputs:
44
admin-cluster-name:
@@ -9,97 +9,69 @@ inputs:
99
description: "The kind cluster name"
1010
required: false
1111
default: "greenhouse-remote"
12-
namespace:
13-
description: "The namespcace to be created in the kind cluster"
14-
required: false
15-
default: "greenhouse"
16-
kubernetes-version:
12+
k8s-version:
1713
description: "The Kubernetes version used to spin up clusters"
18-
required: false
19-
default: "v1.30.4"
20-
go-version:
21-
description: "The Go version to build greenhousectl"
22-
required: false
23-
default: "1.23"
14+
required: true
15+
scenario:
16+
description: "The E2E scenario to run"
17+
required: true
18+
outputs:
19+
result:
20+
description: "The path to the E2E test results"
21+
value: ${{ steps.e2e.outputs.result }}
22+
2423
runs:
2524
using: "composite"
2625
steps:
27-
- name: Checkout tools repo
26+
27+
- name: Checkout repository
2828
uses: actions/checkout@v4
2929
with:
3030
repository: cloudoperators/greenhouse
31+
3132
- name: Set up Go
3233
uses: actions/setup-go@v5
3334
with:
34-
go-version: ${{ inputs.go-version }}
35-
- name: Build greenhousectl
36-
shell: bash
37-
run: |
38-
make build-greenhousectl
39-
- name: Create k8s Kind Cluster
40-
uses: helm/[email protected]
35+
go-version-file: 'go.mod'
36+
37+
# Create the admin cluster with latest kubernetes version
38+
- name: Create Admin Cluster
39+
uses: helm/[email protected]
4140
with:
42-
install_only: true
43-
- name: compose config.json
44-
shell: bash
45-
run: |
46-
cat << EOF > $RUNNER_TEMP/config.json
47-
{
48-
"config":[
49-
{
50-
"cluster":{
51-
"name": "${{ inputs.remote-cluster-name }}",
52-
"version": "${{ inputs.kubernetes-version }}"
53-
}
54-
},
55-
{
56-
"cluster":{
57-
"name": "${{ inputs.admin-cluster-name }}",
58-
"namespace": "${{ inputs.namespace }}",
59-
"version": "${{ inputs.kubernetes-version }}"
60-
},
61-
"dependencies":[
62-
{
63-
"manifest":{
64-
"release":"greenhouse",
65-
"chartPath":"charts/idproxy",
66-
"crdOnly":true
67-
}
68-
},
69-
{
70-
"manifest":{
71-
"release":"greenhouse",
72-
"chartPath":"charts/manager",
73-
"valuesPath":"dev-env/localenv/sample.values.yaml",
74-
"crdOnly":false,
75-
"webhook":{
76-
"devMode":false,
77-
"dockerFile":"./",
78-
"envs":[
79-
{
80-
"name":"CONTROLLERS_ONLY",
81-
"value":"true"
82-
}
83-
]
84-
}
85-
}
86-
}
87-
]
88-
}
89-
]
90-
}
91-
EOF
92-
- name: run greenhousectl
93-
shell: bash
94-
run: |
95-
bin/greenhousectl dev setup -f $RUNNER_TEMP/config.json
96-
- name: export kubeconfig
41+
cluster_name: ${{ inputs.admin-cluster-name }}
42+
node_image: 'kindest/node:v1.31.0'
43+
44+
# Create the remote cluster with kubernetes version from the matrix
45+
- name: Create Remote Cluster
46+
uses: helm/[email protected]
47+
with:
48+
node_image: 'kindest/node:${{ inputs.k8s-version }}'
49+
cluster_name: ${{ inputs.remote-cluster-name }}
50+
config: ${{ github.workspace }}/e2e/kind-config.yaml
51+
52+
# build CLI, setup e2e environment and prepare kubeconfigs
53+
- name: "Prepare E2E Config"
9754
shell: bash
55+
id: config
9856
run: |
99-
kind export kubeconfig --name ${{ inputs.admin-cluster-name }} --kubeconfig $RUNNER_TEMP/e2e.kubeconfig
100-
kind export kubeconfig --internal --name ${{ inputs.admin-cluster-name }} --kubeconfig $RUNNER_TEMP/e2e.internal.kubeconfig
101-
- name: run e2e test
57+
make setup-e2e
58+
echo "admin_config=$GITHUB_WORKSPACE/bin/${{inputs.admin-cluster-name}}.kubeconfig" >> $GITHUB_OUTPUT
59+
echo "remote_config=$GITHUB_WORKSPACE/bin/${{inputs.remote-cluster-name}}.kubeconfig" >> $GITHUB_OUTPUT
60+
echo "remote_int_config=$GITHUB_WORKSPACE/bin/${{inputs.remote-cluster-name}}-int.kubeconfig" >> $GITHUB_OUTPUT
61+
62+
# run the e2e tests with the scenario from the matrix
63+
- name: "E2E Run"
10264
shell: bash
65+
id: e2e
66+
continue-on-error: true
67+
env:
68+
SCENARIO: ${{ inputs.scenario }}
69+
EXECUTION_ENV: gh-actions
70+
GREENHOUSE_ADMIN_KUBECONFIG: ${{ steps.config.outputs.admin_config }}
71+
GREENHOUSE_REMOTE_KUBECONFIG: ${{ steps.config.outputs.remote_config }}
72+
GREENHOUSE_REMOTE_INT_KUBECONFIG: ${{ steps.config.outputs.remote_int_config }}
73+
CONTROLLER_LOGS_PATH: ${{github.workspace}}/bin/${{inputs.scenario}}-${{inputs.k8s-version}}.txt
74+
E2E_REPORT_PATH: ${{github.workspace}}/bin/${{inputs.scenario}}-${{matrix.k8s-version}}.json
10375
run: |
104-
sleep 30s
105-
USE_EXISTING_CLUSTER=true TEST_KUBECONFIG=$RUNNER_TEMP/e2e.kubeconfig INTERNAL_KUBECONFIG=$RUNNER_TEMP/e2e.internal.kubeconfig go test ./test/e2e/... -coverprofile cover.out -v
76+
echo "result=$CONTROLLER_LOGS_PATH" >> $GITHUB_OUTPUT
77+
make e2e

0 commit comments

Comments
 (0)