-
Notifications
You must be signed in to change notification settings - Fork 15
Add Proxy Module, Setup Pipeline, Fix Project Dependency to NetStandard2.0 #42
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
02c6191
Set up CI with Start Right
TravisEz13 dabbc11
reflected SetJobState
8a0ca1f
fixed CL test failure
b0c1aa2
Update pwsh 7 install method thru PSPackagesOfficial
902e4ad
Change release environment to Production
d2bec3d
Address all issues from first review
fdad7be
Fix reflection issue with SetJobState
a060d2c
Testing pipeline
4a43661
Fix pipeline Issues
f6934dc
Remove installing PSReourceGet
1342de8
Remove usage of Signed parameter
bd34f79
Improved reflection processes by caching it in the static constructor
dc3f87c
Rework reflection cache, helpInfoURI, and fixed a
59615f8
Remove unnecessary caching, rename a method, and fix indentation
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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": [ "chungjustin@microsoft.com", "slee@microsoft.com" ], | ||
| "tools": [ "CredScan", "PoliCheck", "BinSkim" ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| 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 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,3 +19,5 @@ xhtml/ | |
| **/.vscode/** | ||
| **/out/** | ||
| **/bin/** | ||
| .vs/**/* | ||
| **/*.sln | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,276 @@ | ||
| 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 | ||
|
|
||
| pipelines: | ||
| - pipeline: PSPackagesOfficial | ||
| source: 'PowerShell-Packages-Official' | ||
|
|
||
| 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.ArtifactStagingDirectory)' | ||
| - name: ob_sdl_sbom_enabled | ||
| value: true | ||
| #- name: ob_sdl_credscan_suppressionsFile | ||
| # value: $(Build.SourcesDirectory)\.config\suppress.json | ||
| steps: | ||
| - pwsh: | | ||
| Write-Verbose -Verbose $(Build.SourcesDirectory) | ||
| 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" | ||
| $proxyManifestData = Import-PowerShellDataFile -Path src/ThreadJob/ThreadJob.psd1 | ||
| $proxyModuleVersion = $proxyManifestData.ModuleVersion | ||
| Write-Host "##vso[task.setvariable variable=proxyVersion;isOutput=true]$proxyModuleVersion" | ||
| name: package | ||
| displayName: Get version from project properties | ||
| - task: onebranch.pipeline.version@1 | ||
| displayName: Set OneBranch version | ||
| inputs: | ||
| system: Custom | ||
| customVersion: $(package.version) | ||
| - 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 | ||
| - 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 | ||
jshigetomi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .\build.ps1 -Publish | ||
| Write-Verbose -Verbose ((Get-Item .).FullName) | ||
| Write-Verbose -Verbose $(Build.SourcesDirectory) | ||
| 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" | ||
jshigetomi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - pwsh: | | ||
| Get-ChildItem -Path $(Build.SourcesDirectory)/out -Filter '*.nupkg' -Recurse | ||
| | ForEach-Object { | ||
| Write-Verbose -Verbose "Copying $($_.FullName) to $(ob_outputDirectory)" | ||
| Copy-Item -Path $_.FullName -Destination $(ob_outputDirectory) -Force | ||
| } | ||
| Get-ChildItem -Path $(ob_outputDirectory) -Recurse -File -Name | Write-Verbose -Verbose | ||
| displayName: Upload Signed Nupkgs | ||
| - 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: Production | ||
| 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 | ||
| - input: pipelineArtifact | ||
| pipeline: PSPackagesOfficial | ||
| artifactName: drop_upload_upload_packages | ||
| displayName: Publish to PowerShell Gallery | ||
| pool: | ||
| type: release | ||
| os: windows | ||
| variables: | ||
| - group: ThreadJob_Gallery_API | ||
| steps: | ||
| - task: PowerShell@2 | ||
| inputs: | ||
| targetType: inline | ||
| script: | | ||
| $localInstallerPath = Get-ChildItem -Path "$(Pipeline.Workspace)/GitHubPackages" -Filter '*win-x64.msi' | Select-Object -First 1 -ExpandProperty FullName | ||
| if (Test-Path -Path $localInstallerPath) { | ||
| Write-Verbose -Verbose "Installer found at $localInstallerPath" | ||
| } else { | ||
| throw "Installer not found" | ||
| } | ||
| Write-Verbose -Verbose "Installing PowerShell via msiexec" | ||
| Start-Process -FilePath msiexec -ArgumentList "/package $localInstallerPath /quiet REGISTER_MANIFEST=1" -Wait -NoNewWindow | ||
| $pwshPath = Get-ChildItem -Directory -Path 'C:\Program Files\PowerShell\7*' | Select-Object -First 1 -ExpandProperty FullName | ||
| if (Test-Path -Path $pwshPath) { | ||
| Write-Verbose -Verbose "PowerShell installed at $pwshPath" | ||
| Write-Verbose -Verbose "Adding pwsh to env:PATH" | ||
| Write-Host "##vso[task.prependpath]$pwshPath" | ||
| } else { | ||
| throw "PowerShell not installed" | ||
| } | ||
| displayName: Install pwsh 7 | ||
| - task: PowerShell@2 | ||
| inputs: | ||
| targetType: inline | ||
| pwsh: true | ||
| script: | | ||
| Write-Verbose -Verbose "Pwsh 7 Installed" | ||
| Write-Verbose -Verbose "env:Path: " | ||
| $env:PATH -split ';' | ForEach-Object { | ||
| Write-Verbose -Verbose $_ | ||
| } | ||
| displayName: Check pwsh 7 installation | ||
| - task: Powershell@2 | ||
| inputs: | ||
| pwsh: true | ||
| targetType: inline | ||
| script: | | ||
| Write-Verbose -Verbose -Message "Publish module to PSGallery" | ||
| Publish-PSResource -ApiKey $(GalleryKey) -Repository PSGallery -Path $(Pipeline.Workspace)/Microsoft.PowerShell.ThreadJob.($version).nupkg | ||
| displayName: Publish to PowerShell Gallery | ||
| - stage: release_proxy_ThreadJob_module | ||
| displayName: release proxy | ||
| variables: | ||
| ob_release_environment: Production | ||
| drop: $(Pipeline.Workspace)/drop_build_main | ||
| version: $[ stageDependencies.build.main.outputs['package.proxyVersion'] ] | ||
| dependsOn: [build, manual] | ||
| condition: ${{ parameters.publishProxyToPowerShellGallery }} | ||
| jobs: | ||
| - job: publish | ||
| templateContext: | ||
| inputs: | ||
| - input: pipelineArtifact | ||
| artifactName: drop_build_main | ||
| - input: pipelineArtifact | ||
| pipeline: PSPackagesOfficial | ||
| artifactName: drop_upload_upload_packages | ||
| displayName: Publish to PowerShell Gallery | ||
| pool: | ||
| type: release | ||
| os: windows | ||
| variables: | ||
| - group: ThreadJob_Gallery_API | ||
| steps: | ||
| - task: PowerShell@2 | ||
| inputs: | ||
| targetType: inline | ||
| script: | | ||
| $localInstallerPath = Get-ChildItem -Path "$(Pipeline.Workspace)/GitHubPackages" -Filter '*win-x64.msi' | Select-Object -First 1 -ExpandProperty FullName | ||
| if (Test-Path -Path $localInstallerPath) { | ||
| Write-Verbose -Verbose "Installer found at $localInstallerPath" | ||
| } else { | ||
| throw "Installer not found" | ||
| } | ||
| Write-Verbose -Verbose "Installing PowerShell via msiexec" | ||
| Start-Process -FilePath msiexec -ArgumentList "/package $localInstallerPath /quiet REGISTER_MANIFEST=1" -Wait -NoNewWindow | ||
| $pwshPath = Get-ChildItem -Directory -Path 'C:\Program Files\PowerShell\7*' | Select-Object -First 1 -ExpandProperty FullName | ||
| if (Test-Path -Path $pwshPath) { | ||
| Write-Verbose -Verbose "PowerShell installed at $pwshPath" | ||
| Write-Verbose -Verbose "Adding pwsh to env:PATH" | ||
| Write-Host "##vso[task.prependpath]$pwshPath" | ||
| } else { | ||
| throw "PowerShell not installed" | ||
| } | ||
| displayName: Install pwsh 7 | ||
| - task: PowerShell@2 | ||
| inputs: | ||
| targetType: inline | ||
| pwsh: true | ||
| script: | | ||
| Write-Verbose -Verbose "Pwsh 7 Installed" | ||
| Write-Verbose -Verbose "env:Path: " | ||
| $env:PATH -split ';' | ForEach-Object { | ||
| Write-Verbose -Verbose $_ | ||
| } | ||
| displayName: Check pwsh 7 installation | ||
| - task: Powershell@2 | ||
| inputs: | ||
| pwsh: true | ||
| targetType: inline | ||
| script: | | ||
| 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 | ||
| Write-Verbose -Verbose -Message "Publish module to PSGallery" | ||
| Publish-PSResource -ApiKey $(GalleryKey) -Repository PSGallery -Path $(Pipeline.Workspace)/ThreadJob | ||
| displayName: Publish to PowerShell Gallery | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.