-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Proxy Module, Setup Pipeline, Fix Project Dependency to NetStandard2.0 #42
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"instanceUrl": "https://msazure.visualstudio.com", | ||
"projectName": "One", | ||
"areaPath": "One\\MGMT\\Compute\\Powershell\\Powershell\\PowerShell Core\\ThreadJob", | ||
"codebaseName": "TFSMSAzure_ThreadJob", | ||
"notificationAliases": [ "[email protected]", "[email protected]" ], | ||
"tools": [ "CredScan", "PoliCheck", "BinSkim" ] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "nuget" # See documentation for possible values | ||
directory: "/src/code" # Location of package manifests | ||
schedule: | ||
interval: "daily" | ||
|
||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: daily | ||
|
||
- package-ecosystem: nuget | ||
directory: / | ||
schedule: | ||
interval: daily | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,5 @@ xhtml/ | |
**/.vscode/** | ||
**/out/** | ||
**/bin/** | ||
.vs/**/* | ||
**/*.sln | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: please add a new line at the end. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,248 @@ | ||||||
name: ThreadJob-ModuleBuild-$(Build.BuildId) | ||||||
trigger: none | ||||||
pr: none | ||||||
|
||||||
schedules: | ||||||
- cron: '0 3 * * 1' | ||||||
displayName: Weekly Build | ||||||
branches: | ||||||
include: | ||||||
- onebranch-pipelines | ||||||
always: true | ||||||
|
||||||
parameters: | ||||||
- name: 'publishOfficialToPowerShellGallery' | ||||||
displayName: 'Publish official module to PowerShell gallery' | ||||||
type: boolean | ||||||
default: false | ||||||
- name : 'publishProxyToPowerShellGallery' | ||||||
displayName: 'Publish proxy module to PowerShell gallery' | ||||||
type: boolean | ||||||
default: false | ||||||
|
||||||
variables: | ||||||
BuildConfiguration: Release | ||||||
DOTNET_NOLOGO: true | ||||||
DOTNET_GENERATE_ASPNET_CERTIFICATE: false | ||||||
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||||||
POWERSHELL_TELEMETRY_OPTOUT: 1 | ||||||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | ||||||
WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest | ||||||
|
||||||
resources: | ||||||
repositories: | ||||||
- repository: templates | ||||||
type: git | ||||||
name: OneBranch.Pipelines/GovernedTemplates | ||||||
ref: refs/heads/main | ||||||
|
||||||
extends: | ||||||
# https://aka.ms/obpipelines/templates | ||||||
template: v2/OneBranch.Official.CrossPlat.yml@templates | ||||||
parameters: | ||||||
release: | ||||||
category: NonAzure | ||||||
featureFlags: | ||||||
WindowsHostVersion: | ||||||
Version: 2022 | ||||||
Network: Netlock | ||||||
globalSdl: # https://aka.ms/obpipelines/sdl | ||||||
asyncSdl: | ||||||
enabled: true | ||||||
forStages: [build] | ||||||
#credscan: | ||||||
# enabled: true | ||||||
# scanfolder: $(Build.SourcesDirectory) | ||||||
# suppressionsFile: $(Build.SourcesDirectory)\.config\suppress.json | ||||||
stages: | ||||||
- stage: build | ||||||
jobs: | ||||||
- job: main | ||||||
displayName: Build package | ||||||
pool: | ||||||
type: windows | ||||||
variables: | ||||||
- name: ob_outputDirectory | ||||||
value: $(Build.SourcesDirectory)/out | ||||||
#- name: ob_sdl_credscan_suppressionsFile | ||||||
# value: $(Build.SourcesDirectory)\.config\suppress.json | ||||||
steps: | ||||||
- pwsh: | | ||||||
Write-Verbose -Verbose ((Get-Item $(Build.SourcesDirectory)).FullName) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes |
||||||
Get-ChildItem $(Build.SourcesDirectory) -Recurse -File -Name | Write-Verbose -Verbose | ||||||
$manifestData = Import-PowerShellDataFile -Path src/Microsoft.PowerShell.ThreadJob.psd1 | ||||||
$moduleVersion = $manifestData.ModuleVersion | ||||||
Write-Host "##vso[task.setvariable variable=version;isOutput=true]$moduleVersion" | ||||||
if ($manifestData.PrivateData.PsData.Prerelease) { | ||||||
$prerel = $manifestData.PrivateData.PSData.Prerelease | ||||||
$nupkgVersion = "${moduleVersion}-${prerel}" | ||||||
} else { | ||||||
$nupkgVersion = $moduleVersion | ||||||
} | ||||||
Write-Host "##vso[task.setvariable variable=nupkgversion;isOutput=true]$nupkgVersion" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a relic of the pipeline I copied. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed unnecessary lines |
||||||
name: package | ||||||
displayName: Get version from project properties | ||||||
- task: onebranch.pipeline.version@1 | ||||||
displayName: Set OneBranch version | ||||||
inputs: | ||||||
system: Custom | ||||||
customVersion: $(package.version) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The following is in the pwsh task and sets version: $manifestData = Import-PowerShellDataFile -Path src/Microsoft.PowerShell.ThreadJob.psd1
$moduleVersion = $manifestData.ModuleVersion
Write-Host "##vso[task.setvariable variable=version;isOutput=true]$moduleVersion" Then the pwsh task is named package name: package So to access version, its using the task name as a prefix. |
||||||
- task: UseDotNet@2 | ||||||
displayName: Use .NET SDK | ||||||
inputs: | ||||||
packageType: sdk | ||||||
useGlobalJson: true | ||||||
- pwsh: | | ||||||
Get-ChildItem | Write-Verbose -Verbose | ||||||
Register-PSRepository -Name CFS -SourceLocation "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2" -InstallationPolicy Trusted | ||||||
Install-Module -Repository CFS -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 1.0.5 | ||||||
.\build.ps1 -clean -Build -BuildConfiguration Release -BuildFramework netstandard2.0 | ||||||
displayName: Build | ||||||
- task: onebranch.pipeline.signing@1 | ||||||
displayName: Sign 1st-party files | ||||||
inputs: | ||||||
command: sign | ||||||
signing_profile: external_distribution | ||||||
search_root: $(Build.SourcesDirectory)/out | ||||||
files_to_sign: | | ||||||
**/*.psd1; | ||||||
**/*.ps1xml; | ||||||
**/*.psm1; | ||||||
**/Microsoft.PowerShell.*.dll; | ||||||
- task: ArchiveFiles@2 | ||||||
displayName: Zip module | ||||||
inputs: | ||||||
rootFolderOrFile: $(Build.SourcesDirectory)/out/Microsoft.PowerShell.ThreadJob | ||||||
includeRootFolder: false | ||||||
archiveType: zip | ||||||
archiveFile: out/Microsoft.PowerShell.ThreadJob-v$(package.version).zip | ||||||
- task: ArchiveFiles@2 | ||||||
displayName: Zip module | ||||||
inputs: | ||||||
rootFolderOrFile: $(Build.SourcesDirectory)/out/ThreadJob | ||||||
includeRootFolder: false | ||||||
archiveType: zip | ||||||
archiveFile: out/ThreadJob-v$(package.version).zip | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Origins of package.version answered above. Yes that is true! I need to update the versioning! Two different versionings in pipeline updated. |
||||||
- pwsh: | | ||||||
Get-ChildItem | Write-Verbose -Verbose | ||||||
Write-Verbose -Verbose -Message "Install Microsoft.PowerShell.ThreadJob module" | ||||||
Copy-Item -Path $(Build.SourcesDirectory)/out/Microsoft.PowerShell.ThreadJob -Destination ($env:PSModulePath -split ';')[0] -Recurse -Force | ||||||
Write-Verbose -Verbose -Message "Test ThreadJob module manifest" | ||||||
Test-ModuleManifest -Path $(Build.SourcesDirectory)/out/ThreadJob/ThreadJob.psd1 | ||||||
Comment on lines
+128
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need to install the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was a tricky situation. The proxy module ThreadJob.psd1 defines a dependency RequiredModules = @('Microsoft.PowerShell.ThreadJob') The build/signing (I forgot which one was throwing the error) required that Microsoft.PowerShell.ThreadJob is present on the machine. |
||||||
.\build.ps1 -Publish | ||||||
Write-Verbose -Verbose ((Get-Item .).FullName) | ||||||
Write-Verbose -Verbose ((Get-Item $(Build.SourcesDirectory)).FullName) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, wouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes |
||||||
Get-ChildItem $(Build.SourcesDirectory) -Recurse -File -Name | Write-Verbose -Verbose | ||||||
displayName: Package module | ||||||
- task: onebranch.pipeline.signing@1 | ||||||
displayName: Sign NuGet package | ||||||
inputs: | ||||||
command: sign | ||||||
signing_profile: external_distribution | ||||||
search_root: $(Build.SourcesDirectory) | ||||||
files_to_sign: "**/*.nupkg" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this signed |
||||||
- stage: manual | ||||||
dependsOn: build | ||||||
jobs: | ||||||
- job: validation | ||||||
displayName: Manual validation | ||||||
pool: | ||||||
type: agentless | ||||||
timeoutInMinutes: 1440 | ||||||
steps: | ||||||
- task: ManualValidation@0 | ||||||
displayName: Wait 24 hours for validation | ||||||
inputs: | ||||||
notifyUsers: $(Build.RequestedForEmail) | ||||||
instructions: Please validate the release and then publish it! | ||||||
timeoutInMinutes: 1440 | ||||||
- stage: release_official_MicrosoftPowerShellThreadJob_module | ||||||
displayName: release official | ||||||
variables: | ||||||
ob_release_environment: PPE | ||||||
drop: $(Pipeline.Workspace)/drop_build_main | ||||||
version: $[ stageDependencies.build.main.outputs['package.version'] ] | ||||||
dependsOn: [build, manual] | ||||||
condition: ${{ parameters.publishOfficialToPowerShellGallery }} | ||||||
jobs: | ||||||
- job: publish | ||||||
templateContext: | ||||||
inputs: | ||||||
- input: pipelineArtifact | ||||||
artifactName: drop_build_main | ||||||
displayName: Publish to PowerShell Gallery | ||||||
pool: | ||||||
type: release | ||||||
os: linux | ||||||
variables: | ||||||
- group: ThreadJob_Gallery_API | ||||||
steps: | ||||||
- task: Bash@3 | ||||||
inputs: | ||||||
targetType: inline | ||||||
script: | | ||||||
sudo tdnf install -y powershell | ||||||
displayName: Install PowerShell | ||||||
- task: powershell@2 | ||||||
inputs: | ||||||
pwsh: true | ||||||
targetType: inline | ||||||
script: | | ||||||
Write-Verbose -Verbose ((Get-Item $(Pipeline.Workspace)).FullName) | ||||||
Get-ChildItem $(Pipeline.Workspace) -Recurse -File -Name | Write-Verbose -Verbose | ||||||
Write-Verbose -Verbose -Message "Set up CFS repository" | ||||||
Register-PSRepository -Name CFS -SourceLocation "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2" -InstallationPolicy Trusted -ErrorAction Continue | ||||||
Write-Verbose -Verbose -Message "Install PSResourceGet module" | ||||||
Install-Module -Repository CFS -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 1.0.5 -ErrorAction Continue -Force | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This runs on Linux, do you know the version of PowerShell installed? I guess it would be 7.4.x, and in that case the PSResourceGet module is in-box. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trying is find out if this is necessary |
||||||
Write-Verbose -Verbose -Message "Publish module to PSGallery" | ||||||
Publish-PSResource -ApiKey $env:GalleryPAT -Repository PSGallery -Path $(Pipeline.Workspace)/Microsoft.PowerShell.ThreadJob | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe you don't need an env var?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe? Do you think this needs to be changed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please help me understand, if you call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking into this and testing if Publish-PSResource will do the trick. |
||||||
env: | ||||||
GalleryPAT: $(ChungJustinAPIKey) | ||||||
displayName: Publish to PowerShell Gallery | ||||||
- stage: release_proxy_ThreadJob_module | ||||||
displayName: release proxy | ||||||
variables: | ||||||
ob_release_environment: PPE | ||||||
drop: $(Pipeline.Workspace)/drop_build_main | ||||||
version: $[ stageDependencies.build.main.outputs['package.version'] ] | ||||||
dependsOn: [build, manual] | ||||||
condition: ${{ parameters.publishProxyToPowerShellGallery }} | ||||||
jobs: | ||||||
- job: publish | ||||||
templateContext: | ||||||
inputs: | ||||||
- input: pipelineArtifact | ||||||
artifactName: drop_build_main | ||||||
displayName: Publish to PowerShell Gallery | ||||||
pool: | ||||||
type: release | ||||||
os: linux | ||||||
variables: | ||||||
- group: ThreadJob_Gallery_API | ||||||
steps: | ||||||
- task: Bash@3 | ||||||
inputs: | ||||||
targetType: inline | ||||||
script: | | ||||||
sudo tdnf install -y powershell | ||||||
displayName: Install PowerShell | ||||||
- task: powershell@2 | ||||||
inputs: | ||||||
pwsh: true | ||||||
targetType: inline | ||||||
script: | | ||||||
Write-Verbose -Verbose ((Get-Item $(Pipeline.Workspace)).FullName) | ||||||
Get-ChildItem $(Pipeline.Workspace) -Recurse -File -Name | Write-Verbose -Verbose | ||||||
Write-Verbose -Verbose -Message "Set up CFS repository" | ||||||
Register-PSRepository -Name CFS -SourceLocation "https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2" -InstallationPolicy Trusted -ErrorAction Continue | ||||||
Write-Verbose -Verbose -Message "Install PSResourceGet module" | ||||||
Install-Module -Repository CFS -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 1.0.5 -ErrorAction Continue -Force | ||||||
Write-Verbose -Verbose -Message "Install Microsoft.PowerShell.ThreadJob module" | ||||||
Copy-Item -Path $(Pipeline.Workspace)/Microsoft.PowerShell.ThreadJob -Destination ($env:PSModulePath -split ':')[0] -Recurse -Force -Verbose | ||||||
Write-Verbose -Verbose -Message "Test ThreadJob module manifest" | ||||||
Test-ModuleManifest -Path $(Pipeline.Workspace)/ThreadJob/ThreadJob.psd1 | ||||||
Comment on lines
+241
to
+243
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please help me understand why this testing is needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is to test and confirm the dependency in ThreadJob.psd1 and check that Microsoft.PowerShell.ThreadJob is installed on the machine. |
||||||
Write-Verbose -Verbose -Message "Publish module to PSGallery" | ||||||
Publish-PSResource -ApiKey $env:GalleryPAT -Repository PSGallery -Path $(Pipeline.Workspace)/ThreadJob | ||||||
env: | ||||||
GalleryPAT: $(ChungJustinAPIKey) | ||||||
displayName: Publish to PowerShell Gallery | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: add a new line. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,17 +22,19 @@ param ( | |
[ValidateSet("Debug", "Release")] | ||
[string] $BuildConfiguration = "Debug", | ||
|
||
[ValidateSet("net461")] | ||
[string] $BuildFramework = "net461" | ||
[ValidateSet("netstandard2.0")] | ||
[string] $BuildFramework = "netstandard2.0" | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
Import-Module -Name "$PSScriptRoot/buildtools.psd1" -Force | ||
|
||
$config = Get-BuildConfiguration -ConfigPath $PSScriptRoot | ||
|
||
$script:ModuleName = $config.ModuleName | ||
$script:ProxyModuleName = $config.ProxyModuleName | ||
$script:SrcPath = $config.SourcePath | ||
$script:OutDirectory = $config.BuildOutputPath | ||
$script:ProxyOutDirectory = $config.BuildOutputPath | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this script variable used anywhere? |
||
$script:SignedDirectory = $config.SignedOutputPath | ||
$script:TestPath = $config.TestPath | ||
|
||
|
@@ -53,7 +55,7 @@ if ($env:TF_BUILD) { | |
Write-Host "##$vstsCommandString" | ||
} | ||
|
||
. $PSScriptRoot/dobuild.ps1 | ||
. $PSScriptRoot/doBuild.ps1 | ||
|
||
if ($Clean -and (Test-Path $OutDirectory)) | ||
{ | ||
|
@@ -73,6 +75,7 @@ if ($Clean -and (Test-Path $OutDirectory)) | |
if (-not (Test-Path $OutDirectory)) | ||
{ | ||
$script:OutModule = New-Item -ItemType Directory -Path (Join-Path $OutDirectory $ModuleName) | ||
$script:ProxyOutModule = New-Item -itemType Directory -Path (Join-Path $OutDirectory $ProxyModuleName) | ||
} | ||
else | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# Licensed under the MIT License. | ||
|
||
$ConfigurationFileName = 'package.config.json' | ||
Import-Module -Name PowerShellGet -MinimumVersion 3.0.18 | ||
Import-Module -Name Microsoft.PowerShell.PSResourceGet -Force | ||
|
||
function Get-BuildConfiguration { | ||
[CmdletBinding()] | ||
|
@@ -36,6 +36,7 @@ function Get-BuildConfiguration { | |
$configObj.TestPath = Join-Path $projectRoot -ChildPath $configObj.TestPath | ||
$configObj.HelpPath = Join-Path $projectRoot -ChildPath $configObj.HelpPath | ||
$configObj.BuildOutputPath = Join-Path $projectRoot -ChildPath $configObj.BuildOutputPath | ||
|
||
if ($configObj.SignedOutputPath) { | ||
$configObj.SignedOutputPath = Join-Path $projectRoot -ChildPath $configObj.SignedOutputPath | ||
} | ||
|
@@ -69,32 +70,28 @@ function Publish-ModulePackage | |
) | ||
|
||
Write-Verbose -Verbose -Message "Creating new local package repo" | ||
$config = Get-BuildConfiguration | ||
$localRepoName = 'packagebuild-local-repo' | ||
$localRepoLocation = Join-Path -Path ([System.io.path]::GetTempPath()) -ChildPath $localRepoName | ||
if (Test-Path -Path $localRepoLocation) { | ||
Remove-Item -Path $localRepoLocation -Recurse -Force -ErrorAction Ignore | ||
} | ||
$null = New-Item -Path $localRepoLocation -ItemType Directory -Force | ||
$localRepoLocation = $config.BuildOutputPath | ||
|
||
Write-Verbose -Verbose -Message "Registering local package repo: $localRepoName" | ||
Register-PSResourceRepository -Name $localRepoName -Uri $localRepoLocation -Trusted -Force | ||
|
||
Write-Verbose -Verbose -Message "Publishing package to local repo: $localRepoName" | ||
$config = Get-BuildConfiguration | ||
if (! $Signed.IsPresent) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
$modulePath = Join-Path -Path $config.BuildOutputPath -ChildPath $config.ModuleName | ||
} else { | ||
$modulePath = Join-Path -Path $config.SignedOutputPath -ChildPath $config.ModuleName | ||
} | ||
$modulePath = Join-Path -Path $config.BuildOutputPath -ChildPath $config.ModuleName | ||
|
||
# Proxy module | ||
Write-Verbose -Verbose -Message "Publishing proxy module to local repo: $localRepoName" | ||
$proxyModulePath = Join-Path -Path $config.BuildOutputPath -ChildPath $config.ProxyModuleName | ||
Publish-PSResource -Path $proxyModulePath -Repository $localRepoName -SkipDependenciesCheck -Confirm:$false -Verbose | ||
|
||
# Official module | ||
Write-Verbose -Verbose -Message "Publishing official module to local repo: $localRepoName" | ||
Publish-PSResource -Path $modulePath -Repository $localRepoName -SkipDependenciesCheck -Confirm:$false -Verbose | ||
|
||
if ($env:TF_BUILD) { | ||
Write-Verbose -Verbose -Message "Uploading module nuget package artifact to AzDevOps" | ||
$artifactName = "nupkg" | ||
$artifactPath = (Get-ChildItem -Path $localRepoLocation -Filter "$($config.ModuleName)*.nupkg").FullName | ||
$artifactPath = Resolve-Path -Path $artifactPath | ||
Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$artifactPath" | ||
} | ||
$artifactPath = (Get-ChildItem -Path $localRepoLocation -Filter "$($config.ModuleName)*.nupkg").FullName | ||
$artifactPath = Resolve-Path -Path $artifactPath | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This call seems redundant |
||
Write-Verbose -Verbose -Message "ArtifactPath: $artifactPath" | ||
|
||
Write-Verbose -Verbose -Message "Unregistering local package repo: $localRepoName" | ||
Unregister-PSResourceRepository -Name $localRepoName -Confirm:$false | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: usually we leave a new line at the end of a file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done