Skip to content

Commit dfcf224

Browse files
author
OneBranch Resources
committed
Adding OneBranch pipeline YAML config file for PowerShellGet-Official
1 parent fe34ca3 commit dfcf224

File tree

1 file changed

+170
-0
lines changed

1 file changed

+170
-0
lines changed

.pipelines/PowerShellGet-Official.yml

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
#################################################################################
2+
# OneBranch Pipelines #
3+
# This pipeline was created by EasyStart from a sample located at: #
4+
# https://aka.ms/obpipelines/easystart/samples #
5+
# Documentation: https://aka.ms/obpipelines #
6+
# Yaml Schema: https://aka.ms/obpipelines/yaml/schema #
7+
# Retail Tasks: https://aka.ms/obpipelines/tasks #
8+
# Support: https://aka.ms/onebranchsup #
9+
#################################################################################
10+
11+
trigger: none # https://aka.ms/obpipelines/triggers
12+
13+
parameters: # parameters are shown up in ADO UI in a build queue time
14+
- name: 'debug'
15+
displayName: 'Enable debug output'
16+
type: boolean
17+
default: false
18+
19+
variables:
20+
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
21+
system.debug: ${{ parameters.debug }}
22+
23+
BuildSolution: $(Build.SourcesDirectory)\dirs.proj
24+
BuildConfiguration: Release
25+
26+
WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2019/vse2022:latest' # Docker image which is used to build the project https://aka.ms/obpipelines/containers
27+
28+
resources:
29+
repositories:
30+
- repository: templates
31+
type: git
32+
name: OneBranch.Pipelines/GovernedTemplates
33+
ref: refs/heads/main
34+
35+
extends:
36+
template: v2/OneBranch.Official.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates
37+
parameters:
38+
cloudvault: # https://aka.ms/obpipelines/cloudvault
39+
enabled: false
40+
globalSdl: # https://aka.ms/obpipelines/sdl
41+
asyncSdl:
42+
enabled: true
43+
tsaOptionsFile: .config/tsaoptions.json
44+
# tsa:
45+
# enabled: false # onebranch publish all sdl results to TSA. If TSA is disabled all SDL tools will forced into 'break' build mode.
46+
# credscan:
47+
# suppressionsFile: $(Build.SourcesDirectory)\.config\CredScanSuppressions.json
48+
policheck:
49+
break: true # always break the build on policheck issues. You can disable it by setting to 'false'
50+
# suppression:
51+
# suppressionFile: $(Build.SourcesDirectory)\.gdn\global.gdnsuppress
52+
53+
stages:
54+
- stage: build
55+
jobs:
56+
- job: main
57+
pool:
58+
type: windows # read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs
59+
60+
variables: # More settings at https://aka.ms/obpipelines/yaml/jobs
61+
ob_outputDirectory: '$(Build.SourcesDirectory)\out' # this directory is uploaded to pipeline artifacts, reddog and cloudvault. More info at https://aka.ms/obpipelines/artifacts
62+
# https://aka.ms/obpipelines/sdl
63+
ob_sdl_binskim_break: true # always break the build on binskim issues, even if TSA enabled. You can disable it by setting to 'false'
64+
ob_sdl_roslyn_break: true
65+
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}: # conditionally enable symbolsPublishing for main branch only
66+
ob_symbolsPublishing_enabled: true # https://aka.ms/obpipelines/symbols
67+
# ob_sdl_suppression_suppressionFile: $(Build.SourcesDirectory)\.gdn\job.gdnsuppress
68+
69+
steps:
70+
- task: UseDotNet@2
71+
continueOnError: true
72+
inputs:
73+
packageType: 'sdk'
74+
useGlobalJson: true
75+
performMultiLevelLookup: true
76+
77+
- task: onebranch.pipeline.version@1 # generates automatic version. For other versioning options check https://aka.ms/obpipelines/versioning
78+
displayName: 'Setup BuildNumber'
79+
inputs:
80+
system: 'RevisionCounter'
81+
major: '1'
82+
minor: '0'
83+
exclude_commit: true
84+
85+
- task: DotNetCoreCLI@2
86+
displayName: 'DotNetCore restore'
87+
inputs:
88+
command: 'custom'
89+
projects: $(BuildSolution)
90+
custom: 'restore'
91+
92+
# roslynanalyzers task wraps around dotnet build to enable static analysis
93+
- task: RoslynAnalyzers@3
94+
displayName: 'DotNetCore build with RoslynAnalyzers'
95+
inputs:
96+
userProvideBuildInfo: 'msBuildInfo'
97+
msBuildCommandline: 'dotnet.exe build $(BuildSolution) --no-restore --configuration $(BuildConfiguration)'
98+
99+
- task: DotNetCoreCLI@2
100+
displayName: 'DotNetCore test'
101+
inputs:
102+
command: 'test'
103+
projects: $(BuildSolution)
104+
arguments: '--no-build --no-restore --configuration $(BuildConfiguration) --logger trx --blame --collect "Code coverage" --results-directory $(Build.SourcesDirectory)\TestResults\'
105+
publishTestResults: false
106+
107+
- task: PublishTestResults@2
108+
displayName: 'Publish test results'
109+
inputs:
110+
testResultsFormat: VSTest
111+
testResultsFiles: '$(Build.SourcesDirectory)\TestResults\**\*.trx'
112+
failTaskOnFailedTests: true
113+
114+
- task: DotNetCoreCLI@2
115+
displayName: 'DotNetCore publish'
116+
inputs:
117+
command: 'publish'
118+
publishWebProjects: false
119+
projects: $(BuildSolution)
120+
arguments: '--no-build --no-restore --configuration $(BuildConfiguration) --output $(Build.SourcesDirectory)\out'
121+
zipAfterPublish: false
122+
123+
- task: onebranch.pipeline.signing@1
124+
displayName: 'Sign output'
125+
inputs:
126+
command: 'sign'
127+
signing_environment: 'azure-ado'
128+
files_to_sign: '**/*.exe;**/*.dll;**/*.ps1;**/*.psm1'
129+
search_root: '$(Build.SourcesDirectory)\out'
130+
# uncomment this section and edit parameters to enable VSTest instead of dotnet tests. When you enable this you dont need publish test results and codecoverage steps
131+
# - task: VSTest@3
132+
# inputs:
133+
# testSelector: 'testAssemblies'
134+
# testAssemblyVer2: |
135+
# **\*test*.dll
136+
# !**\*TestAdapter.dll
137+
# !**\obj\**
138+
# searchFolder: '$(Build.SourcesDirectory)\out' ## or use '$(Agent.BuildDirectory)'
139+
##testFiltercriteria: 'TestCategory=UnitTests' ## update
140+
#resultsFolder: '$(Build.SourcesDirectory)\out\logs\TestResults'
141+
#runInParallel: true ## this setting helps to speed up test case execution but if youhave depdencies between tests you change or remove this but having it enabled is always recommended
142+
#codeCoverageEnabled: true
143+
#testRunTitle: 'release_x64' ## Update this for a custom readable way of taggin your test run when you query in ADO test runs view
144+
#platform: 'x64' ## you can modify this as needed
145+
#configuration: 'release'
146+
#publishRunAttachments: false
147+
#failOnMinTestsNotRun: true
148+
#rerunFailedTests: true
149+
#rerunFailedThreshold: '70'
150+
# https://aka.ms/obpipelines/cloudtest
151+
# uncomment this section and edit parameters to enable CloudTest
152+
# - stage: cloudtest
153+
# dependsOn: build_stage
154+
# jobs:
155+
# - job: cloudtestjob
156+
# pool:
157+
# type: cloudtestagentless
158+
# continueOnError: true
159+
# steps:
160+
# - task: CloudTestServerBuildTask@1
161+
# displayName: 'CloudTest'
162+
# inputs:
163+
# connectedServiceName: 'CloudTest-prod'
164+
# cloudTestTenant: 'onebranchtest'
165+
# testMapLocation: '[BuildRoot]\ClassLibrary.UnitTest\TestMapCdp.xml'
166+
# pipelineArtifactName: 'drop_build_main'
167+
# pipelineArtifactBuildUrl: '$(System.TaskDefinitionsUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)'
168+
# parserProperties: 'worker:VsTestVersion=V150;CodeCoverageType=Dynamic;worker:TestVar=$(RUN_PIPELINE_VARIABLE)'
169+
# cacheEnabled: false
170+
# scheduleBuildRequesterAlias: 'azbldrun'

0 commit comments

Comments
 (0)