Skip to content
Open
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
53 changes: 53 additions & 0 deletions .azure-pipelines/.vsts.cg-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Build all tasks for Component Governance checks

trigger: none

resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release

parameters:
- name: build_mode
displayName: 'Choose build mode'
type: string
default: 'Build all tasks'
values:
- 'Build all tasks'
- 'Build specific tasks'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not have option here to build specific tasks at all. the only option should be to build all tasks always.

we should instead add option to have list of deprecated tasks that can be skipped if needed, or it should pick the list of deprecated tasks from the repo itself may be, the list is available currently in https://github.com/microsoft/azure-pipelines-tasks/blob/master/DEPRECATION.md

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list of deprecated tasks that I can try to add, but can’t we keep the build-specific tasks at least for now? This is because testing the pipeline initially with all tasks will take around 9 hours

- name: task_names
displayName: 'Task names to build (e.g. BashV3,AzureCLIV1,PowerShellV2) - only used when "Build specific tasks" is selected'
type: string
default: ''

variables:
- name: DEPLOY_ALL_TASKSVAR
${{ if eq(parameters.build_mode, 'Build all tasks') }}:
value: 'true'
${{ else }}:
value: 'false'
- name: taskPattern
${{ if eq(parameters.build_mode, 'Build specific tasks') }}:
value: ${{ parameters.task_names }}
${{ else }}:
value: ''
- name: includeLocalPackagesBuildConfigParameter
value: ''

extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
stages:
- stage: main
jobs:
- job: build_all_tasks_for_cg_check
displayName: Build all tasks for CG check
pool:
name: 1ES-ABTT-Shared-Pool
image: abtt-windows-2022
os: windows
steps:
- template: /ci/ci-build-tasks/common-steps.yml@self
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use any existing template file for build all taks like https://github.com/microsoft/azure-pipelines-tasks/blob/master/ci/build-all-tasks.yml ??


61 changes: 61 additions & 0 deletions ci/ci-build-tasks/common-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
parameters:
- name: task_name
displayName: 'Task names to build (e.g. BashV3,AzureCLIV1,PowerShellV2) or leave empty to build all tasks'
type: string
default: ''
- name: build_all_tasks
displayName: 'Build all tasks (ignore task_name parameter)'
type: boolean
default: true

steps:

# Clean
- checkout: self
clean: true

# Use .NET SDK 8
- task: UseDotNet@2
displayName: 'Install .NET Core SDK 8.x'
inputs:
version: 8.x

# Use node 20, npm 9
- task: NodeTool@0
displayName: Use node 20
inputs:
versionSpec: 20.x

- task: NpmAuthenticate@0
inputs:
workingFile: .npmrc

# npm ci
- script: npm ci
displayName: npm ci

# Get tasks to build (variables already set at pipeline level)
- script: node ./ci/filter-tasks.js
displayName: Determine tasks to build
name: getTaskPattern
env:
PACKAGE_ENDPOINT: $(Package.Endpoint)
PACKAGE_TOKEN: $(System.AccessToken)

- script: node ./ci/before-build-check-tasks.js
displayName: Before build task validation
condition: |
and(
succeeded(),
eq(variables['build.reason'], 'PullRequest'),
ne(variables['numTasks'], 0)
)

# Clean tasks
- script: node make.js clean
displayName: Clean tasks

# Build Tasks
- script: node make.js serverBuild --task "$(getTaskPattern.task_pattern)" $(includeLocalPackagesBuildConfigParameter)
displayName: Build Tasks
condition: and(succeeded(), ne(variables['numTasks'], 0))