Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/provisioning-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,26 @@ jobs:
container:
image: rancher/dapper:v0.6.0
options: --privileged
volumes:
- /tmp:/tmp
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
dist: [rke2, k3s]
k8s-minor: [31, 32, 33]
test-regex: ["^Test_Provisioning_.*$", "^Test_Operation_SetA_.*$", "^Test_Operation_SetB_.*$"]
outputs:
skip_convert: ${{ steps.test_output.outputs.skip_upload }}
steps:
- name: Force Install GIT latest
run: |
apk add git --update-cache
git --version
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Install golang
run: |
apk add go
- name: Checkout code
uses: actions/checkout@v4
with:
Expand All @@ -49,3 +56,57 @@ jobs:
KDM_TEST_K8S_MINOR: ${{ matrix.k8s-minor }}
PREV_COMMIT_PR_SHA: ${{ github.event.pull_request.base.sha }}
PREV_COMMIT_PUSH_SHA: ${{ github.event.before }}
- name: Rename Test Output
id: test_output
run: |
export TESTSUITE="$(echo '${{ matrix.test-regex }}' | tr -d '()|^.*$')"
echo "suite=${TESTSUITE}" >> $GITHUB_OUTPUT
FILE=$(find /tmp -name out.json)
if [ -z $FILE ]; then
echo "couldn't find test output - no tests ran."
echo "skip_upload=true" >> $GITHUB_OUTPUT
exit 0
fi
mv $FILE /tmp/report-${{ matrix.dist }}-v1${{ matrix.k8s-minor }}-$TESTSUITE.json
- name: Upload JSON Test Results
if: steps.test_output.outputs.skip_upload != 'true'
uses: actions/upload-artifact@v4
with:
name: "JSON Results ${{ matrix.dist }} v1${{ matrix.k8s-minor }} ${{ steps.test_output.outputs.suite }}"
path: "/tmp/report-${{ matrix.dist }}-v1${{ matrix.k8s-minor }}-${{ steps.test_output.outputs.suite }}.json"

convert-to-xml:
needs: [provisioning-test]
if: needs.provisioning-test.outputs.skip_convert != 'true'
runs-on: org-${{ github.repository_owner_id }}-amd64-k8s
container: registry.suse.com/bci/bci-base:15.7
steps:
- name: Install golang
run: |
zypper --non-interactive install golang
- name: Fetch Raw JSON output
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: /tmp/test-results/
- name: Convert test results to XML
run: |
for file in $(ls /tmp/test-results/report-*.json); do
echo "Processing $file..."
go run github.com/jstemmer/go-junit-report/v2@latest -parser gojson < $file > $(sed 's/json/xml/g' <<<$file)
done
- name: Upload XML Test Results
uses: actions/upload-artifact@v4
with:
name: XML Results
path: "/tmp/test-results/report-*.xml"

event-file:
runs-on: org-${{ github.repository_owner_id }}-amd64-k8s
container: registry.suse.com/bci/bci-base:15.7
steps:
- name: Upload GH Event File
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}
15 changes: 2 additions & 13 deletions .github/workflows/publish-test-results.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Tests Results
name: Publish Provisioning Tests Results
on:
workflow_run:
workflows: ["Provisioning tests"]
Expand Down Expand Up @@ -37,22 +37,11 @@ jobs:
path: /tmp/test-results/
name: "Event File"

- run: ls -l /tmp/test-results/

- name: "[Debug] Downloading everything"
uses: actions/download-artifact@v4
with:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
merge-multiple: true
path: /tmp/test-results/

- run: ls -l /tmp/test-results/

- name: Publish Test Results
uses: rancher/publish-unit-test-result-action/linux@3a74b2957438d0b6e2e61d67b05318aa25c9e6c6
if: (!cancelled())
with:
check_name: Provisioning Tests Results
commit: ${{ github.event.workflow_run.head_sha }}
event_name: ${{ github.event.workflow_run.event }}
event_file: /tmp/test-results/event.json
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Main workflow

on:
push:
push:
branches:
- 'dev-v*'
- 'release-v*'
Expand All @@ -17,7 +17,7 @@ jobs:
id-token: write
runs-on: ubuntu-latest
timeout-minutes: 20
container:
container:
image: rancher/dapper:v0.6.0
steps:
- name: Force Install GIT latest
Expand All @@ -36,7 +36,7 @@ jobs:
id-token: write
runs-on: ubuntu-latest
needs: validate
container:
container:
image: rancher/dapper:v0.6.0
if: github.event_name == 'push' && startsWith(github.ref_name, 'release-v')
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/.idea
.dapper
.DS_Store
/build
2 changes: 1 addition & 1 deletion Dockerfile.dapper
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ENV DAPPER_SOURCE /go/src/github.com/rancher/kontainer-driver-metadata
ENV DAPPER_DOCKER_SOCKET true
ARG CI
ARG GITHUB_RUN_NUMBER
ENV DAPPER_RUN_ARGS "--privileged --label CI=${CI} --label DRONE_BUILD_NUMBER=${GITHUB_RUN_NUMBER}"
ENV DAPPER_RUN_ARGS "--privileged -v /tmp:/tmp --label CI=${CI} --label DRONE_BUILD_NUMBER=${GITHUB_RUN_NUMBER}"
ENV HOME ${DAPPER_SOURCE}
ENV GOPATH /go
VOLUME /var/lib/rancher
Expand Down
2 changes: 1 addition & 1 deletion scripts/fetch-provisioning-tests
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ IMAGE_REPO=${IMAGE_REPO:-rancher/rancher}
IMAGE_TAG=${IMAGE_TAG:-v2.12-head}
IMAGE=${IMAGE:-$IMAGE_REPO:$IMAGE_TAG}

# Inspect image, get server version and extract rancher commit
# Inspect image, get server version and extract rancher commit
if [ -n "$RANCHER_COMMIT" ]; then
RANCHER_COMMIT=$(awk -F '=' '{print $2}' <<< "$CATTLE_SERVER_VERSION")
case $RANCHER_COMMIT in *-head)
Expand Down
8 changes: 4 additions & 4 deletions scripts/provisioning-tests
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ elif [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then
export PREV_COMMIT_SHA=${PREV_COMMIT_PR_SHA}
fi

# To be removed/changed once drone setup is removed from rancher/rancher repo.
# To be removed/changed once drone setup is removed from rancher/rancher repo.
export DRONE_BUILD_NUMBER=${GITHUB_RUN_NUMBER}

if ! ./scripts/test-run-required.sh; then
exit
fi
# if ! ./scripts/test-run-required.sh; then
# exit
# fi

set -ex

Expand Down
Loading