dotnet / maintenance-packages

Repository that hosts packages from the .NET platform whose original home/branch is not building any longer.
MIT License
22 stars 10 forks source link

Fix DotNetFinalVersionKind variable in yml #170

Closed carlossanlop closed 1 week ago

carlossanlop commented 2 weeks ago

Didn't work in the internal test run.

ericstj commented 2 weeks ago

Per offline discussion we should try to make this work with https://learn.microsoft.com/en-us/azure/devops/pipelines/process/runtime-parameters?view=azure-devops&tabs=script#use-parameters-in-pipelines

carlossanlop commented 2 weeks ago

There are 3 possible values according to the docs:

I switched to trying using parameters: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/runtime-parameters?view=azure-devops&tabs=script

Here's a job testing it: https://dev.azure.com/dnceng/internal/_build/results?buildId=2581675&view=logs&s=6884a131-87da-5381-61f3-d7acc3b91d76

Here's how setting the parameter looks like:

image

It's taking forever to run, so I'll check tomorrow.

carlossanlop commented 2 weeks ago

It's working!

Script contents: shell
eng\common\cibuild.cmd -configuration Release -prepareMachine /p:Test=false /p:DotNetFinalVersionKind=prerelease /p:Test=false /p:DotNetSignType=real /p:TeamName=dotnet-core /p:DotNetPublishUsingPipelines=true /p:OfficialBuildId=20241113.5
ViktorHofer commented 2 weeks ago

Can I supply an empty value as well?

carlossanlop commented 2 weeks ago

Can I supply an empty value as well?

Sure, go ahead. I tried this and didn't work: https://github.com/dotnet/maintenance-packages/pull/170/commits/0dd40cefa9a070d19fae76d2c22d79156aa749b3

And if you can make it default, even better.

ViktorHofer commented 1 week ago

What about adding a "none" option that in YML then gets set to ''?

carlossanlop commented 1 week ago

I tried with "none" but it's passed as the literal string "none", instead of getting converted to ''. It didn't work:

eng\common\cibuild.cmd -configuration Release -prepareMachine /p:Test=false /p:DotNetFinalVersionKind=none /p:Test=false /p:DotNetSignType=real /p:TeamName=dotnet-core /p:DotNetPublishUsingPipelines=true /p:OfficialBuildId=20241114.1

So I added a condition that selects the value of the _DotNetFinalVersionKind variable depending on the value of the parameter. It worked!

eng\common\cibuild.cmd -configuration Release -prepareMachine /p:Test=false  /p:Test=false /p:DotNetSignType=real /p:TeamName=dotnet-core /p:DotNetPublishUsingPipelines=true /p:OfficialBuildId=20241114.2