mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-08-27 00:37:20 +00:00
creates clusters for tests via replicated actions
This commit is contained in:
@@ -86,12 +86,23 @@ jobs:
|
||||
fi;
|
||||
} | tee -a "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
# Provision a Kubernetes cluster for e2e that depend on it (safe no-op for kind-based Go e2e)
|
||||
- name: Setup K3s
|
||||
# Provision a Kubernetes cluster for e2e using Replicated compatibility actions
|
||||
- name: Create k3s cluster
|
||||
id: create-cluster
|
||||
if: steps.affected_e2e.outputs.has_changes == 'true'
|
||||
uses: replicatedhq/action-k3s@main
|
||||
uses: replicatedhq/compatibility-actions/create-cluster@v1
|
||||
with:
|
||||
version: v1.31.2-k3s1
|
||||
api-token: ${{ secrets.REPLICATED_API_TOKEN }}
|
||||
kubernetes-distribution: k3s
|
||||
cluster-name: pr-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
ttl: 25m
|
||||
timeout-minutes: 5
|
||||
|
||||
- name: Configure kubeconfig
|
||||
if: steps.affected_e2e.outputs.has_changes == 'true'
|
||||
run: |
|
||||
echo "${{ steps.create-cluster.outputs.cluster-kubeconfig }}" > $GITHUB_WORKSPACE/kubeconfig.yaml
|
||||
echo "KUBECONFIG=$GITHUB_WORKSPACE/kubeconfig.yaml" >> $GITHUB_ENV
|
||||
|
||||
# 3) Run filtered tests only
|
||||
- name: Run unit tests for affected packages
|
||||
@@ -142,4 +153,13 @@ jobs:
|
||||
if: steps.affected.outputs.has_changes != 'true'
|
||||
run: echo "No Go packages affected by this PR; skipping tests."
|
||||
|
||||
# Cleanup cluster
|
||||
- name: Remove cluster
|
||||
if: always() && steps.affected_e2e.outputs.has_changes == 'true'
|
||||
uses: replicatedhq/compatibility-actions/remove-cluster@v1
|
||||
continue-on-error: true
|
||||
with:
|
||||
api-token: ${{ secrets.REPLICATED_API_TOKEN }}
|
||||
cluster-id: ${{ steps.create-cluster.outputs.cluster-id }}
|
||||
|
||||
|
||||
|
||||
@@ -53,11 +53,15 @@ SB="$( echo "${E2E_OUT}" | awk -F: '$1=="support-bundle"{print $2}' | paste -sd'
|
||||
# Use direct go test with the same build tags as the Makefile to avoid RUN quoting issues locally
|
||||
BUILD_TAGS='netgo containers_image_ostree_stub exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp'
|
||||
|
||||
overall=0
|
||||
|
||||
if [ -n "${PRE}" ]; then
|
||||
echo "Running preflight e2e: ${PRE}"
|
||||
go test -tags "${BUILD_TAGS}" -installsuffix netgo -v -count=1 ./test/e2e/preflight -run "^(${PRE})$" || true
|
||||
go test -tags "${BUILD_TAGS}" -installsuffix netgo -v -count=1 ./test/e2e/preflight -run "^(${PRE})$" || overall=1
|
||||
fi
|
||||
if [ -n "${SB}" ]; then
|
||||
echo "Running support-bundle e2e: ${SB}"
|
||||
go test -tags "${BUILD_TAGS}" -installsuffix netgo -v -count=1 ./test/e2e/support-bundle -run "^(${SB})$" || true
|
||||
fi
|
||||
go test -tags "${BUILD_TAGS}" -installsuffix netgo -v -count=1 ./test/e2e/support-bundle -run "^(${SB})$" || overall=1
|
||||
fi
|
||||
|
||||
exit $overall
|
||||
Reference in New Issue
Block a user