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

phases to jobs schema change #1344

Merged
merged 10 commits into from
Nov 20, 2018
Merged

phases to jobs schema change #1344

merged 10 commits into from
Nov 20, 2018

Conversation

chcosta
Copy link
Member

@chcosta chcosta commented Nov 15, 2018

Fixes https://github.com/dotnet/core-eng/issues/4560

@mmitche

I'm open to feedback on this, but here's my current thinking for handling the phases -> jobs breaking schema change and enabling other breaking changes as well.

eng\common\templates\phases\base.yml roughly translates to eng\common\templates\job\base.yml

For teams that want to maintain the pattern we previously established which is something like...

.vsts-ci.yml (defines configuration)
|- [template] eng\build.yml (defines steps to run per configuration)
    |- [template] eng\common\templates\phases\base.yml (modifies the job to do Arcade-y things)
|- [template] eng\common\templates\phases\publish-build-assets.yml (explicitly depends on above phases)

… they can continue that pattern with slight modification to some parameters but essentially looks like...

azure-pipelines.yml
|- eng\build.yml
   |- eng\common\templates\job\base.yml
|- eng\common\templates\job\publish-build-assets.yml

Another pattern, the pattern I'm moving dotnet/Arcade to, is to try to simplify your entry yml file such that you don't need to have the eng\build.yml layer or explicitly include publish-build-assets.yml

azure-pipelines.yml
|- eng\common\templates\jobs\base.yml

Notice that jobs\base.yml as opposed to job\base.yml is referenced. jobs\base.yml wraps job\base.yml but uses "each" to modify the passed jobs and to automatically handle the dependency stuff for "publish-build-assets.yml"

For variables, notice that I'm moving from treating them as an object to the slightly uglier array syntax but that is so that we can support variable groups via yaml.

@vtbassmatt for any additional feedback

I'll be adding others for additional feedback but I wanted to get your thoughts first @mmitche @vtbassmatt

@@ -0,0 +1,112 @@
variables:
- name: _HelixType
value: build/product
Copy link
Contributor

@jcagme jcagme Nov 15, 2018

Choose a reason for hiding this comment

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

build/product [](start = 11, length = 13)

Could you please make this build/product/ so the classifier tool finds failed builds? Also, most of the other repos also do build/product/ #Resolved

# Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job
jobs: []

# Optional: If specified,
Copy link
Contributor

Choose a reason for hiding this comment

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

, [](start = 26, length = 1)

'.' ?

@jcagme
Copy link
Contributor

jcagme commented Nov 15, 2018

In general looks good. What's the plan on removing eng/common/templates/phases/*?

@chcosta
Copy link
Member Author

chcosta commented Nov 15, 2018

No current plan. I think that we could set a date some time early next year to delete that folder if it's a problem. I imagine that BYOC is going to force everyone to move out of phases and into job sooner than later.

@jcagme
Copy link
Contributor

jcagme commented Nov 16, 2018

I don't think there is a problem only not to forget that those would be orphaned files. BYOC should serve as a reminder then

@chcosta
Copy link
Member Author

chcosta commented Nov 16, 2018

/cc @riarenas

# Optional: If specified,
helixRepo: ''

publishBuildAssetsDependsOn: ''
Copy link
Member

Choose a reason for hiding this comment

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

publishBuildAssetsDependsOn: '' [](start = 1, length = 32)

This one is missing a description

@@ -1,98 +0,0 @@
parameters:
Copy link
Member

Choose a reason for hiding this comment

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

@riarenas
Copy link
Member

LGTM. Do you plan to make the documentation changes as part of this PR, or create a followup issue/pr for that?

@chcosta
Copy link
Member Author

chcosta commented Nov 16, 2018

I'm going to include some documentation with this PR so that I don't have to hand-hold everyone through consuming this change. I wanted to get feedback on the direction before writing anything.

@riarenas
Copy link
Member

Ooh. I think it'll help people if once this is in, we make a PR to the minimalci-sample repo and reference the commit from our docs. That will give them an idea of what the transition entails.

@chcosta
Copy link
Member Author

chcosta commented Nov 16, 2018

Also, I'm trying to think of better names than base.yml cuz if you get some yaml problem in your build for whatever reason it just tells you the filename and the line number so you wouldn't know if your error was in job\base.yml or jobs\base.yml

@mmitche
Copy link
Member

mmitche commented Nov 19, 2018

@chcosta taking a look now

- name: _HelixBuildConfig
value: $(_BuildConfig)
# Only enable publishing in non-public, non PR scenarios.
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
Copy link
Member

Choose a reason for hiding this comment

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

Given that these are likely going to be identical between a lot of repos, would it make more sense to pull these variables into a template?

Copy link
Member Author

@chcosta chcosta Nov 19, 2018

Choose a reason for hiding this comment

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

_HelixBuildConfig makes sense and could easily be moved into job\base.yml.

I can't decide if _PublishBlobFeedUrl, _SignArgs, _PublishArgs, and _OfficialBuildIdArgs makes sense. I guess it's optional whether a repo actually uses those values (though they couldn't redefine them). Alternatively, they could be provided behind some other parameter (enableDefaultArgs or something), but that feels a bit overly magical. I guess, because of dependency flow it's all in your local repo and that takes some of the magic out.

I'm conflicted, because it would clean up azure-pipelines.yml, but then things are a little weird in the sense that this code block

      - script: eng\common\cibuild.cmd 
          -configuration $(_BuildConfig)  
          -prepareMachine 
          $(_PublishArgs) 
          $(_SignArgs) 
          $(_OfficialBuildIdArgs)

makes no sense at all unless you go look at another file, plus we're forced into a tighter contract where we will define those args in the base templates until the end of time or risk breaking some repo.

My preference, for now, is to move _HelixBuildConfig but leave the rest up to the repo to define.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah that's a good point.

Copy link
Member

Choose a reason for hiding this comment

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

We will eventually be removing all these publishing steps, since they will go into a release pipebuild after BAR publish. It will probably eventually just say something like "publishPackages=true, publishSymbols=true"

Copy link
Member Author

Choose a reason for hiding this comment

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

I like that direction

@chcosta
Copy link
Member Author

chcosta commented Nov 20, 2018

I'll merge this in the morning and then kick off builds / look for issues. Tuesday (11/27), I'll write up some documentation on this change cuz I'm sure it won't be obvious to people when to use jobs\base.yml vs directly referencing job\base.yml

@chcosta chcosta merged commit af5dae4 into dotnet:master Nov 20, 2018
@markwilkie
Copy link
Member

cc/ @garath

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants