Skip to content

Conversation

@JustinGrote
Copy link
Collaborator

@JustinGrote JustinGrote commented Apr 14, 2023

PR Summary

This is the first in several build process optimizations.

  • Moves all prerequisite checks/logic from build.ps1 to the build script
  • Makes the build.ps1 basically a bootstrap for invoke-build only
  • Makes prerequisite assertions idempotent so they can be run on every invocation without a heavy performance penalty
  • Refactor the high-level build tasks to be abstracted with their actual implementations as sub-tasks.

PR Checklist

Note: Tick the boxes below that apply to this pull request by putting an x between the square brackets.
Please mark anything not applicable to this PR NA.

  • PR has a meaningful title
  • Summarized changes
  • PR has tests
  • This PR is ready to merge and is not work in progress
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready

@JustinGrote JustinGrote requested a review from a team April 14, 2023 18:53
@JustinGrote JustinGrote requested a review from a team as a code owner April 14, 2023 18:53
@JustinGrote JustinGrote enabled auto-merge (squash) April 14, 2023 18:53
@JustinGrote JustinGrote self-assigned this Apr 14, 2023
@andyleejordan
Copy link
Member

I gotta be honest, I've never looked at nor used build.ps1 😬

@JustinGrote JustinGrote marked this pull request as draft April 14, 2023 23:45
auto-merge was automatically disabled April 14, 2023 23:45

Pull request was converted to draft

@JustinGrote JustinGrote marked this pull request as ready for review April 15, 2023 20:29
@JustinGrote JustinGrote enabled auto-merge (squash) April 15, 2023 20:30
Comment on lines +7 to +9
- name: DOTNET_NOLOGO
value: 'true'

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- name: DOTNET_NOLOGO
value: 'true'
# Suppress welcome message
- name: DOTNET_NOLOGO
value: 'true'

Comment on lines +7 to +8
- name: DOTNET_NOLOGO
value: 'true'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- name: DOTNET_NOLOGO
value: 'true'
# Suppress welcome message
- name: DOTNET_NOLOGO
value: 'true'

version: 6.0.x
performMultiLevelLookup: true

# Some modules like Pester have .NET DLLs that will require a new PowerShell instance, so we run this first prior to the build.
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain a little further? Because we install prerequisites later too.

Copy link
Member

Choose a reason for hiding this comment

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

I'm just going to ignore this file since I don't use it 💁

Comment on lines +5 to +7
@{ ModuleName = 'Pester'; RequiredVersion = '5.4.1.0' } #For PSES Build. TODO: Remove once we hook into PSES build script
@{ ModuleName = 'PSScriptAnalyzer'; RequiredVersion = '1.21.0' } #For PSES Build
@{ ModuleName = 'platyPS'; RequiredVersion = '0.14.2' } #For PSES Build
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@{ ModuleName = 'Pester'; RequiredVersion = '5.4.1.0' } #For PSES Build. TODO: Remove once we hook into PSES build script
@{ ModuleName = 'PSScriptAnalyzer'; RequiredVersion = '1.21.0' } #For PSES Build
@{ ModuleName = 'platyPS'; RequiredVersion = '0.14.2' } #For PSES Build
@{ ModuleName = 'Pester'; RequiredVersion = '5.4.1.0' } # For PSES Build. TODO: Remove once we hook into PSES build script
@{ ModuleName = 'PSScriptAnalyzer'; RequiredVersion = '1.21.0' } # For PSES Build
@{ ModuleName = 'platyPS'; RequiredVersion = '0.14.2' } # For PSES Build

Copy link
Member

Choose a reason for hiding this comment

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

But also, shouldn't PSES be installing and controlling these prerequisites?

Copy link
Member

Choose a reason for hiding this comment

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

Ehh I am really hesitant to take these changes as there's only a few of us that build the project on a regular basis anyway, and I really don't want to break CI/CD.

@JustinGrote
Copy link
Collaborator Author

Hi @andschwa ,

That's a fair assertion. This was a partial config on the next step to optimizing prerequisites for PSES as well. Let me mark this as draft and I will expand it with a matching PSES PR that demonstrates significant gains in performance up to the testing step, which allows people to get faster feedback on whether their tests pass in CI or not. That way the full implementation is clear and the benefit is clear and we can continue the discussion.

@JustinGrote JustinGrote marked this pull request as draft April 19, 2023 19:00
auto-merge was automatically disabled April 19, 2023 19:00

Pull request was converted to draft

@andyleejordan
Copy link
Member

Sounds good. Just remember the release is built entirely via automation in the pipeline...and I've already in the past been bit by bugs like accidentally building (and shipping) debug instead of release, or skipping tests that should've been running. It's just so easy to mess up, especially since the release pipeline depends on assets being produced by the PSES pipeline and handed over to the VS Code pipeline, which has to explicitly use those instead of rebuilding PSES. And that's difficult to test for me in the first place because it's really only testable by going through the release process, and impossible for you to test because that's Microsoft-internal 😓

@JustinGrote
Copy link
Collaborator Author

Closing this for now since it probably needs a huge rebase at this point but may revisit some lessons learned into smaller PRs.

@andyleejordan
Copy link
Member

The build's gotten simpler since then too.

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.

3 participants