Skip to content

Commit

Permalink
XS✔ ◾ Updating Azure DevOps Pipelines (#406)
Browse files Browse the repository at this point in the history
## Summary

### Motivation

The Azure DevOps pipelines are being split into PR and Production
pipelines, to allow for the setting of custom variables for different
environments.

### Technical

Splitting up the pipeline into two, with the reusable logic moved to a
new template.

The Production pipeline includes a check to not run if is invoked as
part of a PR.

## Testing

### Test Types

- [ ] Unit tests
- [X] Manual tests

### Unit Test Coverage

100%
  • Loading branch information
muiriswoulfe authored Jul 12, 2023
1 parent 1f6f326 commit b706eed
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 130 deletions.
136 changes: 6 additions & 130 deletions .github/azure-devops/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,140 +3,16 @@

---

trigger:
- main
trigger: none

pr:
- main

pool:
vmImage: ubuntu-latest
branches:
include:
- main

variables:
- name: tags
value: multi-phased

jobs:
- job: Delay
displayName: Delay
pool: server
steps:
- task: Delay@1
displayName: Wait for Deployment
inputs:
delayForMinutes: '5'

- job: PRMetrics_macOS
displayName: PR Metrics – macOS
dependsOn: Delay
pool:
vmImage: macOS-latest
variables:
- name: skipComponentGovernanceDetection
value: true
- name: System.Debug
value: true
steps:
- checkout: self
displayName: Checkout
fetchDepth: 0

- task: PRMetrics@1
displayName: PR Metrics
env:
# Azure DevOps Personal Access Token (PAT) with the Agent Pools (Read & Manage) permission.
PR_METRICS_ACCESS_TOKEN: $(GITHUB_PAT)

- job: PRMetrics_Ubuntu
displayName: PR Metrics – Ubuntu
dependsOn: PRMetrics_macOS
pool:
vmImage: ubuntu-latest
variables:
- name: skipComponentGovernanceDetection
value: true
- name: System.Debug
value: true
steps:
- checkout: self
displayName: Checkout
fetchDepth: 0

- task: PRMetrics@1
displayName: PR Metrics
env:
# Azure DevOps Personal Access Token (PAT) with the Agent Pools (Read & Manage) permission.
PR_METRICS_ACCESS_TOKEN: $(GITHUB_PAT)

- job: PRMetrics_Windows
displayName: PR Metrics – Windows
dependsOn: PRMetrics_Ubuntu
pool:
vmImage: windows-latest
variables:
- name: skipComponentGovernanceDetection
value: true
- name: System.Debug
value: true
steps:
- checkout: self
displayName: Checkout
fetchDepth: 0

- task: PRMetrics@1
displayName: PR Metrics
env:
# Azure DevOps Personal Access Token (PAT) with the Agent Pools (Read & Manage) permission.
PR_METRICS_ACCESS_TOKEN: $(GITHUB_PAT)

- job: Compliance
displayName: Compliance
pool:
vmImage: windows-latest
steps:
- task: ComponentGovernanceComponentDetection@0
displayName: Component Detection
inputs:
failOnAlert: true

- task: AntiMalware@4
displayName: Anti-Malware Scanner
inputs:
ScanType: FullSystemScan
EnableServices: true
ForceSignatureUpdate: true
SignatureUpdateUsesMMPC: true
TreatSignatureUpdateFailureAs: Error

- task: CredScan@3
displayName: Credential Scanner

- task: ESLint@1
displayName: ESLint
inputs:
Configuration: recommended

- task: PoliCheck@2
displayName: PoliCheck
inputs:
targetType: F
optionsFC: 1
optionsUEPATH: $(Build.SourcesDirectory)/.github/azure-devops/PoliCheckExclusions.xml

- task: Semmle@1
displayName: CodeQL
inputs:
sourceCodeDirectory: $(Build.SourcesDirectory)/src
language: tsandjs

- task: PublishSecurityAnalysisLogs@3
displayName: Guardian – Publish Artifacts

- task: PostAnalysis@2
displayName: Guardian – Perform Analysis
inputs:
GdnBreakPolicyMinSev: Note
GdnBreakGdnToolGosecSeverity: Default
GdnBreakPolicy: M365

...
stages:
- template: template.yml
35 changes: 35 additions & 0 deletions .github/azure-devops/prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

---

trigger:
batch: true
branches:
include:
- main

pr: none

variables:
- name: tags
value: production, multi-phased

stages:
- stage: Checks
displayName: Checks
jobs:
- job: Checks
pool: server
variables:
- name: skipComponentGovernanceDetection
value: true
steps:
- checkout: none
displayName: Checkout

- script: exit 1
displayName: Terminate on PR
condition: ne(variables['Build.SourceBranchName'], 'main')

- template: template.yml
132 changes: 132 additions & 0 deletions .github/azure-devops/template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

---

stages:
- stage: Build
displayName: Build
jobs:
- job: Delay
displayName: Delay
pool: server
steps:
- task: Delay@1
displayName: Wait for Deployment
inputs:
delayForMinutes: '5'

- job: PRMetrics_macOS
displayName: PR Metrics – macOS
dependsOn: Delay
pool:
vmImage: macOS-latest
variables:
- name: skipComponentGovernanceDetection
value: true
- name: System.Debug
value: true
steps:
- checkout: self
displayName: Checkout
fetchDepth: 0

- task: PRMetrics@1
displayName: PR Metrics
env:
# Azure DevOps Personal Access Token (PAT) with the Agent Pools (Read & Manage) permission.
PR_METRICS_ACCESS_TOKEN: $(GITHUB_PAT)

- job: PRMetrics_Ubuntu
displayName: PR Metrics – Ubuntu
dependsOn: PRMetrics_macOS
pool:
vmImage: ubuntu-latest
variables:
- name: skipComponentGovernanceDetection
value: true
- name: System.Debug
value: true
steps:
- checkout: self
displayName: Checkout
fetchDepth: 0

- task: PRMetrics@1
displayName: PR Metrics
env:
# Azure DevOps Personal Access Token (PAT) with the Agent Pools (Read & Manage) permission.
PR_METRICS_ACCESS_TOKEN: $(GITHUB_PAT)

- job: PRMetrics_Windows
displayName: PR Metrics – Windows
dependsOn: PRMetrics_Ubuntu
pool:
vmImage: windows-latest
variables:
- name: skipComponentGovernanceDetection
value: true
- name: System.Debug
value: true
steps:
- checkout: self
displayName: Checkout
fetchDepth: 0

- task: PRMetrics@1
displayName: PR Metrics
env:
# Azure DevOps Personal Access Token (PAT) with the Agent Pools (Read & Manage) permission.
PR_METRICS_ACCESS_TOKEN: $(GITHUB_PAT)

- job: Compliance
displayName: Compliance
pool:
vmImage: windows-latest
steps:
- task: ComponentGovernanceComponentDetection@0
displayName: Component Detection
inputs:
failOnAlert: true

- task: AntiMalware@4
displayName: Anti-Malware Scanner
inputs:
ScanType: FullSystemScan
EnableServices: true
ForceSignatureUpdate: true
SignatureUpdateUsesMMPC: true
TreatSignatureUpdateFailureAs: Error

- task: CredScan@3
displayName: Credential Scanner

- task: ESLint@1
displayName: ESLint
inputs:
Configuration: recommended

- task: PoliCheck@2
displayName: PoliCheck
inputs:
targetType: F
optionsFC: 1
optionsUEPATH: $(Build.SourcesDirectory)/.github/azure-devops/PoliCheckExclusions.xml

- task: Semmle@1
displayName: CodeQL
inputs:
sourceCodeDirectory: $(Build.SourcesDirectory)/src
language: tsandjs

- task: PublishSecurityAnalysisLogs@3
displayName: Guardian – Publish Artifacts

- task: PostAnalysis@2
displayName: Guardian – Perform Analysis
inputs:
GdnBreakPolicyMinSev: Note
GdnBreakGdnToolGosecSeverity: Default
GdnBreakPolicy: M365

...

0 comments on commit b706eed

Please sign in to comment.