Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit 5aba753

Browse files
committed
Merge remote-tracking branch 'origin/development'
2 parents 22a87ee + d59b2a8 commit 5aba753

6 files changed

+377
-642
lines changed

.ci/releaseBuild.yml

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# The name of the build that will be seen in mscodehub
2+
name: PowerShellGetv2-Release-$(Build.BuildId)
3+
# how is the build triggered
4+
# since this is a release build, no trigger as it's a manual release
5+
trigger: none
6+
7+
pr:
8+
branches:
9+
include:
10+
- master
11+
12+
# variables to set in the build environment
13+
variables:
14+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
15+
POWERSHELL_TELEMETRY_OPTOUT: 1
16+
17+
# since this build relies on templates, we need access to those
18+
# This needs a service connection in the build to work
19+
# the *name* of the service connection must be the same as the endpoint
20+
resources:
21+
repositories:
22+
- repository: ComplianceRepo
23+
type: github
24+
endpoint: ComplianceGHRepo
25+
name: PowerShell/compliance
26+
# this can be any branch of your choosing
27+
ref: master
28+
29+
# the stages in this build. There are 2
30+
# the assumption for PowerShellGetv2 is that test is done as part of
31+
# CI so we needn't do it here
32+
stages:
33+
- stage: Build
34+
displayName: Build
35+
pool:
36+
name: Package ES CodeHub Lab E
37+
jobs:
38+
- job: Build_Job
39+
displayName: Build Microsoft.PowerShell.PowerShellGetv2
40+
# note the variable reference to ESRP.
41+
# this must be created in Project -> Pipelines -> Library -> VariableGroups
42+
# where it describes the link to the SigningServer
43+
variables:
44+
- group: ESRP
45+
steps:
46+
- checkout: self
47+
48+
# the steps for building the module go here
49+
- pwsh: |
50+
Set-Location "$(Build.SourcesDirectory)/PowerShellGetv2"
51+
Import-Module ./tools/build.psm1 -Force
52+
Install-Dependencies
53+
Update-ModuleManifestFunctions
54+
Publish-ModuleArtifacts
55+
displayName: Execute build
56+
57+
# these are setting vso variables which will be persisted between stages
58+
- pwsh: |
59+
$signSrcPath = "$(Build.SourcesDirectory)/PowerShellGetv2/dist/PowerShellGet"
60+
dir
61+
# Set signing src path variable
62+
$vstsCommandString = "vso[task.setvariable variable=signSrcPath]${signSrcPath}"
63+
Write-Host "sending " + $vstsCommandString
64+
Write-Host "##$vstsCommandString"
65+
66+
$signOutPath = "$(Build.SourcesDirectory)/OSS_Microsoft_PowerShellGetv2/signed/PowerShellGet"
67+
$null = New-Item -ItemType Directory -Path $signOutPath -force
68+
# Set signing out path variable
69+
$vstsCommandString = "vso[task.setvariable variable=signOutPath]${signOutPath}"
70+
Write-Host "sending " + $vstsCommandString
71+
Write-Host "##$vstsCommandString"
72+
73+
# Set path variable for guardian codesign validation
74+
$vstsCommandString = "vso[task.setvariable variable=GDN_CODESIGN_TARGETDIRECTORY]${signOutPath}"
75+
Write-Host "sending " + $vstsCommandString
76+
Write-Host "##$vstsCommandString"
77+
78+
# Get version and create a variable
79+
$moduleData = Import-PowerShellDataFile "$(Build.SourcesDirectory)/PowerShellGetv2/dist/PowerShellGet/PowerShellGet.psd1"
80+
$moduleVersion = $moduleData.ModuleVersion
81+
$vstsCommandString = "vso[task.setvariable variable=moduleVersion]${moduleVersion}"
82+
Write-Host "sending " + $vstsCommandString
83+
Write-Host "##$vstsCommandString"
84+
displayName: Setup variables for signing
85+
86+
# checkout the Compliance repository so it can be used to do the actual signing
87+
- checkout: ComplianceRepo
88+
89+
# this the MS authored step This cert covers MS autored items
90+
# note that the buildOutputPath (where we get the files to sign)
91+
# is the same as the signOutputPath in the previous step
92+
# at the end of this step we will have all the files signed that should be
93+
# signOutPath is the location which contains the files we will use to make the module
94+
- template: EsrpSign.yml@ComplianceRepo
95+
parameters:
96+
# the folder which contains the binaries to sign
97+
buildOutputPath: $(signSrcPath)
98+
# the location to put the signed output
99+
signOutputPath: $(signOutPath)
100+
# the certificate ID to use (Authenticode)
101+
certificateId: "CP-230012"
102+
pattern: |
103+
**\*.psd1
104+
**\*.psm1
105+
**\*.ps1xml
106+
**\*.mof
107+
108+
# finally publish the parts of the build which will be used in the next stages
109+
# if it's not published, the subsequent stages will not be able to access it.
110+
# This is the build directory (it contains all of the dll/pdb files)
111+
- publish: "$(Build.SourcesDirectory)/OSS_Microsoft_PowerShellGetv2"
112+
artifact: build
113+
displayName: publish build directory
114+
115+
# Now on to the compliance stage
116+
- stage: compliance
117+
displayName: Compliance
118+
dependsOn: Build
119+
jobs:
120+
- job: Compliance_Job
121+
pool:
122+
name: Package ES CodeHub Lab E
123+
steps:
124+
- checkout: self
125+
- checkout: ComplianceRepo
126+
- download: current
127+
artifact: build
128+
129+
# use the templates in the compliance repo
130+
# since script analyzer has modules, we're using the assembly-module-compliance template
131+
# if you don't have assemblies, you should use script-module-compliance template
132+
- template: script-module-compliance.yml@ComplianceRepo
133+
parameters:
134+
# component-governance - the path to sources
135+
sourceScanPath: '$(Build.SourcesDirectory)'
136+
# TermCheck
137+
optionsRulesDBPath: ''
138+
optionsFTPath: ''
139+
# tsa-upload
140+
# the compliance scanning must be uploaded, which you need to request
141+
codeBaseName: 'PowerShellGetv2_20200129'
142+
# selections
143+
APIScan: false # set to false when not using Windows APIs.

Tests/PSGetFindModule.Tests.ps1

-56
Original file line numberDiff line numberDiff line change
@@ -582,59 +582,3 @@ Describe PowerShell.PSGet.FindModuleTests.P2 -Tags 'P2', 'OuterLoop' {
582582
$i = $i + 1
583583
}
584584
}
585-
586-
587-
Describe "Azure Artifacts Credential Provider Integration" -Tags 'BVT' {
588-
589-
BeforeAll {
590-
$repoName = "OneGetTestPrivateFeed"
591-
# This pkg source is an Azure DevOps private feed
592-
$testLocation = "https://pkgs.dev.azure.com/onegettest/_packaging/onegettest/nuget/v2";
593-
$username = "[email protected]"
594-
$PAT = "qo2xvzdnfi2mlcq3eq2jkoxup576kt4gnngcicqhup6bbix6sila"
595-
# see https://github.com/Microsoft/artifacts-credprovider#environment-variables for more info on env vars for the credential provider
596-
# The line below is purely for local testing. Make sure to update env vars in AppVeyor and Travis CI as necessary.
597-
$VSS_NUGET_EXTERNAL_FEED_ENDPOINTS = "{'endpointCredentials': [{'endpoint':'$testLocation', 'username':'$username', 'password':'$PAT'}]}"
598-
[System.Environment]::SetEnvironmentVariable("VSS_NUGET_EXTERNAL_FEED_ENDPOINTS", $VSS_NUGET_EXTERNAL_FEED_ENDPOINTS, [System.EnvironmentVariableTarget]::Process)
599-
600-
601-
# Figure out if Visual Studio is installed, and if it is, we'll use the credential provider that's installed there for the first test
602-
$VSinstalledCredProvider = $false;
603-
$programFiles = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::ProgramFilesX86);
604-
$vswhereExePath = $programFiles + "\\Microsoft Visual Studio\\Installer\\vswhere.exe";
605-
$fullVSwhereExePath = [System.Environment]::ExpandEnvironmentVariables($vswhereExePath);
606-
# If the env variable exists, check to see if the path itself exists
607-
if (Test-Path ($fullVSwhereExePath)) {
608-
$VSinstalledCredProvider = $true;
609-
}
610-
}
611-
612-
AfterAll {
613-
UnRegister-PSRepository -Name $repoName -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
614-
}
615-
616-
it "Register-PackageSource using Visual Studio installed credential provider" -Skip:(!$VSinstalledCredProvider) {
617-
Register-PSRepository $repoName -SourceLocation $testLocation
618-
619-
(Get-PSRepository -Name $repoName).Name | should match $repoName
620-
(Get-PSRepository -Name $repoName).SourceLocation | should match $testLocation
621-
622-
Unregister-PSRepository -Name $repoName -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
623-
}
624-
625-
it "Register-PackageSource using credential provider" -Skip:(!$IsWindows) {
626-
# Make sure the credential provider is installed (works for Windows, Linux, and Mac)
627-
# If the credential provider is already installed, will receive the message: "The netcore Credential Provider is already in C:\Users\<alias>\.nuget\plugins"
628-
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.ps1'))
629-
630-
Register-PSRepository $repoName -SourceLocation $testLocation
631-
632-
(Get-PSRepository -Name $repoName).Name | should match $repoName
633-
(Get-PSRepository -Name $repoName).SourceLocation | should match $testLocation
634-
}
635-
636-
it "Find-Package using credential provider" -Skip:(!$IsWindows) {
637-
$pkg = Find-Module * -Repository $repoName
638-
$pkg.Count | should -BeGreaterThan 0
639-
}
640-
}

0 commit comments

Comments
 (0)