diff --git a/.pipelines/OneBranch.Buddy.yml b/.pipelines/OneBranch.Buddy.yml new file mode 100644 index 0000000..9dc4384 --- /dev/null +++ b/.pipelines/OneBranch.Buddy.yml @@ -0,0 +1,131 @@ +################################################################################# +# 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: none + + 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/sdl + ob_artifactBaseName: 'drop' + ob_sdl_cg_failOnAlert: false + + steps: + # Custom Versioning - we will build the version using package.json in versioning commands. + - task: CmdLine@2 + displayName: 'Set Version' + inputs: + script: '$(Build.SourcesDirectory)\.pipelines\onebranch_run_ps.cmd 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' + + # Commands to run during the restore stage + - task: CmdLine@2 + displayName: 'Restore' + inputs: + script: '$(Build.SourcesDirectory)\.pipelines\onebranch_run_ps.cmd restore.ps1' + workingDirectory: '$(Build.SourcesDirectory)' + + # Commands to run during the build stage. + - task: CmdLine@2 + displayName: 'Build' + inputs: + script: '$(Build.SourcesDirectory)\.pipelines\onebranch_run_ps.cmd build.ps1' + workingDirectory: '$(Build.SourcesDirectory)' + + # Commands to run during the packaging stage. + - task: CmdLine@2 + displayName: 'Package' + inputs: + script: '$(Build.SourcesDirectory)\.pipelines\onebranch_run_ps.cmd package.ps1' + workingDirectory: '$(Build.SourcesDirectory)' + + # 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: 'dist\**\*;LICENSE.txt;package.json;README.md;**\*.tgz' + search_root: '$(Build.SourcesDirectory)' + + # Copying build artifacts to the Output folder. + - task: CopyFiles@2 + displayName: 'Copy Dist to Output folder' + inputs: + Contents: | + $(Build.SourcesDirectory)\dist\**\* + $(Build.SourcesDirectory)\LICENSE.txt + $(Build.SourcesDirectory)\package.json + $(Build.SourcesDirectory)\README.md + TargetFolder: '$(OUTPUTROOT)\outputs\build\build_artifacts' + + # Copying tgz package to the Output folder. + - task: CopyFiles@2 + displayName: 'Copy tgz-package to Output folder' + inputs: + Contents: | + $(Build.SourcesDirectory)\*.tgz + TargetFolder: '$(OUTPUTROOT)\outputs\package\tgz-package' \ No newline at end of file diff --git a/.pipelines/cdpx_run_ps.cmd b/.pipelines/onebranch_run_ps.cmd similarity index 100% rename from .pipelines/cdpx_run_ps.cmd rename to .pipelines/onebranch_run_ps.cmd diff --git a/.pipelines/pipeline.user.windows.yml b/.pipelines/pipeline.user.windows.yml deleted file mode 100644 index 4b74e33..0000000 --- a/.pipelines/pipeline.user.windows.yml +++ /dev/null @@ -1,103 +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 - -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: - - 'test\**\*' - - 'node_modules\**\*' - - binskim_options: - files_to_scan: - - exclude: - - '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' - -# 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" - -test: - commands: - - !!testcommand - name: 'Test powerbi-models' - arguments: 'test.ps1' - command: '.pipelines\cdpx_run_ps.cmd' - testresults: - - title: 'powerbi-models test results' - type: 'jasmine' - from: 'reports' - include: - - "**coverage/**/index.html" diff --git a/.pipelines/version.ps1 b/.pipelines/version.ps1 index 9a13881..694b575 100644 --- a/.pipelines/version.ps1 +++ b/.pipelines/version.ps1 @@ -1,13 +1,11 @@ try { # package.json is in root folder, while version.ps1 runs in .pipelines folder. $version = (Get-Content "package.json") -join "`n" | ConvertFrom-Json | Select -ExpandProperty "version" - $revision = $env:CDP_DEFINITION_BUILD_COUNT_DAY + $revision = $env:CDP_DEFINITION_BUILD_COUNT $buildNumber = "$version.$revision" 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