Skip to content

Commit

Permalink
(#154) Verify PowerShell scripts on develop branch
Browse files Browse the repository at this point in the history
In the previous release, a change was made to try to control "when" the
verification of PowerShell scripts would be completed.  This change
neglected to allow running of this task on the develop branch, and
instead only ran on "releaseable" branches, namely master, hotfix and
release.  To allow catching of PowerShell scripts that haven't been
signed, we need to run the verification task on all "main" branches, i.e.
master, develop, release, hotfix and support.  In other words, any
branches that a PR can be merged into.

This commit fixes the criteria for this to be in place, and also adds
the concept of Support branches to the BranchType enumeration, which
wasn't included previously.
  • Loading branch information
gep13 committed May 17, 2024
1 parent 173591a commit ae80816
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Chocolatey.Cake.Recipe/Content/parameters.cake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public enum BranchType
HotFix,
Release,
Develop,
Master
Master,
Support
}

public static class BuildParameters
Expand Down Expand Up @@ -870,6 +871,10 @@ public static class BuildParameters
{
BranchType = BranchType.HotFix;
}
else if (branchName != null && branchName.StartsWith("support", StringComparison.OrdinalIgnoreCase))
{
BranchType = BranchType.Support;
}
else
{
BranchType = BranchType.Unknown;
Expand Down
2 changes: 1 addition & 1 deletion Chocolatey.Cake.Recipe/Content/sign.cake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
BuildParameters.Tasks.VerifyPowerShellScriptsTask = Task("Verify-PowerShellScripts")
.WithCriteria(() => BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows, "Skipping due to not running on Windows")
.WithCriteria(() => !BuildParameters.IsPullRequest, "Skipping because current build is from a Pull Request")
.WithCriteria(() => BuildParameters.BranchType == BranchType.Master || BuildParameters.BranchType == BranchType.Release || BuildParameters.BranchType == BranchType.HotFix, "Skipping because this is not a releasable branch")
.WithCriteria(() => BuildParameters.BranchType == BranchType.Master || BuildParameters.BranchType == BranchType.Release || BuildParameters.BranchType == BranchType.HotFix || BuildParameters.BranchType == BranchType.Support || BuildParameters.BranchType == BranchType.Develop, "Skipping because this is not a 'main' branch, i.e. master, develop, release, hotfix, or support, where scripts need to be verified.")
.WithCriteria(() => BuildParameters.ShouldVerifyPowerShellScripts, "Skipping since verifying PowerShell scripts has been disabled")
.Does(() =>
{
Expand Down

0 comments on commit ae80816

Please sign in to comment.