Skip to content

tests: add feature tagging workflow #15148

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

Conversation

maykathm
Copy link
Contributor

@maykathm maykathm commented Feb 27, 2025

Requires #15264
Requires #15091

This adds the ability to generate feature tags for a spread run in two ways:

  • Using the workflow dispatch in the new Feature Tagging workflow
  • Using the tag-features script

Both methods permit automatically rerunning spread and consolidating the ending results into system-by-system json files of features. In the workflow, the results are uploaded as an artifact, though this is a temporary measure since in the future the tags will instead be loaded into a DB elsewhere.

Both the run-spread additions and the workflow contain a rerunning mechanism to automatically rerun spread with the failed tests a maximum number of times. Once the workflow/run-spread script has finished all spread runs, including reruns, it will consolidate the feature tagging results into a single final json file for each system. It consolidates results by creating a final version with all tests run where more recent individual test results substitute the less recent.

@maykathm maykathm added the Skip spread Indicate that spread job should not run label Feb 27, 2025
Copy link

github-actions bot commented Feb 27, 2025

Tue Apr 8 07:39:18 UTC 2025

Spread tests skipped

@maykathm maykathm force-pushed the SNAPDENG-34441-add-feature-tagging-workflow branch 2 times, most recently from 3d46364 to 34ed733 Compare February 28, 2025 15:49
Copy link

codecov bot commented Feb 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (d6d95f0) to head (2074a83).
Report is 143 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #15148       +/-   ##
===========================================
- Coverage   78.09%        0   -78.10%     
===========================================
  Files        1190        0     -1190     
  Lines      158458        0   -158458     
===========================================
- Hits       123746        0   -123746     
+ Misses      27017        0    -27017     
+ Partials     7695        0     -7695     
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maykathm maykathm force-pushed the SNAPDENG-34441-add-feature-tagging-workflow branch from 34ed733 to 44ba42a Compare February 28, 2025 16:13
@maykathm maykathm marked this pull request as ready for review March 11, 2025 12:47
@maykathm maykathm force-pushed the SNAPDENG-34441-add-feature-tagging-workflow branch 6 times, most recently from ba0efa9 to 75369e9 Compare March 14, 2025 16:18
Copy link
Contributor

@zyga zyga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass. I'm kind of -1 on the python that looks more like perl in the sense that everything is a dict. Can we avoid that and actually use objects of some type (typedict is a hack but passable). If loading json is a problem we can sync to find a solution.

run-spread Outdated
if [ -z "$SPREAD_TAG_FEATURES" ]; then
SPREAD_USE_PREBUILT_SNAPD_SNAP=true exec spread "$@"
else
WRITE_DIR="/tmp/features"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, can we use a temp dir?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this would be for personal use, I thought tmp would be the best option.

@maykathm maykathm force-pushed the SNAPDENG-34441-add-feature-tagging-workflow branch 2 times, most recently from 56daeb9 to 49a5046 Compare March 21, 2025 10:41
Copy link
Contributor

@zyga zyga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2nd pass, thanks a lot for the improvements.

Marking as requested changes because a few small mistakes inline.

@maykathm maykathm force-pushed the SNAPDENG-34441-add-feature-tagging-workflow branch 8 times, most recently from 113c32b to 3ce2357 Compare April 2, 2025 07:18
@maykathm maykathm requested a review from zyga April 2, 2025 07:29
@maykathm maykathm force-pushed the SNAPDENG-34441-add-feature-tagging-workflow branch from bd7e53e to fd070a3 Compare April 4, 2025 16:01
@maykathm maykathm removed the Skip spread Indicate that spread job should not run label Apr 4, 2025
@maykathm maykathm closed this Apr 4, 2025
@maykathm maykathm reopened this Apr 4, 2025
Copy link
Contributor

@bboozzoo bboozzoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maykathm maykathm added the Skip spread Indicate that spread job should not run label Apr 7, 2025
@maykathm maykathm requested a review from sergiocazzolato April 7, 2025 14:40
@maykathm maykathm requested a review from sergiocazzolato April 8, 2025 07:04
Copy link
Collaborator

@sergiocazzolato sergiocazzolato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks

@sergiocazzolato sergiocazzolato merged commit 1aebd6b into canonical:master Apr 8, 2025
75 checks passed
maykathm added a commit to maykathm/snapd that referenced this pull request Apr 8, 2025
* tests: add feature-tagging workflow

* tests: add workflow rerun in case of failure

* tests: add feature-tag consolidation if spread task has been rerun

* tests: added feature tagging on master pushes of only changed tests

* tests: addressed review comments and changed tests name format from using '\' to using '--' to reflect changes in debug tagging PR

* github: added option to force the use of the rules file

* tests: create structures for features

* github: add feature extract to workflow

* github,tests,run-spread: fix name change and type check

* github: update workflows to paths in tests/utils/features directory

* run-spread, tests: move run-spread features logic to features directory

* github: fix reruns to reflect name (number of reruns are now actually reruns instead of runs)

* tests: change run-spread script to only contain feature tagging

* tests: correct unbound variable in tag-features

* tests, github: correct feature tag args

* github: corrected path ot featcomposer.py

* tests: correct RUN_TESTS passed to log-analyzer script and simplify passing features

* github: extract all feature-tagging logic to feature-tagging.yaml

* github: remove force rulesets

* github: use github upload action

* github: add run_id to spread artifact name
@maykathm maykathm deleted the SNAPDENG-34441-add-feature-tagging-workflow branch April 8, 2025 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip spread Indicate that spread job should not run
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants