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

Use YAML for build pipeline #4327

Merged
merged 3 commits into from
Nov 24, 2020
Merged

Use YAML for build pipeline #4327

merged 3 commits into from
Nov 24, 2020

Conversation

bdukes
Copy link
Contributor

@bdukes bdukes commented Nov 23, 2020

This adds a YAML definition for the build, so that pull requests can make incremental changes to the build process, and to publicly document the build process.

This is just a copy of the existing build process, using the View YAML feature in pipelines.

@bdukes bdukes added this to the 9.8.1 milestone Nov 23, 2020
Copy link
Contributor

@SkyeHoefling SkyeHoefling left a comment

Choose a reason for hiding this comment

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

This is a great idea! I had a couple thoughts I wanted to share

  • Hosted Build Pool (see comment inline)
  • Triggers - How are the build triggers working? I don't see anything defined here and it is something we can trigger for PRs, tags, commits to develop, etc. I think declaring more in yaml is better than having anything hidden in Azure DevOps

@@ -0,0 +1,83 @@
pool:
name: Hosted VS2017
Copy link
Contributor

Choose a reason for hiding this comment

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

As microsoft updates build agents, build failures can happen as there can be different versions of SDKs installed. This is a notorious problem in the multi-platform development world and isn't as important for a project like DNN. My best practice I've been using is specifying vmImage instead of name. This would give us more granular control over what Hosted-Agent is being used to reduce the risk of random build failures.

Suggested change
name: Hosted VS2017
vmImage: windows-2019

This may not work as a drop-in replacement. We may need to add a jobs root node and specify pool on each job. See the docs below for more details

@bdukes
Copy link
Contributor Author

bdukes commented Nov 23, 2020

Thanks for the feedback @ahoefling! I've added the triggers info (as well as fixed some differences between the current pipeline and this new pipeline that I hadn't realized were in my original commit).

Regarding the pool/VM image, I agree, we should move to Windows 2019. However, I'd prefer this PR to be just moving to YAML with our current config, and then we can have a separate PR to switch pools. @mitchelsellers @valadas we don't have any specific guidance from .NET Foundation around needing to use particular build agents, right? We're free to jump to the windows-2019 agent?

Copy link
Contributor

@mitchelsellers mitchelsellers left a comment

Choose a reason for hiding this comment

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

Love this.

We are free to use any available agent

@bdukes bdukes requested a review from valadas November 23, 2020 19:47
@SkyeHoefling
Copy link
Contributor

@bdukes

I've added the triggers info (as well as fixed some differences between the current pipeline and this new pipeline that I hadn't realized were in my original commit).

Did you add a triggers: section? I am not seeing it in the latest code push

https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/github?view=azure-devops&tabs=yaml#ci-triggers

@bdukes
Copy link
Contributor Author

bdukes commented Nov 23, 2020

Whoops, didn't push that part, thanks for the catch :-)

Copy link
Contributor

@SkyeHoefling SkyeHoefling left a comment

Choose a reason for hiding this comment

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

Thanks for adding the triggers, this is looking much better. See comments for question about pattern matching branches for triggers

trigger:
batch: true
branches:
include: '*'
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought this was an implied setting, not sure if it is necessary. I usually use includes to define specific branches or patterns I want to build.

Example:

trigger:
  branches:
    include:
    - main
    - releases/v*
  tags:
    include:
    - v*

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's the default. It felt weird to add the section and then completely rely on the defaults. It feels like adding the branches section gives a hint to someone who might want to adjust the trigger configuration. If others feel like it's better with it removed, I'm happy to do that as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

@bdukes

It felt weird to add the section and then completely rely on the defaults

This is a really great point and we should update this to include something useful. I do not think it is a wise idea to have it build all branches. Looking at our current branch structure I see there is the cake-frosting branch that you are working on. I don't think that should automatically build every time a new commit is pushed. That should only build once the PR is opened. These are just some of my opinions on the topic and if the core team thinks this is fine, go ahead with the merge.

I am thinking something like this may be more appropriate

trigger:
  branches:
    include:
    - develop
  tags:
    include:
    - v*

This will build any push to the develop branch and any tag that is prefixed with v. For example v10.0.0 will trigger a build.

(see PR comment below for how this will handle PRs)

Copy link
Contributor

Choose a reason for hiding this comment

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

For the trigger on v* tags, I would like to do something later after we move (if we succeed) to cake-frosting. On my own projects I have an automation on creation of a release/x.x.x branch. It produces an RC pre-release with automated release notes and mentions based on merged PRs with matching milestone. Then when merging a release/x.x.x branch into master, it tags and produces a release with the same things but not RC.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like the v* tag because I can tag builds for production release and release client. It is something that you can apply regex to parse the version depending on the defined convention.

For example

  • v10.0.0
  • v10.0.0-RC1

Both of those tags will trigger a build. I have a build step using a regex that checks for the -RC1 which will then generate the build as a Release Client. If the regex matches the production build format of v10.0.0 it will generate the production build

Copy link
Contributor

Choose a reason for hiding this comment

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

yep, the v tags stay the same with what I have, it's just not the trigger. The triggers are creating a release/1.2.3 branch which fires up a series of events:

  • Tags v1.2.3-rc1 (or rc2 or rc3 on next commits to that branch)
  • Produces release notes
  • Produces an unpublished release with the artifacts and all.

Then when release/1.2.3 get's merged into master, same process other than the tag is v1.2.3 (no rc-*)

It's about the same as what I currently do manually for each release other than not having to do it manually 😄

On top of that when we get this working we also have the proper triggers to adjust the issue templates because we need 2 events for that, when we release an RC and when we release a non-RC.

But yeah, the tags would be the exact same

pr:
autoCancel: true
branches:
include: '*'
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above

Copy link
Contributor

Choose a reason for hiding this comment

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

@bdukes
Following up to #4327 (comment)

Currently the way the PR trigger is written it will start a build for any pull request to any branch. I am not sure if this is the best decision as there are branches that we may not want to auto-build against. This may be an incorrect assumption for me to make, but has been a best practice for projects I have worked on.

Perhaps we adjust the PR workflow to only build against the main branches of the repo using the following yaml

pr:
  branches:
    include:
    - develop
    - master
    - future/10

Copy link
Contributor

@valadas valadas left a comment

Choose a reason for hiding this comment

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

Awesome

@valadas
Copy link
Contributor

valadas commented Nov 24, 2020

I will merge this after the build...

@valadas valadas merged commit 724ea6c into dnnsoftware:develop Nov 24, 2020
@bdukes bdukes deleted the yaml-build branch November 30, 2020 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants