-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
test: skipping envoy coverage CI for E-M changes #24118
Conversation
af228f7
to
6344b7d
Compare
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
6344b7d
to
939900f
Compare
cc @phlax I'd like your thoughts on this I like what Enovy Mobile does to avoid spurious CI work: If SGTY I'll extend to skipping all tests for mobile (and if you'd like, docs)-only changes |
my ideal is that we can just run in reality, we are quite far off from that so i guess what we could probably do is run some early ci that puts vars into the azp namespace - ie |
canonical example for setting vars from inside tasks/steps variables:
- name: one
value: initialValue
steps:
- script: |
echo ${{ variables.one }} # outputs initialValue
echo $(one)
displayName: First variable pass
- bash: echo "##vso[task.setvariable variable=one]secondValue"
displayName: Set new variable value
- script: |
echo ${{ variables.one }} # outputs initialValue
echo $(one) # outputs secondValue
displayName: Second variable pass
|
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
32af813
to
ca15f9b
Compare
cc @phlax so more like this? |
Co-authored-by: phlax <phlax@users.noreply.github.com> Signed-off-by: alyssawilk <alyssar@google.com>
Co-authored-by: phlax <phlax@users.noreply.github.com> Signed-off-by: alyssawilk <alyssar@google.com>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
running some tests in #24204 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i ran some tests (with correct bools - apologies for incorrect advice previously) and seems to work - as you can also see in this PR it seems to detect that subsequent stages depend upon change_detection
@@ -23,8 +23,23 @@ variables: | |||
- name: isStableBranch | |||
# A release branch can be either `main` or a `release/v1.x` stable branch | |||
value: $[or(eq(variables['isMain'], 'true'), eq(variables['isReleaseBranch'], 'true'))] | |||
- name: nonMobileFilesChanged | |||
value: True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value: True | |
value: true |
steps: | ||
- bash: | | ||
git diff --name-only origin/main | grep -qe common/ \ | ||
|| echo "##vso[task.setvariable variable=nonMobileFilesChanged]False" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|| echo "##vso[task.setvariable variable=nonMobileFilesChanged]False" | |
|| echo "##vso[task.setvariable variable=nonMobileFilesChanged]false" |
@@ -339,6 +354,7 @@ stages: | |||
ciTarget: $(CI_TARGET) | |||
|
|||
- job: coverage | |||
condition: ne(variables['nonMobileFilesChanged'], '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
condition: ne(variables['nonMobileFilesChanged'], '') | |
condition: eq(variables['nonMobileFilesChanged'], true) |
vmImage: "ubuntu-20.04" | ||
steps: | ||
- bash: | | ||
git diff --name-only origin/main | grep -qe common/ \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git diff --name-only origin/main | grep -qe common/ \ | |
git diff origin/main..HEAD -- . :^mobile |
i think this is the correct diff for non-mobile changes (EDIT: its not correct) between HEAD
and main
- its still problematic tho as comparing to main
is incorrect on other branches - we want to compare to current target branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we really only want to run coverage when common/
changed then i think git diff origin/main..HEAD -- common/
- but then i think we rename the var
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinking about this we could skip coverage for a whole bunch of changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a much better (working) suggestion for the git command to the one above:
git diff-index --quiet origin/$(System.PullRequest.TargetBranch) :^mobile \
|| ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is still problematic as it only works on pull requests (comparing to main on main will always be empty so it would switch off postsubmit altogether if we only test on diffs to main/etc)
for main/release branches we probably want to compare to the last commit (or commit of last landed pr in case of release branches)
arggh testing this further and it would seem doing reading the docs more thoroughly seems to confirm this altho they also contradict what it does do this pattern can still be useful if for example we wanted to prevent some or all of the check jobs from running - we can still just check what has changed once and skip subsequent steps conditionally, we just cant do it across the entire pipeline |
hmm, actually does seem possible (see eg https://praveenkumarsreeram.com/2022/05/03/azure-devops-tips-and-tricks-5-how-to-pass-values-between-tasks-in-a-pipeline-using-task-setvariable-logging-command/) the variable needs to be set with ill test this further |
this turned out to be a bit more complex than i had realized and the azp interface is not the easiest to work with for these reasons ive created a PR to just add the change detection (with some docstrings on usage) here #24221 |
If this works, will apply to most Azure workflows.
Risk Level: low
Testing: n/a
Docs Changes: n/a
Release Notes: n/a
co-authored-by phlax