Skip to content

BuildSetup and BuildTearDown Feature#285

Merged
devblackops merged 13 commits intopsake:masterfrom
UberDoodles:psake-buildsetupandteardown
Aug 16, 2019
Merged

BuildSetup and BuildTearDown Feature#285
devblackops merged 13 commits intopsake:masterfrom
UberDoodles:psake-buildsetupandteardown

Conversation

@UberDoodles
Copy link
Copy Markdown
Contributor

Description

Similar to TaskSetup and TaskTearDown, there are now functions to specify code snippets to be executed at the beginning of the build (before the first task), and at the end of the build (after either all tasks have completed, or a task has failed).

This is my first ever contribution to an opensource project, and first time using GitHub, so go easy on me :)

Related Issue

#181

Motivation and Context

In my implementation of psake, I need to perform some processing at the very beginning of the build, before any tasks run.

Previously, I had just worked around this using the TaskSetup functionality, and a variable to track whether the build setup had been performed. This approach isn't compatible with a change which I now want to make to our builds, which requires the build setup to have been performed before the task preconditions execute.

How Has This Been Tested?

Tested on Windows 10 desktop.
Powershell 5.1
.NET Framework 4.8
Pester 4.8.1
PlatyPS 0.14.0
PSScriptAnalyzer 1.18.1

Ran all existing Pester tests, and created some new ones for the new features. I wanted to write a Pester test that ensured the BuildTearDown executed even if the build failed, but I couldn't find a way of doing that which worked with the way the specs were executed.

So I had to do a manual test to verify that the BuildTearDown ran even if a task failed (and that the build still failed after the teardown had completed). Also manually tested that the build works when you don't specify BuildSetup or BuildTearDown. I used the new features in combination with TaskSetup and TaskTearDown to make sure everything was executing in the correct order.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@devblackops devblackops self-requested a review August 5, 2019 23:26
@devblackops devblackops self-assigned this Aug 5, 2019
@devblackops
Copy link
Copy Markdown
Member

Thanks for the contribution @UberDoodles. This is awesome!

Copy link
Copy Markdown
Member

@devblackops devblackops left a comment

Choose a reason for hiding this comment

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

I noticed that no task header is displayed when TaskSetup or TaskTearDown are executed, nor are the execution times included in the build time report. I don't think it's a huge deal though. If people are itching to have that we can address it later.

@devblackops devblackops merged commit e20c3b4 into psake:master Aug 16, 2019
devblackops added a commit to devblackops/psake that referenced this pull request Aug 16, 2019
@UberDoodles
Copy link
Copy Markdown
Contributor Author

Thanks @devblackops. Yeah, I wasn't sure whether task headers and timings should be added. I decided to keep it simple for now. Like you say; we can address these later if there is a demand for it.

@UberDoodles UberDoodles deleted the psake-buildsetupandteardown branch September 12, 2019 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants