Skip to content

Instantly share code, notes, and snippets.

@trunneml
Last active October 14, 2022 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trunneml/b6031c510e501615cbdd9f0c230e7cee to your computer and use it in GitHub Desktop.
Save trunneml/b6031c510e501615cbdd9f0c230e7cee to your computer and use it in GitHub Desktop.
Improve your CI-CD-Workflow with Git-Notes - Example Azure Pipeline
trigger:
- main
stages:
- stage: build
displayName: NPM based build
jobs:
- job: npm_build_job
displayName: NPM Build Job
steps:
- checkout: self
persistCredentials: true
- bash: bundle update
displayName: Install Dependencies
- task: npmAuthenticate@0
inputs:
workingFile: .npmrc
- task: Bash@3
displayName: 'run tests'
inputs:
targetType: 'inline'
script: 'yarn test'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml'
- bash: npx npm-license-crawler --onlyDirectDependencies --relativeLicensePath --json licenses.json
displayName: Assemble licenses of dependencies for production
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(System.DefaultWorkingDirectory)/licenses.json'
ArtifactName: 'Dependency Licenses'
publishLocation: 'Container'
- task: Bash@3
displayName: 'generateSbom'
inputs:
targetType: 'inline'
script: 'yarn run cyclonedx'
- task: Bash@3
displayName: 'git notes'
condition: eq(variables.isMain, 'true')
inputs:
targetType: 'inline'
script: |
git config --global user.email "azure@example.com"
git config --global user.name "CI-Pipeline"
git notes --ref sbom add -F bom.json
git notes --ref junit add -F junit.xml
git notes --ref licenses add -F licenses.json
git notes --ref coverage add -F ./coverage/cobertura-coverage.xml
git notes append -m "CI-Build succeded"
git push origin "refs/notes/*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment