Skip to content

Commit

Permalink
Merge remote-tracking branch 'sespiros/snap-integrity-remove-pack' in…
Browse files Browse the repository at this point in the history
…to snap-integrity-remove-pack

* sespiros/snap-integrity-remove-pack: (86 commits)
  multiple: remove dm-verity support from snap pack
  asserts: snap integrity assertion (canonical#14870)
  overlord: cleanup some old edges
  i/builtin: make auditd-support grant seccomp setpriority (canonical#14940)
  tests: use quotation marks to support directories with spaces (canonical#14948)
  t/m/snap-service-install-mode: fix line being longer than expected
  interfaces/opengl: Enable parsing of nvidia driver information files (canonical#14893)
  i/b/fwupd: allow access to dell bios recovery (canonical#14920)
  tests: divide spread into fundamental/non-fundamental (canonical#14785)
  c/snap-bootstrap: refactor systemd-mount dm-verity/overlayfs options API (canonical#14790)
  o/snapstate: do not restart again for snapd along the undo path inside undoUnlinkCurrentSnap (canonical#14917)
  release: 2.67.1
  tests: fix missing spread failures in PR comments (canonical#14931)
  i/prompting{,requestrules}: merge rules which have identical lifespans (canonical#14757)
  tests: skip apparmor-prompting-integration-tests in armhf (canonical#14919)
  cmd/snap-bootstrap: mount drivers tree if present (canonical#14522)
  i/p/patterns: disallow /./ and /../ in path patterns (canonical#14774)
  osutil/user: look up getent executable in known host directories (canonical#14792)
  overlord: wait for snapd restart after requesting by undo of 'link-snap' (canonical#14850)
  interfaces: update template with new syscalls (canonical#14861)
  ...
  • Loading branch information
sespiros committed Jan 23, 2025
2 parents a64d219 + 759bc4b commit a2be478
Show file tree
Hide file tree
Showing 181 changed files with 12,239 additions and 3,573 deletions.
137 changes: 137 additions & 0 deletions .github/workflows/spread-results-reporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Spread tests results PR commenter

on:
workflow_run:
workflows: [Tests]
types:
- completed

jobs:
report-spread-failures:
if: ${{ github.event.workflow_run.event == 'pull_request' }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get PR number
uses: actions/github-script@v6
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr_number"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data));
- name: Unzip PR number
run: unzip pr_number.zip

- name: Get generated data
uses: actions/github-script@v6
with:
script: |
let page = 1;
let per_page = 100;
let allArtifacts = [];
let response;
do {
response = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
per_page: per_page,
page: page
});
allArtifacts = allArtifacts.concat(response.data.artifacts);
page++;
} while (response.data.artifacts.length === per_page);
let matchingArtifacts = allArtifacts.filter((artifact) => {
return artifact.name.startsWith(`spread-json-${context.payload.workflow_run.id}-${context.payload.workflow_run.run_attempt}`);
});
for (let artifact of matchingArtifacts) {
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifact.name}.zip`, Buffer.from(download.data));
console.log(`Downloaded artifact: ${artifact.name}.zip`);
}
- name: Unzip spread json files
run: |
find . -name "spread-json-${{ github.event.workflow_run.id }}*.zip" | while read filename; do
dir="${filename%.zip}"
mkdir "$dir"
unzip "$filename" -d "$dir"
done
- name: Echo collected output
run: |
# generate report
(
date
# The 'skip spread' label was added to the pull request
if gh api /repos/${{ github.repository }}/issues/"$(cat pr_number)" | jq '.labels.[].name' | grep -iq '"skip spread"'; then
echo "## Spread tests skipped"
exit 0
fi
echo "The following results are from: https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}"
# There are no logged spread failures
if ! ls spread-json-${{ github.event.workflow_run.id }}-*/*.json &> /dev/null; then
echo '## No spread failures reported'
else
# There are logged spread failures
jq -s 'add' spread-json-${{ github.event.workflow_run.id }}*/*.json > consolidated-report.json
echo "## Failures:"
if [[ $(jq -r '.[] | select( .info_type == "Error" ) | select( .verb == "preparing" )' consolidated-report.json) ]]; then
echo "### Preparing:"
jq -r '.[] | select( .info_type == "Error" ) | select( .verb == "preparing" ) .task' consolidated-report.json |\
awk ' { print "- " $0 }'
fi
if [[ $(jq -r '.[] | select( .info_type == "Error" ) | select( .verb == "executing" )' consolidated-report.json) ]]; then
echo "### Executing:"
jq -r '.[] | select( .info_type == "Error" ) | select( .verb == "executing" ) .task' consolidated-report.json |\
awk ' { print "- " $0 }'
fi
if [[ $(jq -r '.[] | select( .info_type == "Error" ) | select( .verb == "restoring" )' consolidated-report.json) ]]; then
echo "### Restoring:"
jq -r '.[] | select( .info_type == "Error" ) | select( .verb == "restoring" ) .task' consolidated-report.json |\
awk ' { print "- " $0 }'
fi
fi
) > report
# display the report
grep -n '' report
- name: Comment report to PR
run: |
if ! gh pr comment "$(cat pr_number)" --body "$(cat report)" --edit-last; then
gh pr comment "$(cat pr_number)" --body "$(cat report)"
fi
27 changes: 23 additions & 4 deletions .github/workflows/spread-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ on:
description: 'The rule .yaml file to use (found under tests/lib/spread/rules) for test discovery'
required: true
type: string
is-fundamental:
description: 'If true, then will mark results as from fundamental systems when uploading to Grafana'
required: false
type: boolean
default: false
use-snapd-snap-from-master:
description: 'If true, will use the snapd snap built on the master branch'
required: false
Expand All @@ -33,8 +38,7 @@ on:
spread-snapd-deb-from-repo:
description: 'If true, will use the snapd package from the repository when possible'
required: false
type: boolean
default: true
type: string
spread-experimental-features:
description: 'Comma-separated list of experimental snapd features to enable with: snap set system "experimental.<feature-name>=true"'
required: false
Expand All @@ -44,7 +48,6 @@ on:
jobs:
run-spread:
env:
SPREAD_SNAPD_DEB_FROM_REPO: ${{ inputs.spread-snapd-deb-from-repo }}
SPREAD_EXPERIMENTAL_FEATURES: ${{ inputs.spread-experimental-features }}

runs-on: ${{ fromJSON(inputs.runs-on) }}
Expand Down Expand Up @@ -73,6 +76,10 @@ jobs:
# spread uses tags as delta reference
fetch-depth: 0

- name: set SPREAD_SNAPD_DEB_FROM_REPO=1
if: ${{ inputs.spread-snapd-deb-from-repo == 'true' }}
run: echo "SPREAD_SNAPD_DEB_FROM_REPO=1" >> $GITHUB_ENV

- name: Get previous attempt
id: get-previous-attempt
run: |
Expand Down Expand Up @@ -176,7 +183,11 @@ jobs:
if [ -z "$CHANGE_ID" ]; then
CHANGE_ID="main"
fi
FILTERED_LOG_FILE="spread_${CHANGE_ID}_n${{ github.run_attempt }}.filtered.log"
fundamental=""
if [ "${{ inputs.is-fundamental }}" = 'true' ]; then
fundamental="fund"
fi
FILTERED_LOG_FILE="spread_${CHANGE_ID}_${fundamental}_n${{ github.run_attempt }}.filtered.log"
# The log-filter tool is used to filter the spread logs to be stored
echo FILTER_PARAMS="-o $FILTERED_LOG_FILE -e Debug -e WARNING: -f Failed=NO_LINES -f Error=NO_LINES" >> $GITHUB_ENV
echo FILTERED_LOG_FILE="$FILTERED_LOG_FILE" >> $GITHUB_ENV
Expand Down Expand Up @@ -340,3 +351,11 @@ jobs:
with:
path: "${{ github.workspace }}/.test-results"
key: "${{ github.job }}-results-${{ github.run_id }}-${{ inputs.group }}-${{ github.run_attempt }}"

- name: Save spread.json as an artifact
if: ${{ always() && github.event.pull_request.number }}
uses: actions/upload-artifact@v4
with:
name: "spread-json-${{ github.run_id }}-${{ github.run_attempt }}-${{ inputs.group }}"
path: "spread-results.json"
if-no-files-found: ignore
Loading

0 comments on commit a2be478

Please sign in to comment.