Last active
October 14, 2022 09:43
-
-
Save trunneml/b6031c510e501615cbdd9f0c230e7cee to your computer and use it in GitHub Desktop.
Improve your CI-CD-Workflow with Git-Notes - Example Azure Pipeline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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