35
35
required : false
36
36
default : false
37
37
type : boolean
38
+ outputs :
39
+ artifact :
40
+ description : " Artifact generated by this job"
41
+ value : ${{ jobs.test.outputs.artifact }}
38
42
39
43
env :
40
44
GOTOOLCHAIN : local
55
59
defaults :
56
60
run :
57
61
shell : bash
62
+ outputs :
63
+ artifact : ${{ steps.artifact-upload.outputs.artifact-url }}
58
64
59
65
env :
60
66
# https://github.com/containerd/nerdctl/issues/622
@@ -158,12 +164,12 @@ jobs:
158
164
# Besides, each job is running on a different instance, which means using host network here
159
165
# is safe and has no side effects on others.
160
166
[ "${{ 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)
163
169
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 }}
165
171
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 }}
167
173
fi
168
174
# FIXME: this NEEDS to go away
169
175
- name : " Run: integration tests (flaky)"
@@ -172,18 +178,94 @@ jobs:
172
178
github::md::h2 "flaky" >> "$GITHUB_STEP_SUMMARY"
173
179
174
180
[ "${{ 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)
177
183
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 }}
179
185
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 }}
181
187
fi
182
188
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() }}
185
202
uses : actions/upload-artifact@v4
186
203
with :
187
- name : " System logs"
188
- path : ~/debug-logs.tar.gz
204
+ path : ~/report/*
189
205
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
+ # }
0 commit comments