Skip to content
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

Improve CI path-changes-based-triggers to work better #79127

Merged
merged 19 commits into from
Feb 7, 2023

Conversation

radical
Copy link
Member

@radical radical commented Dec 2, 2022

Background:

eng/pipelines/common/evaluate-default-paths.yml is used to specify named subsets of paths, and evaluate-changed-paths.sh decides which subsets have "changed files". And these subsets are used in conditions for the various jobs to determine when they should be run.


evaluate-changed-paths.sh: Add support for include+exclude combined

Problem

This script currently supports --include, and --exclude
parameters to determine if we have any changed paths.

Scenarios:
1. exclude paths are specified
    Will include all paths except the ones in the exclude list.
2. include paths are specified
    Will only include paths specified in the list.
1st we evaluate changes for all paths except ones in excluded list. If we can not find
any applicable changes like that, then we evaluate changes for included paths
if any of these two finds changes, then a variable will be set to true.

As described above, these two are evaluated exclusively.
For example:

include: [ '/a/b/*' ], exclude: [ '/a/b/d.txt' ]
  • This would return true if there are changes:

    • [ '/a/b/c.txt' ] - caught by include
    • or [ '/r/s.txt' ] - caught by exclude
  • but it would also return true for [ '/a/b/d.txt' ] because include
    does not consider the exclude list.

Solution:

  • This commit adds a new --combined parameter which essentially supports
    $include - $exclude. Thus allowing exact more constrained path
    specification.

  • It is passed in addition to include, and exclude.

Given:

include: [ '/a/b/*' ], exclude: [ '/a/b/d.txt' ]
  • For the following path changes:
    • [ '/a/b/c.txt' ] - true
    • [ '/r/s.txt' ] - false because this does not fall in
      $include - $exclude
    • [ '/a/b/d.txt' ] - false - excluded in $include - $exclude

The implementation is trivially implemented by passing both the lists to
git diff which supports this already.


  • Track subset name changes in the ymls

  • Update wasm jobs to have tighter trigger conditions

  • This results in wasm specific changes only triggering relevant wasm jobs. For example, if there are wasm debugger changes then only the wasm debugger jobs will be triggered. Or if there are only workload manifest[1] changes then Wasm.Build.Tests will be triggered only.

@ghost
Copy link

ghost commented Dec 2, 2022

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Issue Details

-- WIP --

Author: radical
Assignees: -
Labels:

area-Infrastructure

Milestone: -

@ghost ghost assigned radical Dec 2, 2022
@radical
Copy link
Member Author

radical commented Dec 2, 2022

reviving an old branch

This script currently supports `--include`, and `--exclude`
parameters to determine if we have any changed paths.

```
Scenarios:
  1. exclude paths are specified
      Will include all paths except the ones in the exclude list.
  2. include paths are specified
      Will only include paths specified in the list.
  1st we evaluate changes for all paths except ones in excluded list. If we can not find
  any applicable changes like that, then we evaluate changes for included paths
  if any of these two finds changes, then a variable will be set to true.
```

As described above, these two are evaluated exclusively.
For example:

```
include: [ '/a/b/*' ], exclude: [ '/a/b/d.txt' ]
```

- This would return true if there are changes:
    - [ '/a/b/c.txt' ] - caught by `include`
    - or [ '/r/s.txt' ] - caught by `exclude`

- but it would also return true for `[ '/a/b/d.txt' ]` because `include`
  does not consider the `exclude` list.

Solution:

- This commit adds a new `--combined` parameter which essentially supports
`$include - $exclude`. Thus allowing exact more constrained path
specification.

- It is passed in addition to `include`, and `exclude`.

Given:
```
include: [ '/a/b/*' ], exclude: [ '/a/b/d.txt' ]
```

- For the following path changes:
    - [ '/a/b/c.txt' ] - `true`
    - [ '/r/s.txt' ] - `false` because this does not fall in
      `$include - $exclude`
    - [ '/a/b/d.txt' ] - `false` - excluded in `$include - $exclude`

The implementation is trivially implemented by passing both the lists to
`git diff` which supports this already.
…ries, and non_wasm. Add wasm_specific_except_wbt_dbg
@radical
Copy link
Member Author

radical commented Dec 5, 2022

@radical
Copy link
Member Author

radical commented Dec 5, 2022

Reviewing individual commits should be easier.

@radical radical changed the title Improve CI triggers to work better Improve CI path-changes-based-triggers to work better Dec 6, 2022
@radical radical requested a review from trylek December 6, 2022 04:20
@radical radical marked this pull request as ready for review December 6, 2022 18:35
@radical
Copy link
Member Author

radical commented Dec 8, 2022

Any objections to this?

@agocke
Copy link
Member

agocke commented Dec 8, 2022

I haven't reviewed the actual code yet, but I wonder why there needs to be a new --combined parameter. The way you described it, it sounds like the --combined behavior is the expected behavior, and the behavior we have now is unintuitive. Do we want to just take a breaking change and remap as necessary?

@radical
Copy link
Member Author

radical commented Dec 8, 2022

I haven't reviewed the actual code yet, but I wonder why there needs to be a new --combined parameter. The way you described it, it sounds like the --combined behavior is the expected behavior, and the behavior we have now is unintuitive.

True. I was expecting the existing behavior to be like --combined, but that wasn't the case. And the various job conditions seem to depend on this difference too. Since, we don't really have any kind of automated tests for this I'm taking the slow approach, and changing only what I can test myself - (mostly) wasm builds, and can track.

In the past with similar changes, we had situations where triggers for some non-wasm builds got disabled as an unintended side-effect, and I'm not familiar with all the builds to be 100% sure here.

Do we want to just take a breaking change and remap as necessary?

Maybe we can take the extra parameter for now. And the various area owners can gradually move their builds to this, and then eventually we make this the default:) The only include, and only exclude cases could be expressed with a default --combined too, by splitting the lists, probably reducing readability? I would prefer that the owners for those builds make the changes though!

@radical
Copy link
Member Author

radical commented Dec 8, 2022

A tool could possibly be written that would read the subsets, and check the conditions for all the jobs against that. Check for things like the expected list of jobs being triggered by path changes, and dependent jobs also being triggered etc.

@radical
Copy link
Member Author

radical commented Jan 17, 2023

ping @akoeplinger @ViktorHofer @trylek @agocke for review

@ViktorHofer
Copy link
Member

This shouldn't impact official builds but just to be sure, can we wait with merging this in until next week when we branched-off for P1? Dependency flow is already complicated enough and I believe this change falls under the "general infrastructure improvement" bucket that isn't necessary to merge in for Preview 1. Does that make sense?

@radical
Copy link
Member Author

radical commented Jan 17, 2023

Yes, this can wait for the branch. Thank you for taking a look 👍

@radical
Copy link
Member Author

radical commented Feb 6, 2023

ping @akoeplinger @ViktorHofer @trylek @agocke for review

Copy link
Member

@akoeplinger akoeplinger left a comment

Choose a reason for hiding this comment

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

LGTM with one comment

eng/pipelines/runtime-official.yml Outdated Show resolved Hide resolved
@radical
Copy link
Member Author

radical commented Feb 7, 2023

The Evaluate paths job is running successfully on the pipelines. And there are no yml errors on azdo.
Since this is a CI only change, running all the jobs won't add any value, I'll merge this now.

@radical radical merged commit 3b48453 into dotnet:main Feb 7, 2023
@radical radical deleted the ci-wasm-triggers-anew branch February 7, 2023 20:49
@ghost ghost locked as resolved and limited conversation to collaborators Mar 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants