diff --git a/.azure-pipelines/ci.yml b/.azure-pipelines/ci.yml new file mode 100644 index 00000000..2e9a6a3f --- /dev/null +++ b/.azure-pipelines/ci.yml @@ -0,0 +1,64 @@ +name: $(Date:yyyyMMdd).$(Rev:r) +variables: + - name: Codeql.Enabled + value: true + - template: /.azure-pipelines/npm-cfs-variables.yml@self +resources: + repositories: + - repository: self + type: git + ref: refs/heads/main + - repository: 1esPipelines + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release +trigger: + branches: + include: + - main +extends: + template: v1/1ES.Unofficial.PipelineTemplate.yml@1esPipelines + parameters: + pool: + os: linux + name: 1ES_JavaTooling_Pool + image: 1ES_JavaTooling_Ubuntu-2004 + sdl: + sourceAnalysisPool: + name: 1ES_JavaTooling_Pool + image: 1ES_JavaTooling_Windows_2022 + os: windows + customBuildTags: + - MigrationTooling-mseng-VSJava-9247-Tool + stages: + - stage: Build + jobs: + - job: Job_1 + displayName: Agent job 1 + templateContext: + outputs: + - output: pipelineArtifact + artifactName: drop + targetPath: $(Build.ArtifactStagingDirectory) + displayName: "Publish Artifact: drop" + steps: + - checkout: self + fetchTags: true + - task: NodeTool@0 + displayName: Use Node 20.x + inputs: + versionSpec: 20.x + - template: /.azure-pipelines/npm-cfs.yml@self + - task: CmdLine@2 + displayName: npm install + inputs: + script: npm install + - task: CmdLine@2 + displayName: Command Line Script + inputs: + script: npx @vscode/vsce@latest package + - task: CopyFiles@2 + displayName: "Copy Files to: $(Build.ArtifactStagingDirectory)" + inputs: + Contents: "*.vsix" + TargetFolder: $(Build.ArtifactStagingDirectory) diff --git a/.azure-pipelines/nightly.yml b/.azure-pipelines/nightly.yml new file mode 100644 index 00000000..23013ce6 --- /dev/null +++ b/.azure-pipelines/nightly.yml @@ -0,0 +1,117 @@ +name: $(Date:yyyyMMdd).$(Rev:r) +variables: + - name: Codeql.Enabled + value: true + - template: /.azure-pipelines/npm-cfs-variables.yml@self +schedules: + - cron: 0 0 * * * + branches: + include: + - main +resources: + repositories: + - repository: self + type: git + ref: refs/heads/main + - repository: CustomPipelineTemplates + type: git + name: 1ESPipelineTemplates/MicroBuildTemplate + ref: refs/tags/release +trigger: none +extends: + template: azure-pipelines/MicroBuild.1ES.Official.yml@CustomPipelineTemplates + parameters: + pool: + name: VSEng-MicroBuildVSStable + stages: + - stage: Build + jobs: + - job: Job_1 + displayName: Agent job 1 + templateContext: + mb: + signing: + enabled: false + outputs: + - output: pipelineArtifact + artifactName: vsix + targetPath: $(Build.ArtifactStagingDirectory) + displayName: "Publish Artifact: vsix" + steps: + - checkout: self + clean: true + fetchTags: false + # Pin the last known-good Windows plugin while the 1.1.1374 client certificate regression is unresolved. + - task: NuGetAuthenticate@1 + displayName: Authenticate MicroBuild feed + - task: MicroBuildSigningPlugin@4 + displayName: Install Signing Plugin 1.1.1330 + inputs: + signType: real + version: '1.1.1330' + zipSources: false + ConnectedPMEServiceName: '40012d40-9ded-4f75-8476-d60758200346' + feedSource: 'https://mseng.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json' + env: + MicroBuildOutputFolderOverride: '$(Agent.TempDirectory)' + - task: NodeTool@0 + displayName: Use Node 20.x + inputs: + versionSpec: 20.x + - template: /.azure-pipelines/npm-cfs.yml@self + - task: CmdLine@2 + displayName: npm install + inputs: + script: npm install + - task: CmdLine@2 + displayName: Replace AI Key + inputs: + script: npx json@9.0.6 -I -f package.json -e "this.aiKey=\"%AI_KEY%\"" + - task: PowerShell@2 + displayName: update version in package json + inputs: + targetType: inline + script: |- + node ./scripts/prepare-nightly-build.js + Move-Item -Path "./package.insiders.json" -Destination "./package.json" -Force + - task: CmdLine@2 + displayName: VSCE package --pre-release + inputs: + script: npx @vscode/vsce@latest package --pre-release -o extension.vsix + ### Copy files for APIScan + - task: CopyFiles@2 + displayName: "Copy Files for APIScan" + inputs: + Contents: "*.vsix" + TargetFolder: $(Agent.TempDirectory)/APIScanFiles + condition: and(succeeded(), ne(variables['DisableAPIScan'], 'true')) + ### Run latest version of APIScan listed at https://www.1eswiki.com/wiki/APIScan_Build_Task + - task: APIScan@2 + displayName: Run APIScan + inputs: + softwareFolder: $(Agent.TempDirectory)/APIScanFiles + softwareName: "vscode-java-pack" + softwareVersionNum: "$(Build.BuildId)" + isLargeApp: false + toolVersion: "Latest" + condition: and(succeeded(), ne(variables['DisableAPIScan'], 'true')) + env: + AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret) + - script: npx @vscode/vsce@latest generate-manifest -i extension.vsix -o extension.manifest + displayName: 'Generate extension manifest' + - script: copy extension.manifest extension.signature.p7s + displayName: 'Prepare manifest for signing' + - task: CmdLine@2 + displayName: Sign extension + inputs: + script: dotnet %MBSIGN_APPFOLDER%/ddsignfiles.dll /file:extension.signature.p7s /certs:4014052 + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + - task: CopyFiles@2 + displayName: "Copy Files to: $(Build.ArtifactStagingDirectory)" + inputs: + Contents: | + extension.vsix + extension.manifest + extension.signature.p7s + TargetFolder: $(Build.ArtifactStagingDirectory) diff --git a/.azure-pipelines/npm-cfs-variables.yml b/.azure-pipelines/npm-cfs-variables.yml new file mode 100644 index 00000000..d4d17634 --- /dev/null +++ b/.azure-pipelines/npm-cfs-variables.yml @@ -0,0 +1,28 @@ +# Variables required to route npm package restore through the Central Feed Service +# (CFS). Consumed by every pipeline in this directory alongside the npm-cfs.yml steps +# template, which is where these values are actually applied. +# +# Both are declared here rather than in each pipeline so the feed URL exists in +# exactly one place. +# +# npm_config_registry is not redundant with the registry written into the generated +# .npmrc. npm resolves configuration in the order cli > environment > project .npmrc +# > user .npmrc, so a registry supplied only through the user config is outranked by +# anything the agent image already configures -- Microsoft hosted images ship a user +# level .npmrc pointing at an internal proxy, and a pool that exports +# npm_config_registry would win outright. Restore would then quietly resolve from +# somewhere other than CFS while the build still reported success. Declaring the +# variable here puts the redirect at environment precedence, where only an explicit +# command line flag can override it. +# +# npm matches npm_config_* environment variables case insensitively, so the +# uppercased form that Azure Pipelines exports applies to every step on every OS. +# That matters because package restore here is not driven by a single task: `npm +# install`, `npx json`, `npx @vscode/vsce` and the vsce invocation inside AzureCLI@2 +# all inherit the agent environment rather than reading a task input. + +variables: + - name: npm_config_registry + value: https://pkgs.dev.azure.com/mseng/VSJava/_packaging/vscjava/npm/registry/ + - name: npm_config_userconfig + value: $(Agent.TempDirectory)/.npmrc diff --git a/.azure-pipelines/npm-cfs.yml b/.azure-pipelines/npm-cfs.yml new file mode 100644 index 00000000..cfb955af --- /dev/null +++ b/.azure-pipelines/npm-cfs.yml @@ -0,0 +1,59 @@ +# Routes npm package restore through the Central Feed Service (CFS), as required by +# SFI Network Isolation. Consumed by every build pipeline in this directory. +# +# Pipelines must also include the companion variables template: +# variables: +# - template: /.azure-pipelines/npm-cfs-variables.yml@self +# which declares the feed URL and the generated .npmrc path. The redirect itself is +# carried by the npm_config_registry environment variable that template exports; see +# its header for why the generated .npmrc alone is not enough. +# +# The .npmrc is generated at build time into the agent temp directory rather than +# being committed to the repository, so that: +# * open source contributors and the GitHub Actions workflows keep restoring from +# the public npm registry -- npm rewrites the host of every `resolved` URL in +# package-lock.json to the configured registry, so a single lockfile serves both; +# * the credential that NpmAuthenticate injects never lands inside the workspace; +# * the configuration does not depend on the repository being checked out, so +# release jobs consuming a prebuilt artifact work the same way as build jobs. +# +# The registry is still written into that file because NpmAuthenticate discovers the +# registries to authenticate by reading it. npm then takes the URL from the +# environment and the matching credential from this file. +# +# The file is written with `npm config set` rather than a shell redirect because the +# pipelines span both Windows (VSEng-MicroBuildVSStable) and Linux +# (1ES_JavaTooling_Ubuntu-2004) pools. `script:` maps to CmdLine@2, which runs on +# both, and the npm invocation itself is shell agnostic. PowerShell@2 is avoided +# because it resolves `pwsh` before `powershell` and hard fails when neither is on +# PATH, which is not guaranteed on a custom Linux image. +# +# This template must run after the Node install task, and before any step that +# restores packages -- including `npx`, which resolves downloads through the +# configured registry. +# +# Consumers must reference this file as `/.azure-pipelines/npm-cfs.yml@self`. A +# relative path is resolved against the file doing the including, which for these +# pipelines is the 1ES extends template in another repository, so the unqualified +# form is looked up in 1ESPipelineTemplates and fails YAML compilation. + +steps: + - script: npm config set registry $(npm_config_registry) --location=user --userconfig="$(npm_config_userconfig)" + displayName: Configure CFS npm registry + + # Appends `//pkgs.dev.azure.com/.../registry/:_authToken=` for every registry + # it finds in the file above. `always-auth` is deliberately not written: it is not + # read by this task and is rejected outright by the npm 10 shipped with Node 20. + - task: NpmAuthenticate@0 + displayName: Authenticate to CFS feed + inputs: + workingFile: $(npm_config_userconfig) + + # Restore silently falling back to the public registry is the failure mode this + # whole template exists to prevent, and it leaves no trace in the build log, so it + # is asserted rather than assumed. Written in node, which the preceding Node + # install task guarantees, to avoid shell differences between the Linux and + # Windows pools. + - script: >- + node -e "const cp=require('child_process');const r=cp.execSync('npm config get registry').toString().trim();console.log('npm registry -> '+r);if(!r.startsWith('https://pkgs.dev.azure.com/')){console.error('##vso[task.logissue type=error]npm is not configured against the CFS feed');process.exit(1);}" + displayName: Verify CFS npm registry diff --git a/.azure-pipelines/rc.yml b/.azure-pipelines/rc.yml new file mode 100644 index 00000000..ea308bda --- /dev/null +++ b/.azure-pipelines/rc.yml @@ -0,0 +1,105 @@ +name: $(Date:yyyyMMdd).$(Rev:r) +variables: + - name: Codeql.Enabled + value: true + - template: /.azure-pipelines/npm-cfs-variables.yml@self +resources: + repositories: + - repository: self + type: git + ref: refs/heads/main + - repository: CustomPipelineTemplates + type: git + name: 1ESPipelineTemplates/MicroBuildTemplate + ref: refs/tags/release +trigger: none +extends: + template: azure-pipelines/MicroBuild.1ES.Official.yml@CustomPipelineTemplates + parameters: + pool: + name: VSEng-MicroBuildVSStable + stages: + - stage: Build + jobs: + - job: Job_1 + displayName: Agent job 1 + templateContext: + mb: + signing: + enabled: false + outputs: + - output: pipelineArtifact + artifactName: vsix + targetPath: $(Build.ArtifactStagingDirectory) + displayName: "Publish Artifact: vsix" + steps: + - checkout: self + clean: true + fetchTags: false + # Pin the last known-good Windows plugin while the 1.1.1374 client certificate regression is unresolved. + - task: NuGetAuthenticate@1 + displayName: Authenticate MicroBuild feed + - task: MicroBuildSigningPlugin@4 + displayName: Install Signing Plugin 1.1.1330 + inputs: + signType: real + version: '1.1.1330' + zipSources: false + ConnectedPMEServiceName: '40012d40-9ded-4f75-8476-d60758200346' + feedSource: 'https://mseng.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json' + env: + MicroBuildOutputFolderOverride: '$(Agent.TempDirectory)' + - task: NodeTool@0 + displayName: Use Node 20.x + inputs: + versionSpec: 20.x + - template: /.azure-pipelines/npm-cfs.yml@self + - task: CmdLine@2 + displayName: npm install + inputs: + script: npm install + - task: CmdLine@2 + displayName: Replace AI Key + inputs: + script: npx json@9.0.6 -I -f package.json -e "this.aiKey=\"%AI_KEY%\"" + - task: CmdLine@2 + displayName: VSCE package + inputs: + script: npx @vscode/vsce@latest package -o extension.vsix + ### Copy files for APIScan + - task: CopyFiles@2 + displayName: "Copy Files for APIScan" + inputs: + Contents: "*.vsix" + TargetFolder: $(Agent.TempDirectory)/APIScanFiles + condition: and(succeeded(), ne(variables['DisableAPIScan'], 'true')) + ### Run latest version of APIScan listed at https://www.1eswiki.com/wiki/APIScan_Build_Task + - task: APIScan@2 + displayName: Run APIScan + inputs: + softwareFolder: $(Agent.TempDirectory)/APIScanFiles + softwareName: "vscode-java-pack" + softwareVersionNum: "$(Build.BuildId)" + isLargeApp: false + toolVersion: "Latest" + condition: and(succeeded(), ne(variables['DisableAPIScan'], 'true')) + env: + AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret) + - script: npx @vscode/vsce@latest generate-manifest -i extension.vsix -o extension.manifest + displayName: 'Generate extension manifest' + - script: copy extension.manifest extension.signature.p7s + displayName: 'Prepare manifest for signing' + - task: CmdLine@2 + displayName: Sign extension + inputs: + script: dotnet %MBSIGN_APPFOLDER%/ddsignfiles.dll /file:extension.signature.p7s /certs:4014052 + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + - task: CopyFiles@2 + displayName: "Copy Files to: $(Build.ArtifactStagingDirectory)" + inputs: + Contents: | + extension.vsix + extension.manifest + extension.signature.p7s + TargetFolder: $(Build.ArtifactStagingDirectory) diff --git a/.azure-pipelines/release-nightly.yml b/.azure-pipelines/release-nightly.yml new file mode 100644 index 00000000..bbd3f446 --- /dev/null +++ b/.azure-pipelines/release-nightly.yml @@ -0,0 +1,57 @@ +# This pipeline is used to release the java pack extension from the nightly/stable build. +# It contains following steps: +# 1. Download the plugin artifact from the nightly/stable build pipeline. +# 2. Publish the plugin to the marketplace. + +name: $(Date:yyyyMMdd).$(Rev:r) # Use the current date and a revision number for the build name. + +variables: + - name: Codeql.Enabled + value: true + - template: /.azure-pipelines/npm-cfs-variables.yml@self +resources: + repositories: + - repository: self + type: git + ref: refs/heads/main + - repository: 1esPipelines + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release +trigger: none +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines + parameters: + pool: + os: linux + name: 1ES_JavaTooling_Pool + image: 1ES_JavaTooling_Ubuntu-2004 + stages: + - stage: Release + jobs: + - job: Job + displayName: Release VS Code Java Pack Extension + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + buildType: specific + project: $(AzDo.ProjectId) # Azure DevOps project ID + definition: $(AzDo.BuildPipelineId) # artifact build pipeline ID + artifactName: vsix + downloadType: specific + targetPath: '$(Build.SourcesDirectory)' + steps: + - task: UseNode@1 + displayName: 'Use Node.js 20.x' + inputs: + version: '20.x' + - template: /.azure-pipelines/npm-cfs.yml@self + - task: AzureCLI@2 + displayName: 'VSCE Publish' + inputs: + azureSubscription: 'VSCode-Ext-Publishing' + scriptType: pscore + scriptLocation: inlineScript + inlineScript: 'npx @vscode/vsce@latest publish -i ''$(Build.SourcesDirectory)/extension.vsix'' --manifestPath ''$(Build.SourcesDirectory)/extension.manifest'' --signaturePath ''$(Build.SourcesDirectory)/extension.signature.p7s'' --azure-credential --allow-all-proposed-apis' \ No newline at end of file diff --git a/.azure-pipelines/release.yml b/.azure-pipelines/release.yml new file mode 100644 index 00000000..b4b58f64 --- /dev/null +++ b/.azure-pipelines/release.yml @@ -0,0 +1,57 @@ +# This pipeline is used to release the java pack extension from the nightly/stable build. +# It contains following steps: +# 1. Download the plugin artifact from the nightly/stable build pipeline. +# 2. Publish the plugin to the marketplace. + +name: $(Date:yyyyMMdd).$(Rev:r) # Use the current date and a revision number for the build name. + +variables: + - name: Codeql.Enabled + value: true + - template: /.azure-pipelines/npm-cfs-variables.yml@self +resources: + repositories: + - repository: self + type: git + ref: refs/heads/main + - repository: 1esPipelines + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release +trigger: none +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines + parameters: + pool: + os: linux + name: 1ES_JavaTooling_Pool + image: 1ES_JavaTooling_Ubuntu-2004 + stages: + - stage: Release + jobs: + - job: Job + displayName: Release VS Code Java Pack Extension + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + buildType: specific + project: $(AzDo.ProjectId) # Azure DevOps project ID + definition: $(AzDo.BuildPipelineId) # artifact build pipeline ID + artifactName: vsix + downloadType: specific + targetPath: '$(Build.SourcesDirectory)' + steps: + - task: UseNode@1 + displayName: 'Use Node.js 20.x' + inputs: + version: '20.x' + - template: /.azure-pipelines/npm-cfs.yml@self + - task: AzureCLI@2 + displayName: 'vsce publish' + inputs: + azureSubscription: 'VSCode-Ext-Publishing' + scriptType: pscore + scriptLocation: inlineScript + inlineScript: 'npx @vscode/vsce@latest publish -i ''$(Build.SourcesDirectory)/extension.vsix'' --manifestPath ''$(Build.SourcesDirectory)/extension.manifest'' --signaturePath ''$(Build.SourcesDirectory)/extension.signature.p7s'' --azure-credential' \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..7e37243a --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @jdneo @testforstephen @chagong @wenytang-ms diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index 03ad3305..fa10455e 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -2,7 +2,9 @@ name: Bug report about: Create a report to help us improve title: Bug -label: bug +labels: '' +assignees: '' + --- + {{content}} + +
+

+ Generated by GitHub Actions workflow +

+ + + ``` + +3. **Content formatting guidelines**: + - Plain text → Wrap in `

` tags + - Lists → Use `