Skip to content

OneBranch migration #4953

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 13 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .config/tsaoptions.json
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",
"notificationAliases": [ "[email protected]", "[email protected]" ],
"codebaseName": "PowerShell_vscode-powershell_20240328",
"tools": [ "CredScan", "PoliCheck", "BinSkim" ]
}
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ version: 2
registries:
npm-azure:
type: npm-registry
url: https://pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/registry/
username: powershell-rel
url: https://pkgs.dev.azure.com/mscodehub/PowerShellCore/_packaging/PowerShellCore_PublicPackages/npm/registry/
username: powershell
password: ${{ secrets.AZURE_NPM_PASSWORD }}
updates:
- package-ecosystem: npm
Expand All @@ -25,7 +25,7 @@ updates:
- "@types/*"
ignore:
- dependency-name: "untildify"
versions: ["5.x"]
versions: [ "5.x" ]
- package-ecosystem: github-actions
directory: "/"
labels: [ ]
Expand Down
16 changes: 16 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
changelog:
exclude:
labels:
- Ignore
authors:
- dependabot
categories:
- title: Enhancements & Features ✨
labels:
- Issue-Enhancement
- title: Squashed Bugs 🐛
labels:
- Issue-Bug
- title: Other Changes 🙏
labels:
- "*"
13 changes: 10 additions & 3 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
paths-ignore: [ '**/*.md' ]
merge_group:
types: [ checks_requested ]

Expand Down Expand Up @@ -43,10 +42,18 @@ jobs:
cache: true
cache-dependency-path: 'PowerShellEditorServices/**/packages.lock.json'
global-json-file: PowerShellEditorServices/global.json
source-url: https://pkgs.dev.azure.com/mscodehub/PowerShellCore/_packaging/PowerShellCore_PublicPackages/nuget/v3/index.json
config-file: PowerShellEditorServices/NuGet.config
env:
NUGET_AUTH_TOKEN: ${{ secrets.AZURE_NUGET_TOKEN }}

- name: Install PSResources
shell: pwsh
run: ../PowerShellEditorServices/tools/installPSResources.ps1
run: ./tools/installPSResources.ps1

- name: Deploy generated NuGet configuration
shell: pwsh
run: Copy-Item ../../nuget.config ../PowerShellEditorServices/NuGet.config

- name: Deploy NPM configuration
shell: pwsh
Expand All @@ -66,7 +73,7 @@ jobs:
shell: pwsh
run: Invoke-Build -Configuration Release
env:
NPM_PASSWORD: ${{ secrets.AZURE_NPM_PASSWORD_BASE64}}
NPM_PASSWORD: ${{ secrets.AZURE_NPM_PASSWORD_BASE64 }}

- name: Upload build artifacts
uses: actions/upload-artifact@v4
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
; Azure DevOps does not support actual auth tokens.

; begin auth token
//pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/registry/:username=powershell-rel
//pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/registry/:_password=${NPM_PASSWORD}
//pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/registry/:email=powershell-rel
//pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/:username=powershell-rel
//pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/:_password=${NPM_PASSWORD}
//pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/:email=powershell-rel
//pkgs.dev.azure.com/mscodehub/PowerShellCore/_packaging/PowerShellCore_PublicPackages/npm/registry/:username=powershell
//pkgs.dev.azure.com/mscodehub/PowerShellCore/_packaging/PowerShellCore_PublicPackages/npm/registry/:_password=${NPM_PASSWORD}
//pkgs.dev.azure.com/mscodehub/PowerShellCore/_packaging/PowerShellCore_PublicPackages/npm/registry/:email=powershell
//pkgs.dev.azure.com/mscodehub/PowerShellCore/_packaging/PowerShellCore_PublicPackages/npm/:username=powershell
//pkgs.dev.azure.com/mscodehub/PowerShellCore/_packaging/PowerShellCore_PublicPackages/npm/:_password=${NPM_PASSWORD}
//pkgs.dev.azure.com/mscodehub/PowerShellCore/_packaging/PowerShellCore_PublicPackages/npm/:email=powershell
; end auth token
registry=https://pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/registry/
registry=https://pkgs.dev.azure.com/mscodehub/PowerShellCore/_packaging/PowerShellCore_PublicPackages/npm/registry/
always-auth=true
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
**.js
**.js.map
.vscode-test/
logs/
*.vsix
dist/
modules
modules/
node_modules/
obj/
bin/
out/
sessions/
test/mocks/BinaryModule/bin/
test/mocks/BinaryModule/obj/
test-results.xml
*.vsix
*.DS_Store
tsconfig.tsbuildinfo
2 changes: 1 addition & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"require": "source-map-support/register",
"timeout": 600000,
"slow": 2000,
"spec": "out/test/**/*.test.js"
"spec": "test/**/*.test.js"
}
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; We use Dependabot to update our packages, so we want to add without a prefix
save-exact=true
; We download from a private feed during the release process
registry=https://pkgs.dev.azure.com/powershell-rel/PowerShellEditorServices/_packaging/PSESFeed/npm/registry/
registry=https://pkgs.dev.azure.com/mscodehub/PowerShellCore/_packaging/PowerShellCore_PublicPackages/npm/registry/
always-auth=true
221 changes: 221 additions & 0 deletions .pipelines/vscode-powershell-Official.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
#################################################################################
# OneBranch Pipelines #
# This pipeline was created by EasyStart from a sample located at: #
# https://aka.ms/obpipelines/easystart/samples #
# Documentation: https://aka.ms/obpipelines #
# Yaml Schema: https://aka.ms/obpipelines/yaml/schema #
# Retail Tasks: https://aka.ms/obpipelines/tasks #
# Support: https://aka.ms/onebranchsup #
#################################################################################

trigger: none

parameters:
- name: debug
displayName: Enable debug output
type: boolean
default: false

variables:
system.debug: ${{ parameters.debug }}
BuildConfiguration: Release
WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2019/vse2022:latest

resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main
- repository: PowerShellEditorServices
type: git
name: PowerShellEditorServices
ref: release
pipelines:
- pipeline: PowerShellEditorServices-Official
source: PowerShellEditorServices-Official
trigger:
branches:
- release

extends:
# https://aka.ms/obpipelines/templates
template: v2/OneBranch.Official.CrossPlat.yml@templates
parameters:
globalSdl: # https://aka.ms/obpipelines/sdl
asyncSdl:
enabled: true
forStages: [build]
stages:
- stage: build
jobs:
- job: main
displayName: Build package
pool:
type: windows
variables:
ob_outputDirectory: $(Build.SourcesDirectory)/out
steps:
- pwsh: |
$version = (Get-Content -Raw -Path package.json | ConvertFrom-Json).version
Write-Output "##vso[task.setvariable variable=vsixVersion;isOutput=true]$version"
$prerelease = ([semver]$version).Minor % 2 -ne 0
if ($prerelease) { $version += "-preview" }
Write-Output "##vso[task.setvariable variable=version;isOutput=true]$version"
Write-Output "##vso[task.setvariable variable=prerelease;isOutput=true]$prerelease"
name: package
displayName: Get version from package.json
- task: onebranch.pipeline.version@1
displayName: Set OneBranch version
inputs:
system: Custom
customVersion: $(package.version)
- task: UseNode@1
displayName: Use Node 18.x
inputs:
version: 18.x
- task: npmAuthenticate@0
displayName: Authenticate NPM with Azure Artifacts
inputs:
workingFile: .npmrc
- task: PowerShell@2
displayName: Install PSResources
inputs:
pwsh: true
filePath: tools/installPSResources.ps1
- task: DownloadPipelineArtifact@2
displayName: Download PowerShellEditorServices
inputs:
source: specific
project: PowerShellCore
definition: 2905
specificBuildWithTriggering: true
artifact: drop_release_github
itemPattern: PowerShellEditorServices.zip
- task: ExtractFiles@1
displayName: Extract PowerShellEditorServices module
inputs:
archiveFilePatterns: $(Pipeline.Workspace)/PowerShellEditorServices.zip
destinationFolder: $(Build.SourcesDirectory)/modules
- pwsh: Invoke-Build Build -Configuration $(BuildConfiguration)
displayName: Build
- task: onebranch.pipeline.signing@1
displayName: Sign 1st-party extension files
inputs:
command: sign
signing_environment: external_distribution
search_root: $(Build.SourcesDirectory)/dist
files_to_sign: '**/*.js'
- task: onebranch.pipeline.signing@1
displayName: Sign 1st-party example files
inputs:
command: sign
signing_environment: external_distribution
search_root: $(Build.SourcesDirectory)/examples
files_to_sign: '**/*.js;**/*.ps1;**/*.psd1;**/*.psm1'
- pwsh: Invoke-Build Package
displayName: Create package
- job: test
displayName: Build and run tests
pool:
type: windows
isCustom: true
name: Azure Pipelines
vmImage: windows-latest
variables:
ob_outputDirectory: $(Build.SourcesDirectory)/out
skipComponentGovernanceDetection: true
steps:
- checkout: self
- checkout: PowerShellEditorServices
- task: UseNode@1
displayName: Use Node 18.x
inputs:
version: 18.x
- task: npmAuthenticate@0
displayName: Authenticate NPM with Azure Artifacts
inputs:
workingFile: vscode-powershell/.npmrc
- task: UseDotNet@2
displayName: Use .NET 8.x SDK
inputs:
packageType: sdk
version: 8.x
- task: PowerShell@2
displayName: Install PSResources
inputs:
pwsh: true
filePath: vscode-powershell/tools/installPSResources.ps1
- pwsh: Invoke-Build Test -Configuration $(BuildConfiguration)
displayName: Run tests
workingDirectory: vscode-powershell
- stage: release
dependsOn: build
variables:
version: $[ stageDependencies.build.main.outputs['package.version'] ]
vsixVersion: $[ stageDependencies.build.main.outputs['package.vsixVersion'] ]
prerelease: $[ stageDependencies.build.main.outputs['package.prerelease'] ]
drop: $(Pipeline.Workspace)/drop_build_main
jobs:
- job: github
displayName: Publish draft to GitHub
pool:
type: windows
variables:
ob_outputDirectory: $(Build.SourcesDirectory)/out
steps:
- download: current
displayName: Download artifacts
- task: GitHubRelease@1
displayName: Create GitHub release
inputs:
gitHubConnection: GitHub
repositoryName: PowerShell/vscode-powershell
assets: $(drop)/vscode-powershell-$(vsixVersion).vsix
tagSource: userSpecifiedTag
tag: v$(version)
isDraft: true
isPreRelease: $(prerelease)
addChangeLog: false
releaseNotesSource: inline
releaseNotesInline: "<!-- TODO: Generate release notes on GitHub! -->"
- 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
- job: vscode
dependsOn: validation
displayName: Publish to VS Code Marketplace
pool:
type: windows
variables:
- group: VSCodeMarketplace
- name: ob_outputDirectory
value: $(Build.SourcesDirectory)/out
steps:
- download: current
displayName: Download artifacts
- task: npmAuthenticate@0
displayName: Install NPM packages (for vsce)
inputs:
workingFile: .npmrc
- pwsh: npm ci
displayName: Install NPM packages (for vsce)
- pwsh: |
$publishArgs = @(
'--pat'
'$(token)'
'--packagePath'
'$(drop)/vscode-powershell-$(vsixVersion).vsix'
if ([bool]::Parse('$(prerelease)')) { '--pre-release' }
)
npm run publish -- @publishArgs
displayName: Run vsce publish
Loading
Loading