Skip to content

Commit

Permalink
Rename manifest identifier and output folder (#88)
Browse files Browse the repository at this point in the history
* Rename manifest identifier and output folder

* PR feedback
  • Loading branch information
jamespik authored Nov 1, 2021
1 parent d80e01d commit 24efb73
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Tools/PowershellModule/src/Library/Add-WinGetManifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Function Add-WinGetManifest
{
foreach ($Manifest in $ApplicationManifest) {
Write-Verbose -Message "Confirming that the Package ID doesn't already exist in Azure for $($Manifest.PackageIdentifier)."
$GetResult = Get-WinGetManifest -FunctionName $AzureFunctionName -SubscriptionName $SubscriptionName -ManifestIdentifier $Manifest.PackageIdentifier
$GetResult = Get-WinGetManifest -FunctionName $AzureFunctionName -SubscriptionName $SubscriptionName -PackageIdentifier $Manifest.PackageIdentifier

$ManifestObject = $Manifest
$TriggerName = "ManifestPost"
Expand Down
14 changes: 7 additions & 7 deletions Tools/PowershellModule/src/Library/Get-WinGetManifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Function Get-WinGetManifest
.PARAMETER FunctionName
Name of the Azure Function Name that contains the Windows Package Manager REST APIs.
.PARAMETER ManifestIdentifier
.PARAMETER PackageIdentifier
[Optional] The Windows Package Manager Package Identifier of a specific Package Manifest result.
.PARAMETER SubscriptionName
Expand All @@ -50,12 +50,12 @@ Function Get-WinGetManifest
Returns a Manifest object (*.json) of the specified JSON file.
.EXAMPLE
Get-WinGetManifest -FunctionName "contosorestsource" -ManifestIdentifier "Windows.PowerToys"
Get-WinGetManifest -FunctionName "contosorestsource" -PackageIdentifier "Windows.PowerToys"
Returns a Manifest object of the specified Package Identifier that is queried against in the REST APIs.
.EXAMPLE
Get-WinGetManifest -FunctionName "contosorestsource" -ManifestIdentifier "Windows.PowerToys" -SubscriptionName "Visual Studio Subscription"
Get-WinGetManifest -FunctionName "contosorestsource" -PackageIdentifier "Windows.PowerToys" -SubscriptionName "Visual Studio Subscription"
Returns a Manifest object of the specified Package Identifier that is queried against in the REST APIs from the specified Subscription Name.
Expand All @@ -70,7 +70,7 @@ Function Get-WinGetManifest
[Parameter(Position=0, Mandatory=$true, ParameterSetName="File")] [string]$Path,
[Parameter(Position=1, Mandatory=$false,ParameterSetName="File")] [WinGetManifest]$JSON,
[Parameter(Position=0, Mandatory=$true, ParameterSetName="Azure")] [string]$FunctionName,
[Parameter(Position=1, Mandatory=$false,ParameterSetName="Azure")] [string]$ManifestIdentifier,
[Parameter(Position=1, Mandatory=$false,ParameterSetName="Azure")] [string]$PackageIdentifier,
[Parameter(Position=2, Mandatory=$false,ParameterSetName="Azure")] [string]$SubscriptionName
)
BEGIN
Expand Down Expand Up @@ -118,8 +118,8 @@ Function Get-WinGetManifest
throw "Failed to confirm resources exist in Azure. Please verify and try again."
}

if($ManifestIdentifier){
$ManifestIdentifier = "/$ManifestIdentifier"
if($PackageIdentifier){
$PackageIdentifier = "/$PackageIdentifier"
}

###############################
Expand Down Expand Up @@ -244,7 +244,7 @@ Function Get-WinGetManifest
$DefaultHostName = $FunctionApp.DefaultHostName
$FunctionKey = (Invoke-AzResourceAction -ResourceId "$FunctionAppId/functions/$TriggerName" -Action listkeys -Force).default
$apiHeader.Add("x-functions-key", $FunctionKey)
$AzFunctionURL = "https://" + $DefaultHostName + "/api/" + "packageManifests" + $ManifestIdentifier
$AzFunctionURL = "https://" + $DefaultHostName + "/api/" + "packageManifests" + $PackageIdentifier

## Publishes the Manifest to the Windows Package Manager REST source
Write-Verbose -Message "Invoking the REST API call."
Expand Down
12 changes: 6 additions & 6 deletions Tools/PowershellModule/src/Library/Remove-WinGetManifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ Function Remove-WinGetManifest
.PARAMETER FunctionName
Name of the Azure Function that hosts the REST source.
.PARAMETER ManifestIdentifier
.PARAMETER PackageIdentifier
THe Package Id that represents the App Manifest to be removed.
.PARAMETER SubscriptionName
[Optional] The Subscription name contains the Windows Package Manager REST source
.EXAMPLE
Remove-WinGetManifest -FunctionName "contosorestsource" -ManifestIdentifier "Windows.PowerToys"
Remove-WinGetManifest -FunctionName "contosorestsource" -PackageIdentifier "Windows.PowerToys"
Connects to Azure, then runs the Azure Function "contosorestsource" REST APIs to remove the specified Manifest file from
the Windows Package Manager REST source
Expand All @@ -35,7 +35,7 @@ Function Remove-WinGetManifest
[CmdletBinding(DefaultParameterSetName = 'WinGet')]
PARAM(
[Parameter(Position=0, Mandatory=$true, ParameterSetName="Azure")] [string]$FunctionName,
[Parameter(Position=2, Mandatory=$true)] [string]$ManifestIdentifier,
[Parameter(Position=2, Mandatory=$true)] [string]$PackageIdentifier,
[Parameter(Position=3, Mandatory=$false)] [string]$SubscriptionName = ""
)
BEGIN
Expand Down Expand Up @@ -72,8 +72,8 @@ Function Remove-WinGetManifest
throw "Failed to confirm resources exist in Azure. Please verify and try again."
}

if($ManifestIdentifier){
$ManifestIdentifier = "$ManifestIdentifier"
if($PackageIdentifier){
$PackageIdentifier = "$PackageIdentifier"
}

###############################
Expand All @@ -96,7 +96,7 @@ Function Remove-WinGetManifest
$apiHeader.Add("Accept", 'application/json')
$apiHeader.Add("x-functions-key", $FunctionKey)

$AzFunctionURL = "https://" + $DefaultHostName + "/api/" + "packageManifests/" + $ManifestIdentifier
$AzFunctionURL = "https://" + $DefaultHostName + "/api/" + "packageManifests/" + $PackageIdentifier
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions pipelines/templates/copy-and-publish-powershell.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Template helper to copy powershell scripts and all dependencies
# Template helper to copy PowerShell scripts and all dependencies
parameters:
helperLibsPath: '$(Build.SourcesDirectory)\src\WinGet.RestSource.PowershellSupport\bin\$(BuildConfiguration)\netstandard2.0'
templatesPath: '$(build.SourcesDirectory)\src\WinGet.RestSource.Infrastructure\bin\$(BuildConfiguration)'
Expand All @@ -8,7 +8,7 @@ steps:
displayName: 'Copy Files: Powershell module'
inputs:
SourceFolder: '$(build.SourcesDirectory)\Tools\PowershellModule\src'
TargetFolder: '$(build.artifactstagingdirectory)\Winget.Powershell.Source'
TargetFolder: '$(build.artifactstagingdirectory)\Winget.PowerShell.Source'
CleanTargetFolder: true
OverWrite: true

Expand All @@ -24,7 +24,7 @@ steps:
${{ parameters.helperLibsPath }}\YamlDotNet.dll
${{ parameters.helperLibsPath }}\WinGetUtilInterop.dll
${{ parameters.helperLibsPath }}\runtimes\win-x86\native\WinGetUtil.dll
TargetFolder: '$(build.artifactstagingdirectory)\Winget.Powershell.Source\Library\HelperLib\x86'
TargetFolder: '$(build.artifactstagingdirectory)\Winget.PowerShell.Source\Library\HelperLib\x86'
OverWrite: true
flattenFolders: true

Expand All @@ -40,7 +40,7 @@ steps:
${{ parameters.helperLibsPath }}\YamlDotNet.dll
${{ parameters.helperLibsPath }}\WinGetUtilInterop.dll
${{ parameters.helperLibsPath }}\runtimes\win-x64\native\WinGetUtil.dll
TargetFolder: '$(build.artifactstagingdirectory)\Winget.Powershell.Source\Library\HelperLib\x64'
TargetFolder: '$(build.artifactstagingdirectory)\Winget.PowerShell.Source\Library\HelperLib\x64'
OverWrite: true
flattenFolders: true

Expand All @@ -58,19 +58,19 @@ steps:
${{ parameters.templatesPath }}\**\frontdoor.json
${{ parameters.templatesPath }}\**\keyvault.json
${{ parameters.templatesPath }}\**\storageaccount.json
TargetFolder: '$(build.artifactstagingdirectory)\Winget.Powershell.Source\Library\ARMTemplate'
TargetFolder: '$(build.artifactstagingdirectory)\Winget.PowerShell.Source\Library\ARMTemplate'
OverWrite: true
flattenFolders: true

- task: CopyFiles@2
displayName: 'Copy Files: azure function'
inputs:
SourceFolder: '$(Build.ArtifactStagingDirectory)\WinGet.RestSource.Functions'
TargetFolder: '$(build.artifactstagingdirectory)\Winget.Powershell.Source\Library\RestAPI'
TargetFolder: '$(build.artifactstagingdirectory)\Winget.PowerShell.Source\Library\RestAPI'
OverWrite: true

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: WinGet.RestSource-Winget.Powershell.Source'
displayName: 'Publish Artifact: WinGet.RestSource-Winget.PowerShell.Source'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)\Winget.Powershell.Source'
ArtifactName: 'WinGet.RestSource-Winget.Powershell.Source'
PathtoPublish: '$(build.artifactstagingdirectory)\Winget.PowerShell.Source'
ArtifactName: 'WinGet.RestSource-Winget.PowerShell.Source'

0 comments on commit 24efb73

Please sign in to comment.