Skip to content

Commit 5e5527b

Browse files
authored
ci: Lint and test with ingress enabled (#113)
* ci: Test with ingress enabled That's usually how people access the deployed RHDH instance * Enable debug flag on ct to help troubleshooting * Temporarily bump the Chart version to test the changes in the GH test workflow * Fix the custom Storage Class provisioner to match the one used by default on Minikube * Auto-detect the provisioner of the default storage class This way, it will continueto work if we decide to switch to a different cluster in the future. * Apply suggestions from code review * Apply suggestions from code review * fixup! Auto-detect the provisioner of the default storage class * Align the job name with the OpenShift CI config [1] Otherwise, the required check will remain pending forever on the PR. [1] https://github.com/openshift/release/blob/master/core-services/prow/02_config/redhat-developer/rhdh-chart/_prowconfig.yaml#L18 * Revert to the KinD cluster * Expose ports 80 and 443 and forward them to the KinD nodes * Revert "Temporarily bump the Chart version to test the changes in the GH test workflow" This reverts commit 1426cb3.
1 parent 66deeae commit 5e5527b

1 file changed

Lines changed: 35 additions & 5 deletions

File tree

.github/workflows/test.yml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ jobs:
5757
- version: next
5858
experimental: true
5959

60-
name: Test ${{ matrix.version }} release
60+
# Aligning job name with the OpenShift CI config: https://github.com/openshift/release/blob/master/core-services/prow/02_config/redhat-developer/rhdh-chart/_prowconfig.yaml#L18
61+
name: Test ${{ matrix.version == 'latest' && 'Latest' || matrix.version }} Release
6162
runs-on: ubuntu-latest
6263
continue-on-error: ${{ matrix.experimental }}
6364

@@ -89,26 +90,54 @@ jobs:
8990
- name: Lint chart
9091
run: |
9192
ct lint \
93+
--debug \
9294
--config ct.yaml \
9395
--target-branch "${{ github.event.pull_request.base.ref }}" \
94-
--helm-extra-args="--set upstream.backstage.image.tag=${{ matrix.version }} --set global.clusterRouterBase=app.example.com"
96+
--helm-extra-args="--set upstream.backstage.image.tag=${{ matrix.version }} --set upstream.ingress.enabled=true"
97+
98+
- name: Generate KinD Config
99+
run: |
100+
cat <<EOF > /tmp/kind-config.yaml
101+
apiVersion: kind.x-k8s.io/v1alpha4
102+
kind: Cluster
103+
nodes:
104+
- role: control-plane
105+
extraPortMappings:
106+
- containerPort: 80
107+
hostPort: 80
108+
protocol: TCP
109+
- containerPort: 443
110+
hostPort: 443
111+
protocol: TCP
112+
EOF
95113
96114
- name: Create KIND Cluster
97115
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
116+
with:
117+
config: /tmp/kind-config.yaml
98118

99119
- name: Create custom storage class
100120
run: |
121+
export defaultScProvisioner=$(kubectl get storageclass -o jsonpath='{.items[?(@.metadata.annotations.storageclass\.kubernetes\.io/is-default-class=="true")].provisioner}')
122+
if [[ -z "$defaultScProvisioner" ]]; then
123+
echo "No default storage class found or it has no provisioner. Exiting early because the test using the custom Storage Class will likely fail. Use a cluster that has a default storage class."
124+
exit 1
125+
fi
126+
echo "[INFO] defaultScProvisioner=$defaultScProvisioner"
127+
101128
cat <<EOF | kubectl apply -f -
102129
apiVersion: storage.k8s.io/v1
103130
kind: StorageClass
104131
metadata:
105132
name: custom-sc
106-
# same provisioner as the one used by the default storage class on KinD
107-
provisioner: rancher.io/local-path
133+
# same provisioner as the one used by the default storage class on the cluster
134+
provisioner: $defaultScProvisioner
108135
reclaimPolicy: Delete
109136
volumeBindingMode: WaitForFirstConsumer
110137
EOF
111138
139+
kubectl get storageclass custom-sc -o yaml
140+
112141
- name: Install Ingress Controller
113142
run: |
114143
helm install ingress-nginx/ingress-nginx --generate-name \
@@ -127,7 +156,8 @@ jobs:
127156
- name: Run chart-testing
128157
run: |
129158
ct install \
159+
--debug \
130160
--config ct-install.yaml \
131161
--upgrade \
132162
--target-branch "${{ github.event.pull_request.base.ref }}" \
133-
--helm-extra-set-args="--set upstream.backstage.image.tag=${{ matrix.version }} --set global.clusterRouterBase=app.example.com"
163+
--helm-extra-set-args="--set upstream.backstage.image.tag=${{ matrix.version }} --set upstream.ingress.enabled=true --set global.host=rhdh.127.0.0.1.sslip.io"

0 commit comments

Comments
 (0)