-
Notifications
You must be signed in to change notification settings - Fork 64
[DRAFT] VMR Verification in SBRP PRs #1262
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
base: main
Are you sure you want to change the base?
Conversation
Hmm, default value for The alternative would be to rename this pipeline to be Another option would be to have a different template for source-only builds. Pipelines would reference the template that is most appropriate for the repo, i.e. all legs, source-only, Windows-only, etc. |
I'm not fond of a name convention based approach. It is not intuitive and doesn't provide a very good UX for changing the configuration down the road. It would be nice to have a scalable solution that would solve all future scenarios e.g. Windows only legs, single linux leg, etc. plus a combination of configurations Could the parameters be changed to variables which can then be saved in the AzDO pipeline configuration? |
Thanks - yes we could use variables instead - will test it out, and expand for other scenarios. |
/azp run source-build-reference-packages-unified-build |
Azure Pipelines failed to run 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
5d7d402
to
deb23a7
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s), but failed to run 1 pipeline(s). |
11e972c
to
6494c6a
Compare
6494c6a
to
c43bc28
Compare
So, this works, but it is a draft PR and will not be merged. |
Based on the comment above (#1262 (comment)) I've investigated what is possible and implemented a solution using one of the available options. There is a different way to solve this, and I wanted to to call out those two options and close on this, as it will become a plan for other types of build job conditioning. We want to allow repos to run VMR Verification of the smaller set of jobs, than what is a default set for PRs. For instance, in this repo, This variable is a runtime variable, and can only be used in a limited number of places and scenarios, due to the following:
Based on the goal and constraints, there are 2 options:
Option 1 seems cleaner as all unified-build jobs get conditioned with a single In this case, where we want to skip all unified-build stages/jobs, I prefer option 1, as it seems a better way to condition larger groups of stages/jobs. In a different case, where we, for instance, want to only run Windows jobs, we could also use a parameter, to pass it around templates, or we could use the runtime variable directly in Runtime variable name could be more descriptive - instead of @ViktorHofer @MichaelSimons @mmitche what do you think of this model and proposal for conditioning VMR build jobs? We do have an issue tracking a request for allowing a scoped-down builds of unified-build pipeline: dotnet/dotnet#1068 This PR, and dependent VMR changes, will contribute to that work. |
I think Option 1 is the more attractive option. With this option, is it possible to define the parameter as a bool and do a conversion? This could be extended to support casing variants.
|
It's not possible unfortunately, as conversion to bool would happen at compile-time. I also tried the option that was suggested by Copilot - Here's what I got in a chat:
Runtime variable can be used to conditionally include a stage or template - option 2 above. But, cannot be converted to boolean in a compile-time conversion, to be passed in to a template. This is a really unfortunate constraint. |
Another option (already discussed) would be to, rather than having eng/common/vmr-build-pr.yml be the root YAML for the job, have a repo implement a stub. The stub would have the triggers and call vmr-build-pr.yml, specifying that this is a repo that only needs source-build legs.
Is it possible to use the conditional include of a template to include a variables template which defines boolean typed variables, which then get used? Therefore you're not actually converting the variable directly to a boolean. |
This is interesting and likely a cleaner option, as we'd be able to use bool parameter in vmr templates. It also aids maintainability as it's easier to update the YML than to request an update pipeline configuration - something that is not owned by the repo owners. @MichaelSimons @ViktorHofer any opinion on this approach? It makes pipeline yml and intent more clear and descriptive, and any modification becomes straightforward. I will modify the pending VMR PR accordingly, based on feedback.
I believe those variables are evaluated at compile-time. It's worth a check. |
I think this is worthwhile. I would like to see what this would look like. |
Will prepare a draft PR to test this out. |
Here's how the changes would look: c51f6bf With this approach, we would be adding a requirement for another repo-specific YML. Various elements need to be moved to this new YML, including This would diminish the value of the current shared pipeline YML. The benefit is that we can use YML |
The root pipeline is still a template that is easy to copy between repos, so no concerns there. One suggestion is that I would avoid going with booleans to conditionalize the VMR PR testing that is performed. Instead, long term it may be cleaner to pass this info as a list. e.g.:
|
Yeah, I agree with a list of verifications, and the intent to use these types of checks for PR verification jobs only. The alternative would be to use these conditions for every job we run, which would make YMLs much harder to read. However, This would imply that we need the following default list of items::
We'd end up with something list this:
|
I don't think you'd need the default list to exist in both templates. You'd set the default in the outer template to something like |
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
/azp run source-build-reference-packages-unified-build |
Azure Pipelines successfully started running 1 pipeline(s). |
You'd check for the value. I've used this pattern a few times in the VMR. The outer pipeline has a parameter for signing, say, with a string "Default to whatever the default for this branch is". Then the variables template checks for that value and re-interprets it as the appropriate value. |
I've seen that and it might work, we'd use some magic value of this parameter for reinterpretation, i.e. The alternative is to compress the 3 levels of templates I called above, and only have 2, repo-specific template, that directly references the VMR template. Then we could pass the
If we used a |
/azp run source-build-reference-packages-unified-build |
Azure Pipelines failed to run 1 pipeline(s). |
/azp run source-build-reference-packages-unified-build |
Azure Pipelines failed to run 1 pipeline(s). |
OK, it seems that we cannot have stages with zero jobs: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1066571&view=results So, I need to also condition stages. My initial attempt at implementing the Parameter definition:
I've conditioned individual verification jobs with conditions like the following:
We need to condition stages as well, to ensure we don't end up with stages without jobs. We likely do not want to have a big condition to check for all possible jobs that start with
Unified build stage(s) would be conditioned with:
Parameter list would then become:
Or alternatively, we could keep the |
@NikolaMilosavljevic I think you can keep your nicely prefixed items, which I think are more readable. I think you can do the following when conditionalizing the stages:
That joins all elements of the verifications array to one string separated by |
/azp run source-build-reference-packages-unified-build |
Azure Pipelines failed to run 1 pipeline(s). |
/azp run source-build-reference-packages-unified-build |
Azure Pipelines failed to run 1 pipeline(s). |
/azp run source-build-reference-packages-unified-build |
Azure Pipelines successfully started running 1 pipeline(s). |
Here are the final changes that work: dotnet/dotnet@main...vmrverification.list Full verification build was successful: https://dev.azure.com/dnceng/internal/_build/results?buildId=2729174&view=results I will test few more repo-side options in this PR and switch to a repo-specific pipeline yml - we will get rid of shared arcade yml. |
This looks good. One thing that I just realized is that we should split the source-build verification into stage1 and stage2. SBRP should only need stage1 which is what I would expect other repos would want as well. |
Yeah, makes sense, I was thinking of that. How about |
/azp run source-build-reference-packages-unified-build |
Azure Pipelines failed to run 1 pipeline(s). |
Makes sense. |
/azp run source-build-reference-packages-unified-build |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run source-build-reference-packages-unified-build |
Azure Pipelines successfully started running 1 pipeline(s). |
Verification of changes needed for source-only runs of the VMR build pipeline.