Skip to content

[WIP]: Revamp CI reporting #4367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
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
49 changes: 49 additions & 0 deletions .github/actions/wax/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "Wax: commenting component"

description: "A simple reporter adding or updating a comment on PRs."

inputs:
body:
default: "Body of the comment"
description: "Body of the comment"
github-token:
description: "Auth token"

runs:
using: composite
steps:
- name: Commenting
uses: actions/github-script@v7
with:
github-token: ${{inputs.github-token}}
script: |
let comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
})

let found = 0
let body = ""
comments.data.forEach(function(comment){
if (comment.user.login === context.repo.login) {
found = comment.id
body = comment.body
}
})

if (found === 0){
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "${{ inputs.body }}\n"
})
}else{
github.rest.issues.updateComment({
comment_id: found,
owner: context.repo.owner,
repo: context.repo.repo,
body: body + "\n${{ inputs.body }}\n"
})
}
17 changes: 17 additions & 0 deletions .github/matchers/tigron.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "tigron",
"pattern": [
{
"regexp": "^([^:]+):(\\d+):(\\d+):\\s+(error|warning):\\s+(.*)$",
"severity": 1,
"file": 2,
"line": 3,
"column": 4,
"message": 5
}
]
}
]
}
72 changes: 0 additions & 72 deletions .github/workflows/ghcr-image-build-and-publish.yml

This file was deleted.

106 changes: 98 additions & 8 deletions .github/workflows/job-test-in-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ on:
required: false
default: false
type: boolean
outputs:
artifact:
description: "Artifact generated by this job"
value: ${{ jobs.test.outputs.artifact }}

env:
GOTOOLCHAIN: local
Expand All @@ -55,6 +59,8 @@ jobs:
defaults:
run:
shell: bash
outputs:
artifact: ${{ steps.artifact-upload.outputs.artifact-url }}

env:
# https://github.com/containerd/nerdctl/issues/622
Expand Down Expand Up @@ -158,12 +164,12 @@ jobs:
# Besides, each job is running on a different instance, which means using host network here
# is safe and has no side effects on others.
[ "${{ inputs.target }}" == "rootful" ] \
&& args=(test-integration ./hack/test-integration.sh -test.allow-modify-users=true) \
|| args=(test-integration-${{ inputs.target }} /test-integration-rootless.sh ./hack/test-integration.sh)
&& args=(test-integration ./hack/testing/integration.sh -test.allow-modify-users=true) \
|| args=(test-integration-${{ inputs.target }} /test-integration-rootless.sh ./hack/testing/integration.sh)
if [ "${{ inputs.ipv6 }}" == true ]; then
docker run --network host -t --rm --privileged -e GITHUB_STEP_SUMMARY="$GITHUB_STEP_SUMMARY" -v "$GITHUB_STEP_SUMMARY":"$GITHUB_STEP_SUMMARY" -e WORKAROUND_ISSUE_622=${WORKAROUND_ISSUE_622:-} "${args[@]}" -test.only-flaky=false -test.only-ipv6 -test.target=${{ inputs.binary }}
docker run --name test-runner --network host -t --privileged -e GITHUB_STEP_SUMMARY="$GITHUB_STEP_SUMMARY" -v "$GITHUB_STEP_SUMMARY":"$GITHUB_STEP_SUMMARY" -e WORKAROUND_ISSUE_622=${WORKAROUND_ISSUE_622:-} "${args[@]}" -test.only-flaky=false -test.only-ipv6 -test.target=${{ inputs.binary }}
else
docker run -t --rm --privileged -e GITHUB_STEP_SUMMARY="$GITHUB_STEP_SUMMARY" -v "$GITHUB_STEP_SUMMARY":"$GITHUB_STEP_SUMMARY" -e WORKAROUND_ISSUE_622=${WORKAROUND_ISSUE_622:-} "${args[@]}" -test.only-flaky=false -test.target=${{ inputs.binary }}
docker run --name test-runner -t --privileged -e GITHUB_STEP_SUMMARY="$GITHUB_STEP_SUMMARY" -v "$GITHUB_STEP_SUMMARY":"$GITHUB_STEP_SUMMARY" -e WORKAROUND_ISSUE_622=${WORKAROUND_ISSUE_622:-} "${args[@]}" -test.only-flaky=false -test.target=${{ inputs.binary }}
fi
# FIXME: this NEEDS to go away
- name: "Run: integration tests (flaky)"
Expand All @@ -172,10 +178,94 @@ jobs:
github::md::h2 "flaky" >> "$GITHUB_STEP_SUMMARY"

[ "${{ inputs.target }}" == "rootful" ] \
&& args=(test-integration ./hack/test-integration.sh) \
|| args=(test-integration-${{ inputs.target }} /test-integration-rootless.sh ./hack/test-integration.sh)
&& args=(test-integration ./hack/testing/integration.sh) \
|| args=(test-integration-${{ inputs.target }} /test-integration-rootless.sh ./hack/testing/integration.sh)
if [ "${{ inputs.ipv6 }}" == true ]; then
docker run --network host -t --rm --privileged -e GITHUB_STEP_SUMMARY="$GITHUB_STEP_SUMMARY" -v "$GITHUB_STEP_SUMMARY":"$GITHUB_STEP_SUMMARY" -e WORKAROUND_ISSUE_622=${WORKAROUND_ISSUE_622:-} "${args[@]}" -test.only-flaky=true -test.only-ipv6 -test.target=${{ inputs.binary }}
docker run --name test-runner-flaky --network host -t --privileged -e GITHUB_STEP_SUMMARY="$GITHUB_STEP_SUMMARY" -v "$GITHUB_STEP_SUMMARY":"$GITHUB_STEP_SUMMARY" -e WORKAROUND_ISSUE_622=${WORKAROUND_ISSUE_622:-} "${args[@]}" -test.only-flaky=true -test.only-ipv6 -test.target=${{ inputs.binary }}
else
docker run -t --rm --privileged -e GITHUB_STEP_SUMMARY="$GITHUB_STEP_SUMMARY" -v "$GITHUB_STEP_SUMMARY":"$GITHUB_STEP_SUMMARY" -e WORKAROUND_ISSUE_622=${WORKAROUND_ISSUE_622:-} "${args[@]}" -test.only-flaky=true -test.target=${{ inputs.binary }}
docker run --name test-runner-flaky -t --privileged -e GITHUB_STEP_SUMMARY="$GITHUB_STEP_SUMMARY" -v "$GITHUB_STEP_SUMMARY":"$GITHUB_STEP_SUMMARY" -e WORKAROUND_ISSUE_622=${WORKAROUND_ISSUE_622:-} "${args[@]}" -test.only-flaky=true -test.target=${{ inputs.binary }}
fi

- name: "Wrap: collect logs"
if: ${{ failure() || success() }}
run: |
# Get the reports from inside the containers
[ "${{ inputs.target }}" == "rootful" ] && src=/root || src=/home/rootless
mkdir -p ~/report
docker cp test-runner:$src/nerdctl-test-report ~/report/main || true
# Flaky may not have run
docker cp test-runner-flaky:$src/nerdctl-test-report ~/report/flaky 2>/dev/null || true

- name: "Wrap: upload artifact"
id: artifact-upload
if: ${{ failure() || success() }}
uses: actions/upload-artifact@v4
with:
path: ~/report/*
retention-days: 1
# name: logs-${{ inputs.binary }}-${{ inputs.target }}-${{ inputs.runner }}-${{ inputs.ipv6 }}-${{ inputs.canary }}-${{ inputs.containerd-version }}-${{ inputs.rootlesskit-version }}

# - name: Annotate
# if: ${{ failure() || success() }}
# run: |
# echo "::add-matcher::.github/matchers/tigron.json"
# echo "::error title=ErrorReport::MEH .github/workflows/job-test-in-host.yml${{steps.artifact-upload.outputs.artifact-url}}"
# echo "::notice title=NoticeReport::SHEESH ${{steps.artifact-upload.outputs.artifact-url}}"
# echo "::error file=cmd/nerdctl/main_test_test.go,line=1,endLine=10,title=AgainErrorReport::FOO ${{steps.artifact-upload.outputs.artifact-url}}"
# echo "::error file=cmd/nerdctl/main_test.go,line=38,endLine=41,title=AgainErrorReport::BLA ${{steps.artifact-upload.outputs.artifact-url}}"
# echo "Error: TestFooFoo "
# pwd
# ls -lA cmd/nerdctl/main_test_test.go || true
# # ::workflow-command parameter1={data},parameter2={data}::{command value}
# echo "::remove-matcher owner=tigron::"
#
# GITHUB_RUN_ATTEMPT
# GITHUB_RUN_ID
# GITHUB_RUN_NUMBER
# GITHUB_SHA


# - name: "Comment report"
# if: ${{ failure() }}
# uses: ./.github/actions/wax
# with:
# body: "body test (in-container)"
# github-token: ${{ secrets.GITHUB_TOKEN }}
# steps.artifact-upload.outputs.artifact-url

# - name: Commenting
# if: ${{ failure() || success() }}
# uses: actions/github-script@v7
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# script: |
# let comments = await github.rest.issues.listComments({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# })
#
# let found = 0
# let body = ""
# comments.data.forEach(function(comment){
# if (comment.user.login === context.repo.login) {
# found = comment.id
# body = comment.body
# }
# })
#
# if (found === 0){
# github.rest.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: "${{steps.artifact-upload.outputs.artifact-url}}\n"
# })
# }else{
# github.rest.issues.updateComment({
# comment_id: found,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: body + "${{steps.artifact-upload.outputs.artifact-url}}\n"
# })
# }
62 changes: 58 additions & 4 deletions .github/workflows/job-test-in-host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ on:
linux-cni-sha:
required: true
type: string
outputs:
artifact:
description: "Artifact generated by this job"
value: ${{ jobs.test.outputs.artifact }}

env:
GOTOOLCHAIN: local
Expand All @@ -60,6 +64,8 @@ jobs:
defaults:
run:
shell: bash
outputs:
artifact: ${{ steps.artifact-upload.outputs.artifact-url }}

env:
SHOULD_RUN: "yes"
Expand Down Expand Up @@ -183,22 +189,33 @@ jobs:
make install-dev-tools
echo "::endgroup::"


- if: ${{ env.SHOULD_RUN == 'yes' }}
name: "Init: prepare artifacts directories"
run: |
mkdir -p ~/report/main
mkdir -p ~/report/ipv6
mkdir -p ~/report/flaky

# ipv6 is tested only on linux
- if: ${{ contains(inputs.runner, 'ubuntu') && env.SHOULD_RUN == 'yes' }}
- if: ${{ env.SHOULD_RUN == 'yes' && contains(inputs.runner, 'ubuntu' )}}
name: "Run (linux): integration tests (IPv6)"
run: |
. ./hack/github/action-helpers.sh
github::md::h2 "ipv6" >> "$GITHUB_STEP_SUMMARY"

./hack/test-integration.sh -test.target=${{ inputs.binary }} -test.only-ipv6
ln -s ~/report/ipv6 ~/nerdctl-test-report
./hack/testing/integration.sh -test.target=${{ inputs.binary }} -test.only-ipv6

- if: ${{ env.SHOULD_RUN == 'yes' }}
name: "Run: integration tests"
run: |
. ./hack/github/action-helpers.sh
github::md::h2 "non-flaky" >> "$GITHUB_STEP_SUMMARY"

./hack/test-integration.sh -test.target=${{ inputs.binary }} -test.only-flaky=false
rm -f ~/nerdctl-test-report
ln -s ~/report/main ~/nerdctl-test-report
./hack/testing/integration.sh -test.target=${{ inputs.binary }} -test.only-flaky=false

# FIXME: this must go
- if: ${{ env.SHOULD_RUN == 'yes' }}
Expand All @@ -207,4 +224,41 @@ jobs:
. ./hack/github/action-helpers.sh
github::md::h2 "flaky" >> "$GITHUB_STEP_SUMMARY"

./hack/test-integration.sh -test.target=${{ inputs.binary }} -test.only-flaky=true
rm -f ~/nerdctl-test-report
ln -s ~/report/flaky ~/nerdctl-test-report
./hack/testing/integration.sh -test.target=${{ inputs.binary }} -test.only-flaky=true

- name: "Wrap: upload artifact"
id: artifact-upload
if: ${{ env.SHOULD_RUN == 'yes' && (failure() || success()) }}
uses: actions/upload-artifact@v4
with:
path: ~/report/*
retention-days: 1

# name: logs-${{ inputs.binary }}-${{ inputs.runner }}-${{ inputs.canary }}
# - name: "DEBUG"
# if: ${{ env.SHOULD_RUN == 'yes' && (failure() || success()) }}
# run: |
# ls -lAR ~/report
#
# - name: Annotate
# if: ${{ failure() || success() }}
# run: |
# echo "::add-matcher::.github/matchers/tigron.json"
# echo "::error title=ErrorReport::MEH .github/workflows/job-test-in-host.yml${{steps.artifact-upload.outputs.artifact-url}}"
# echo "::notice title=NoticeReport::SHEESH ${{steps.artifact-upload.outputs.artifact-url}}"
# echo "::error file=cmd/nerdctl/main_test_test.go,line=1,endLine=10,title=AgainErrorReport::FOO ${{steps.artifact-upload.outputs.artifact-url}}"
# echo "::error file=cmd/nerdctl/main_test.go,line=38,endLine=41,title=AgainErrorReport::BLA ${{steps.artifact-upload.outputs.artifact-url}}"
# echo "Error: TestFooFoo "
# pwd
# ls -lA cmd/nerdctl/main_test_test.go || true
# # ::workflow-command parameter1={data},parameter2={data}::{command value}
# echo "::remove-matcher owner=tigron::"

# - name: "Comment report"
# if: ${{ env.SHOULD_RUN == 'yes' && (failure() || success()) }}
# uses: ./.github/actions/wax
# with:
# body: "body test (docker)"
# github-token: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading