Skip to content

Commit e0d3f83

Browse files
authored
Fix Az.TrustedSigning InvokeCiPolicySigning operation to use ShouldProcess (#27456)
1 parent 536b95f commit e0d3f83

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

src/TrustedSigning/TrustedSigning.sln

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accoun
1818
EndProject
1919
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{7A062235-C440-491C-AB28-1BEF6066B5C5}"
2020
EndProject
21-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.TrustedSigning", "TrustedSigning.Autorest\Az.TrustedSigning.csproj", "{DA76563A-9EDD-4C16-B145-3729C71CE139}"
21+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.TrustedSigning", "..\..\generated\TrustedSigning\TrustedSigning.Autorest\Az.TrustedSigning.csproj", "{DA76563A-9EDD-4C16-B145-3729C71CE139}"
22+
EndProject
23+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{86128D66-090F-3D0D-B081-F8F6D609F8F2}"
2224
EndProject
2325
Global
2426
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -58,6 +60,10 @@ Global
5860
{DA76563A-9EDD-4C16-B145-3729C71CE139}.Debug|Any CPU.Build.0 = Debug|Any CPU
5961
{DA76563A-9EDD-4C16-B145-3729C71CE139}.Release|Any CPU.ActiveCfg = Release|Any CPU
6062
{DA76563A-9EDD-4C16-B145-3729C71CE139}.Release|Any CPU.Build.0 = Release|Any CPU
63+
{86128D66-090F-3D0D-B081-F8F6D609F8F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
64+
{86128D66-090F-3D0D-B081-F8F6D609F8F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
65+
{86128D66-090F-3D0D-B081-F8F6D609F8F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
66+
{86128D66-090F-3D0D-B081-F8F6D609F8F2}.Release|Any CPU.Build.0 = Release|Any CPU
6167
EndGlobalSection
6268
GlobalSection(SolutionProperties) = preSolution
6369
HideSolutionNode = FALSE

src/TrustedSigning/TrustedSigning/ChangeLog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Modified InvokeCiPolicySigning to include ShouldProcess command confirmation
2122

2223
## Version 0.1.0
2324
* Renamed from Az.CodeSigning
2425
* Adding support for control-plane commands via Az.TrustedSigning.Autorest
25-

src/TrustedSigning/TrustedSigning/Commands/InvokeCIPolicySigning.cs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
namespace Microsoft.Azure.Commands.TrustedSigning
2323
{
2424
[Alias("Invoke-" + ResourceManager.Common.AzureRMConstants.AzurePrefix + "CodeSigningCIPolicySigning")]
25-
[Cmdlet(VerbsLifecycle.Invoke, ResourceManager.Common.AzureRMConstants.AzurePrefix + "TrustedSigningCIPolicySigning", DefaultParameterSetName = ByAccountProfileNameParameterSet)]
25+
[Cmdlet(VerbsLifecycle.Invoke, ResourceManager.Common.AzureRMConstants.AzurePrefix + "TrustedSigningCIPolicySigning", DefaultParameterSetName = ByAccountProfileNameParameterSet, SupportsShouldProcess = true)]
2626
[OutputType(typeof(string))]
2727
public class InvokeCIPolicySigning : CodeSigningCmdletBase
2828
{
@@ -118,21 +118,23 @@ public class InvokeCIPolicySigning : CodeSigningCmdletBase
118118

119119
public override void ExecuteCmdlet()
120120
{
121-
ValidateFileType(ResolvePath(Path));
121+
if (ShouldProcess(Destination, string.Format("Signing '{0}'", Path)))
122+
{
123+
ValidateFileType(ResolvePath(Path));
122124

125+
WriteMessage("CI Policy signing in progress....");
123126

124-
WriteMessage("CI Policy signing in progress....");
127+
if (!string.IsNullOrEmpty(AccountName))
128+
{
129+
CodeSigningServiceClient.SubmitCIPolicySigning(AccountName, ProfileName, EndpointUrl, ResolvePath(Path), ResolvePath(Destination), TimeStamperUrl);
130+
}
131+
else if (!string.IsNullOrEmpty(MetadataFilePath))
132+
{
133+
CodeSigningServiceClient.SubmitCIPolicySigning(MetadataFilePath, ResolvePath(Path), ResolvePath(Destination), TimeStamperUrl);
134+
}
125135

126-
if (!string.IsNullOrEmpty(AccountName))
127-
{
128-
CodeSigningServiceClient.SubmitCIPolicySigning(AccountName, ProfileName, EndpointUrl, ResolvePath(Path), ResolvePath(Destination), TimeStamperUrl);
129-
}
130-
else if (!string.IsNullOrEmpty(MetadataFilePath))
131-
{
132-
CodeSigningServiceClient.SubmitCIPolicySigning(MetadataFilePath, ResolvePath(Path), ResolvePath(Destination), TimeStamperUrl);
136+
WriteMessage("CI Policy is successfully signed. " + ResolvePath(Destination));
133137
}
134-
135-
WriteMessage("CI Policy is successfully signed. " + ResolvePath(Destination));
136138
}
137139
private void WriteMessage(string message)
138140
{

0 commit comments

Comments
 (0)