Merged PR 309731: Adding OneBranch pipeline YAML config file for powerbi-javascript-Buddy

Generate OneBranch Pipeline YAML config files. This pull request is initially auto-generated by Easy Start, for more details, please visit our [wiki](https://aka.ms/easystart).

**Difference Compared to powerbi-models repo PR:**

1. In the PR of powerbi-models, we ran power script files in CmdLine@2 using onebranch_run_ps.cmd file. But after May comment, in all the following PR we are using PowerShell@2 task to run our power script files and deleted onebranch_run_ps.cmd file.
2. In powerbi-javascript we also have a task to copy source artifacts to Output folder. Took a reference of this task from CDPx pipelines
3. We also have nuget_pack, so Added nugetInstaller task and to run nuget_pack.ps file and copy nugetpack to output folder

**Result of OneBranch Buddy Pipeline**
https://dev.azure.com/powerbi/Embedded/_build/results?buildId=5886126&view=results

**Drop Folder from OneBranch**
![image (3).png](https://dev.azure.com/powerbi/4c7b5adb-c2d0-4f18-b23c-edc4ac30f4e1/_apis/git/repositories/1dd63332-e003-46a3-ac6f-70213a1bcc2e/pullRequests/309731/attachments/image%20%283%29.png)

**Drop Folder from CDPx**
![image (2).png](https://dev.azure.com/powerbi/4c7b5adb-c2d0-4f18-b23c-edc4ac30f4e1/_apis/git/repositories/1dd63332-e003-46a3-ac6f-70213a1bcc2e/pullRequests/309731/attachments/image%20%282%29.png)
This commit is contained in:
PIE Easy Start 2022-12-21 03:33:24 +00:00 коммит произвёл Kotana Sai
Родитель 402c513159
Коммит 878612ff70
5 изменённых файлов: 178 добавлений и 124 удалений

Просмотреть файл

@ -0,0 +1,174 @@
#################################################################################
# Onebranch Pipelines - Buddy MSBuild (CDPXMigrated) #
# 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 # https://aka.ms/obpipelines/triggers
parameters: # parameters are shown up in ADO UI in a build queue time
- name: 'debug'
displayName: 'Enable debug output'
type: boolean
default: false
variables:
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
system.debug: ${{ parameters.debug }}
ENABLE_PRS_DELAYSIGN: 1
ROOT: $(Build.SourcesDirectory)
REPOROOT: $(Build.SourcesDirectory)
OUTPUTROOT: $(REPOROOT)\out
NUGET_XMLDOC_MODE: skip
WindowsContainerImage: 'cdpxwin1809.azurecr.io/global/obinfra/windows/1809/vs2019:latest' # Docker image which is used to build the project https://aka.ms/obpipelines/containers
resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main
extends:
template: v2/OneBranch.NonOfficial.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates
parameters:
globalSdl: # https://aka.ms/obpipelines/sdl
tsa:
enabled: false # onebranch publish all sdl results to TSA. If TSA is disabled all SDL tools will forced into 'break' build mode.
cg:
failOnAlert: false
stages:
- stage: build
jobs:
- job: main
pool:
type: windows # read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs
variables: # More settings at https://aka.ms/obpipelines/yaml/jobs
ob_outputDirectory: '$(OUTPUTROOT)' # this directory is uploaded to pipeline artifacts, reddog and cloudvault. More info at https://aka.ms/obpipelines/artifacts
ob_sdl_binskim_break: true # https://aka.ms/obpipelines/sd
ob_artifactBaseName: 'drop'
ob_sdl_cg_failOnAlert: false
steps:
# Custom Versioning - we will build the version using package.json in versioning commands.
- task: PowerShell@2
displayName: 'Set Version'
inputs:
targetType: 'filePath'
filePath: '$(Build.SourcesDirectory)\.pipelines\version.ps1'
workingDirectory: '$(Build.SourcesDirectory)'
# Add the versioning task after running Version script
- task: onebranch.pipeline.version@1
inputs:
system: 'Custom'
customVersion: '$(CustomBuildNumber)'
- task: NodeTool@0
displayName: 'Install Node.js'
inputs:
versionSpec: '16.x'
- task: npmAuthenticate@0
displayName: 'NPM Authenticate'
inputs:
workingFile: '$(Build.SourcesDirectory)/.npmrc'
- task: PowerShell@2
displayName: 'Restore'
inputs:
targetType: 'filePath'
filePath: '$(Build.SourcesDirectory)\.pipelines\restore.ps1'
workingDirectory: '$(Build.SourcesDirectory)'
- task: PowerShell@2
displayName: 'Build'
inputs:
targetType: 'filePath'
filePath: '$(Build.SourcesDirectory)\.pipelines\build.ps1'
workingDirectory: '$(Build.SourcesDirectory)'
- task: PowerShell@2
displayName: 'Package'
inputs:
targetType: 'filePath'
filePath: '$(Build.SourcesDirectory)\.pipelines\package.ps1'
workingDirectory: '$(Build.SourcesDirectory)'
- task: NuGetToolInstaller@1
displayName: 'Install Nuget'
inputs:
versionSpec: '*'
checkLatest: true
- task: PowerShell@2
displayName: 'Nuget Package'
inputs:
targetType: 'filePath'
filePath: '$(Build.SourcesDirectory)\.pipelines\nuget_pack.ps1'
workingDirectory: '$(Build.SourcesDirectory)'
# Copying build artifacts to the Output folder
- task: CopyFiles@2
displayName: 'Copy Dist to Output folder'
inputs:
SourceFolder: $(Build.SourcesDirectory)
Contents: |
dist\**\*
LICENSE.txt
package.json
README.md
TargetFolder: '$(OUTPUTROOT)\outputs\build\build_artifacts'
# Copying source artifacts to the Output folder
- task: CopyFiles@2
displayName: 'Copy source to Output folder'
inputs:
SourceFolder: $(Build.SourcesDirectory)
Contents: |
**\*
!**\.pipelines\**\*
!**\.vscode\**\*
!**\test\**\*.*
!**\demo\**\*
!**\dist\**\*
!**\out\**\*
!**\*.tgz
!**\**.nupkg
!**\node_modules\**\*
TargetFolder: '$(OUTPUTROOT)\outputs\build\source'
# Copying tgz package to the Output folder
- task: CopyFiles@2
displayName: 'Copy tgz-package to Output folder'
inputs:
SourceFolder: $(Build.SourcesDirectory)
Contents: |
*.tgz
TargetFolder: '$(OUTPUTROOT)\outputs\package\tgz-package'
# Copying nuget pack to the Output folder
- task: CopyFiles@2
displayName: 'Copy nuget pack to Output folder'
inputs:
SourceFolder: $(Build.SourcesDirectory)
Contents: |
Microsoft.PowerBI.JavaScript.*.nupkg
TargetFolder: '$(OUTPUTROOT)\outputs\package\Release'
# Signing the files created by the build and packaging script
- task: onebranch.pipeline.signing@1
displayName: 'Sign binaries'
inputs:
command: 'sign'
signing_environment: 'azure-ado'
signing_profile: 'internal_azure_service'
files_to_sign: '**'
search_root: '$(OUTPUTROOT)'

Просмотреть файл

@ -1,6 +0,0 @@
setlocal enabledelayedexpansion
pushd "%~dp0\.."
powershell.exe -ExecutionPolicy Unrestricted -NoProfile -WindowStyle Hidden -NonInteractive -File "%~dp0%~1"
endlocal
popd
exit /B %ERRORLEVEL%

Просмотреть файл

@ -1,10 +1,10 @@
Write-Host "Start running nuget_pack.ps1"
$versionNumber = [Environment]::GetEnvironmentVariable("CustomBuildNumber", "User");
$versionNumber = (Get-Content "package.json") -join "`n" | ConvertFrom-Json | Select -ExpandProperty "version"
$exitCode = 0;
Write-Host "Nuget Pack ..\PowerBI.JavaScript.nuspec -Version "$versionNumber
& nuget pack "..\PowerBI.JavaScript.nuspec" -Version $versionNumber
Write-Host "Nuget Pack PowerBI.JavaScript.nuspec -Version "$versionNumber
& nuget pack "PowerBI.JavaScript.nuspec" -Version $versionNumber
$exitCode += $LASTEXITCODE;

Просмотреть файл

@ -1,113 +0,0 @@
environment:
host:
os: "windows"
runtime:
provider: "appcontainer"
image: "cdpxwinrs5.azurecr.io/global/vse2019:latest"
source_mode: "map"
artifact_publish_options:
publish_to_legacy_artifacts: false
publish_to_pipeline_artifacts: true
publish_to_cloudvault_artifacts: false
# Enable signing on all declared artifacts.
signing_options:
profile: 'external_distribution'
codesign_validation_glob_pattern: 'regex|.+(?:exe|dll)$;-|*.nd.dll;-|.gdn\\**'
static_analysis_options:
moderncop_options:
files_to_scan:
- from: 'src\'
include:
- '**/*.*'
policheck_options:
files_to_scan:
- exclude:
- 'demo\**\*' # Exclude path 'Localize'.
- 'test\**\*'
- 'node_modules\**\*'
binskim_options:
files_to_scan:
- exclude:
- 'demo\**\*' # Exclude path 'Localize'.
- 'test\**\*'
- 'node_modules\**\*'
package_sources:
npm:
config_files:
- include:
- ".npmrc"
feeds:
registry: https://powerbi.pkgs.visualstudio.com/_packaging/SDK.Externals/npm/registry/
version:
major: 1 # <---- Required field but not being used for 'custom' scheme
minor: 0 # <---- Required field but not being used for 'custom' scheme
system: 'custom' # <---- Set this to 'custom'. we will build the version using package.json in versioning commands.
versioning:
commands:
- !!defaultcommand
name: 'Set Version'
arguments: 'version.ps1'
command: '.pipelines\cdpx_run_ps.cmd'
restore:
commands:
- !!defaultcommand
name: 'NPM Install'
arguments: 'restore.ps1'
command: '.pipelines\cdpx_run_ps.cmd'
build:
commands:
- !!buildcommand
name: 'Build'
arguments: 'build.ps1'
command: '.pipelines\cdpx_run_ps.cmd'
artifacts:
- to: 'build_artifacts'
include:
- 'dist/**/*'
- 'LICENSE.txt'
- 'package.json'
- 'README.md'
- to: 'source'
include:
- '**/*'
exclude:
- '**/.pipelines/**/*.*'
- '**/.vscode/**/*.*'
- '**/test/**/*.*'
- '**/demo/**/*.*'
- '**/dist/**/*.*'
- '**/node_modules/**/*.*'
# All build stage artifacts get signed right after the build stage
# because the global signing profile is defined.
package:
commands:
- !!buildcommand
name: 'Package'
arguments: 'package.ps1'
command: '.pipelines\cdpx_run_ps.cmd'
artifacts:
- to: 'tgz-package'
include:
- "**/*.tgz"
- !!buildcommand
name: 'Nuget Pack'
arguments: 'nuget_pack.ps1'
command: '.pipelines\cdpx_run_ps.cmd'
artifacts:
- to: 'Release'
include:
- "**/Microsoft.PowerBI.JavaScript.*.nupkg"

Просмотреть файл

@ -5,8 +5,7 @@ try {
Write-Host "Build Number is" $buildNumber
[Environment]::SetEnvironmentVariable("CustomBuildNumber", $buildNumber, "User") # This will allow you to use it from env var in later steps of the same phase
Write-Host "##vso[build.updatebuildnumber]${buildNumber}" # This will update build number on your build
Write-Host "##vso[task.setvariable variable=CustomBuildNumber]${buildNumber}" # This will allow you to use it from env var in later steps of the same phase
}
catch {
Write-Error $_.Exception