Skip to content

Commit 58443cd

Browse files
committed
Commenter
Signed-off-by: apostasie <spam_blackhole@farcloser.world>
1 parent 57031b1 commit 58443cd

File tree

13 files changed

+427
-103
lines changed

13 files changed

+427
-103
lines changed

.github/actions/wax/action.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "Wax: commenting component"
2+
3+
description: "A simple reporter adding or updating a comment on PRs."
4+
5+
inputs:
6+
body:
7+
default: "Body of the comment"
8+
description: "Body of the comment"
9+
github-token:
10+
description: "Auth token"
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Commenting
16+
uses: actions/github-script@v7
17+
with:
18+
github-token: ${{inputs.github-token}}
19+
script: |
20+
let comments = await github.rest.issues.listComments({
21+
issue_number: context.issue.number,
22+
owner: context.repo.owner,
23+
repo: context.repo.repo,
24+
})
25+
26+
let found = 0
27+
let body = ""
28+
comments.data.forEach(function(comment){
29+
if (comment.user.login === context.repo.login) {
30+
found = comment.id
31+
body = comment.body
32+
}
33+
})
34+
35+
if (found === 0){
36+
github.rest.issues.createComment({
37+
issue_number: context.issue.number,
38+
owner: context.repo.owner,
39+
repo: context.repo.repo,
40+
body: "${{ inputs.body }}\n"
41+
})
42+
}else{
43+
github.rest.issues.updateComment({
44+
comment_id: found,
45+
owner: context.repo.owner,
46+
repo: context.repo.repo,
47+
body: body + "\n${{ inputs.body }}\n"
48+
})
49+
}

.github/matchers/tigron.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "tigron",
5+
"pattern": [
6+
{
7+
"regexp": "^([^:]+):(\\d+):(\\d+):\\s+(error|warning):\\s+(.*)$",
8+
"severity": 1,
9+
"file": 2,
10+
"line": 3,
11+
"column": 4,
12+
"message": 5
13+
}
14+
]
15+
}
16+
]
17+
}

.github/workflows/job-test-in-container.yml

Lines changed: 94 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ on:
3535
required: false
3636
default: false
3737
type: boolean
38+
outputs:
39+
artifact:
40+
description: "Artifact generated by this job"
41+
value: ${{ jobs.test.outputs.artifact }}
3842

3943
env:
4044
GOTOOLCHAIN: local
@@ -55,6 +59,8 @@ jobs:
5559
defaults:
5660
run:
5761
shell: bash
62+
outputs:
63+
artifact: ${{ steps.artifact-upload.outputs.artifact-url }}
5864

5965
env:
6066
# https://github.com/containerd/nerdctl/issues/622
@@ -158,12 +164,12 @@ jobs:
158164
# Besides, each job is running on a different instance, which means using host network here
159165
# is safe and has no side effects on others.
160166
[ "${{ inputs.target }}" == "rootful" ] \
161-
&& args=(test-integration ./hack/test-integration.sh -test.allow-modify-users=true) \
162-
|| args=(test-integration-${{ inputs.target }} /test-integration-rootless.sh ./hack/test-integration.sh)
167+
&& args=(test-integration ./hack/testing/integration.sh -test.allow-modify-users=true) \
168+
|| args=(test-integration-${{ inputs.target }} /test-integration-rootless.sh ./hack/testing/integration.sh)
163169
if [ "${{ inputs.ipv6 }}" == true ]; then
164-
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 }}
170+
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 }}
165171
else
166-
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 }}
172+
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 }}
167173
fi
168174
# FIXME: this NEEDS to go away
169175
- name: "Run: integration tests (flaky)"
@@ -172,18 +178,94 @@ jobs:
172178
github::md::h2 "flaky" >> "$GITHUB_STEP_SUMMARY"
173179
174180
[ "${{ inputs.target }}" == "rootful" ] \
175-
&& args=(test-integration ./hack/test-integration.sh) \
176-
|| args=(test-integration-${{ inputs.target }} /test-integration-rootless.sh ./hack/test-integration.sh)
181+
&& args=(test-integration ./hack/testing/integration.sh) \
182+
|| args=(test-integration-${{ inputs.target }} /test-integration-rootless.sh ./hack/testing/integration.sh)
177183
if [ "${{ inputs.ipv6 }}" == true ]; then
178-
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 }}
184+
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 }}
179185
else
180-
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 }}
186+
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 }}
181187
fi
182188
183-
- name: Logs
184-
if: ${{ failure() }}
189+
- name: "Wrap: collect logs"
190+
if: ${{ failure() || success() }}
191+
run: |
192+
# Get the reports from inside the containers
193+
[ "${{ inputs.target }}" == "rootful" ] && src=/root || src=/home/rootless
194+
mkdir -p ~/report
195+
docker cp test-runner:$src/nerdctl-test-report ~/report/main || true
196+
# Flaky may not have run
197+
docker cp test-runner-flaky:$src/nerdctl-test-report ~/report/flaky 2>/dev/null || true
198+
199+
- name: "Wrap: upload artifact"
200+
id: artifact-upload
201+
if: ${{ failure() || success() }}
185202
uses: actions/upload-artifact@v4
186203
with:
187-
name: "System logs"
188-
path: ~/debug-logs.tar.gz
204+
path: ~/report/*
189205
retention-days: 1
206+
# name: logs-${{ inputs.binary }}-${{ inputs.target }}-${{ inputs.runner }}-${{ inputs.ipv6 }}-${{ inputs.canary }}-${{ inputs.containerd-version }}-${{ inputs.rootlesskit-version }}
207+
208+
# - name: Annotate
209+
# if: ${{ failure() || success() }}
210+
# run: |
211+
# echo "::add-matcher::.github/matchers/tigron.json"
212+
# echo "::error title=ErrorReport::MEH .github/workflows/job-test-in-host.yml${{steps.artifact-upload.outputs.artifact-url}}"
213+
# echo "::notice title=NoticeReport::SHEESH ${{steps.artifact-upload.outputs.artifact-url}}"
214+
# echo "::error file=cmd/nerdctl/main_test_test.go,line=1,endLine=10,title=AgainErrorReport::FOO ${{steps.artifact-upload.outputs.artifact-url}}"
215+
# echo "::error file=cmd/nerdctl/main_test.go,line=38,endLine=41,title=AgainErrorReport::BLA ${{steps.artifact-upload.outputs.artifact-url}}"
216+
# echo "Error: TestFooFoo "
217+
# pwd
218+
# ls -lA cmd/nerdctl/main_test_test.go || true
219+
# # ::workflow-command parameter1={data},parameter2={data}::{command value}
220+
# echo "::remove-matcher owner=tigron::"
221+
#
222+
# GITHUB_RUN_ATTEMPT
223+
# GITHUB_RUN_ID
224+
# GITHUB_RUN_NUMBER
225+
# GITHUB_SHA
226+
227+
228+
# - name: "Comment report"
229+
# if: ${{ failure() }}
230+
# uses: ./.github/actions/wax
231+
# with:
232+
# body: "body test (in-container)"
233+
# github-token: ${{ secrets.GITHUB_TOKEN }}
234+
# steps.artifact-upload.outputs.artifact-url
235+
236+
# - name: Commenting
237+
# if: ${{ failure() || success() }}
238+
# uses: actions/github-script@v7
239+
# with:
240+
# github-token: ${{ secrets.GITHUB_TOKEN }}
241+
# script: |
242+
# let comments = await github.rest.issues.listComments({
243+
# issue_number: context.issue.number,
244+
# owner: context.repo.owner,
245+
# repo: context.repo.repo,
246+
# })
247+
#
248+
# let found = 0
249+
# let body = ""
250+
# comments.data.forEach(function(comment){
251+
# if (comment.user.login === context.repo.login) {
252+
# found = comment.id
253+
# body = comment.body
254+
# }
255+
# })
256+
#
257+
# if (found === 0){
258+
# github.rest.issues.createComment({
259+
# issue_number: context.issue.number,
260+
# owner: context.repo.owner,
261+
# repo: context.repo.repo,
262+
# body: "${{steps.artifact-upload.outputs.artifact-url}}\n"
263+
# })
264+
# }else{
265+
# github.rest.issues.updateComment({
266+
# comment_id: found,
267+
# owner: context.repo.owner,
268+
# repo: context.repo.repo,
269+
# body: body + "${{steps.artifact-upload.outputs.artifact-url}}\n"
270+
# })
271+
# }

.github/workflows/job-test-in-host.yml

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ on:
4343
linux-cni-sha:
4444
required: true
4545
type: string
46+
outputs:
47+
artifact:
48+
description: "Artifact generated by this job"
49+
value: ${{ jobs.test.outputs.artifact }}
4650

4751
env:
4852
GOTOOLCHAIN: local
@@ -60,6 +64,8 @@ jobs:
6064
defaults:
6165
run:
6266
shell: bash
67+
outputs:
68+
artifact: ${{ steps.artifact-upload.outputs.artifact-url }}
6369

6470
env:
6571
SHOULD_RUN: "yes"
@@ -183,22 +189,33 @@ jobs:
183189
make install-dev-tools
184190
echo "::endgroup::"
185191
192+
193+
- if: ${{ env.SHOULD_RUN == 'yes' }}
194+
name: "Init: prepare artifacts directories"
195+
run: |
196+
mkdir -p ~/report/main
197+
mkdir -p ~/report/ipv6
198+
mkdir -p ~/report/flaky
199+
186200
# ipv6 is tested only on linux
187-
- if: ${{ contains(inputs.runner, 'ubuntu') && env.SHOULD_RUN == 'yes' }}
201+
- if: ${{ env.SHOULD_RUN == 'yes' && contains(inputs.runner, 'ubuntu' )}}
188202
name: "Run (linux): integration tests (IPv6)"
189203
run: |
190204
. ./hack/github/action-helpers.sh
191205
github::md::h2 "ipv6" >> "$GITHUB_STEP_SUMMARY"
192206
193-
./hack/test-integration.sh -test.target=${{ inputs.binary }} -test.only-ipv6
207+
ln -s ~/report/ipv6 ~/nerdctl-test-report
208+
./hack/testing/integration.sh -test.target=${{ inputs.binary }} -test.only-ipv6
194209
195210
- if: ${{ env.SHOULD_RUN == 'yes' }}
196211
name: "Run: integration tests"
197212
run: |
198213
. ./hack/github/action-helpers.sh
199214
github::md::h2 "non-flaky" >> "$GITHUB_STEP_SUMMARY"
200215
201-
./hack/test-integration.sh -test.target=${{ inputs.binary }} -test.only-flaky=false
216+
rm -f ~/nerdctl-test-report
217+
ln -s ~/report/main ~/nerdctl-test-report
218+
./hack/testing/integration.sh -test.target=${{ inputs.binary }} -test.only-flaky=false
202219
203220
# FIXME: this must go
204221
- if: ${{ env.SHOULD_RUN == 'yes' }}
@@ -207,4 +224,41 @@ jobs:
207224
. ./hack/github/action-helpers.sh
208225
github::md::h2 "flaky" >> "$GITHUB_STEP_SUMMARY"
209226
210-
./hack/test-integration.sh -test.target=${{ inputs.binary }} -test.only-flaky=true
227+
rm -f ~/nerdctl-test-report
228+
ln -s ~/report/flaky ~/nerdctl-test-report
229+
./hack/testing/integration.sh -test.target=${{ inputs.binary }} -test.only-flaky=true
230+
231+
- name: "Wrap: upload artifact"
232+
id: artifact-upload
233+
if: ${{ env.SHOULD_RUN == 'yes' && (failure() || success()) }}
234+
uses: actions/upload-artifact@v4
235+
with:
236+
path: ~/report/*
237+
retention-days: 1
238+
239+
# name: logs-${{ inputs.binary }}-${{ inputs.runner }}-${{ inputs.canary }}
240+
# - name: "DEBUG"
241+
# if: ${{ env.SHOULD_RUN == 'yes' && (failure() || success()) }}
242+
# run: |
243+
# ls -lAR ~/report
244+
#
245+
# - name: Annotate
246+
# if: ${{ failure() || success() }}
247+
# run: |
248+
# echo "::add-matcher::.github/matchers/tigron.json"
249+
# echo "::error title=ErrorReport::MEH .github/workflows/job-test-in-host.yml${{steps.artifact-upload.outputs.artifact-url}}"
250+
# echo "::notice title=NoticeReport::SHEESH ${{steps.artifact-upload.outputs.artifact-url}}"
251+
# echo "::error file=cmd/nerdctl/main_test_test.go,line=1,endLine=10,title=AgainErrorReport::FOO ${{steps.artifact-upload.outputs.artifact-url}}"
252+
# echo "::error file=cmd/nerdctl/main_test.go,line=38,endLine=41,title=AgainErrorReport::BLA ${{steps.artifact-upload.outputs.artifact-url}}"
253+
# echo "Error: TestFooFoo "
254+
# pwd
255+
# ls -lA cmd/nerdctl/main_test_test.go || true
256+
# # ::workflow-command parameter1={data},parameter2={data}::{command value}
257+
# echo "::remove-matcher owner=tigron::"
258+
259+
# - name: "Comment report"
260+
# if: ${{ env.SHOULD_RUN == 'yes' && (failure() || success()) }}
261+
# uses: ./.github/actions/wax
262+
# with:
263+
# body: "body test (docker)"
264+
# github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/job-test-in-lima.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,18 @@ jobs:
104104
set -eux
105105
if [ "$TARGET" = "rootless" ]; then
106106
echo "rootless"
107-
docker run -t -v /dev:/dev --rm --privileged test-integration /test-integration-rootless.sh ./hack/test-integration.sh -test.only-flaky=false
107+
docker run -t -v /dev:/dev --rm --privileged test-integration /test-integration-rootless.sh ./hack/testing/integration.sh -test.only-flaky=false
108108
else
109109
echo "rootful"
110-
docker run -t -v /dev:/dev --rm --privileged test-integration ./hack/test-integration.sh -test.only-flaky=false
110+
docker run -t -v /dev:/dev --rm --privileged test-integration ./hack/testing/integration.sh -test.only-flaky=false
111111
fi
112112
- name: "Run: integration tests (flaky)"
113113
run: |
114114
set -eux
115115
if [ "$TARGET" = "rootless" ]; then
116116
echo "rootless"
117-
docker run -t -v /dev:/dev --rm --privileged test-integration /test-integration-rootless.sh ./hack/test-integration.sh -test.only-flaky=true
117+
docker run -t -v /dev:/dev --rm --privileged test-integration /test-integration-rootless.sh ./hack/testing/integration.sh -test.only-flaky=true
118118
else
119119
echo "rootful"
120-
docker run -t -v /dev:/dev --rm --privileged test-integration ./hack/test-integration.sh -test.only-flaky=true
120+
docker run -t -v /dev:/dev --rm --privileged test-integration ./hack/testing/integration.sh -test.only-flaky=true
121121
fi

.github/workflows/workflow-test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,24 @@ jobs:
147147
containerd-service-sha: 1941362cbaa89dd591b99c32b050d82c583d3cd2e5fa63085d7017457ec5fca8
148148
linux-cni-version: v1.7.1
149149
linux-cni-sha: 1a28a0506bfe5bcdc981caf1a49eeab7e72da8321f1119b7be85f22621013098
150+
151+
reporter:
152+
name: "reporter${{ inputs.hack }}"
153+
needs:
154+
# - test-integration-container
155+
- test-integration-host
156+
runs-on: ubuntu-24.04
157+
steps:
158+
- name: Download all workflow run artifacts
159+
uses: actions/download-artifact@v4
160+
with:
161+
path: ~/report
162+
- name: Process
163+
run: |
164+
echo $GITHUB_RUN_ATTEMPT
165+
echo $GITHUB_RUN_ID
166+
echo $GITHUB_RUN_NUMBER
167+
echo $GITHUB_SHA
168+
git diff main..$GITHUB_SHA || true
169+
ls -lA ~/report || true
170+
exit 1

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ RUN curl -o nydus-static.tgz -fsSL --proto '=https' --tlsv1.2 "https://github.co
350350
tar xzf nydus-static.tgz && \
351351
mv nydus-static/nydus-image nydus-static/nydusd nydus-static/nydusify /usr/bin/ && \
352352
rm nydus-static.tgz
353-
CMD ["./hack/test-integration.sh"]
353+
CMD ["./hack/testing/integration.sh"]
354354

355355
FROM test-integration AS test-integration-rootless
356356
# Install SSH for creating systemd user session.
@@ -373,7 +373,7 @@ RUN systemctl disable test-integration-ipfs-offline
373373
VOLUME /home/rootless/.local/share
374374
COPY ./Dockerfile.d/test-integration-rootless.sh /
375375
RUN chmod a+rx /test-integration-rootless.sh
376-
CMD ["/test-integration-rootless.sh", "./hack/test-integration.sh"]
376+
CMD ["/test-integration-rootless.sh", "./hack/testing/integration.sh"]
377377

378378
# test for CONTAINERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=slirp4netns
379379
FROM test-integration-rootless AS test-integration-rootless-port-slirp4netns

0 commit comments

Comments
 (0)