Skip to content

Instantly share code, notes, and snippets.

View CyprienLecallier's full-sized avatar

CyprienLecallier

View GitHub Profile
trigger:
- master
pr:
branches:
include:
- master
stages:
- stage: CI
displayName: CI
- stage: Deploy_to_Prod
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
dependsOn: CI
jobs:
- deployment: Deployment
displayName: Deploy container in Prod
pool:
vmImage: ubuntu-latest
environment:
name: prod
steps:
- task: Docker@2
displayName: Push
inputs:
command: push
containerRegistry: "ACR01"
repository: "image_name"
tags: |
$(Build.SourceVersion)
latest
steps:
- script: |
sudo apt-get install rpm
wget https://github.com/aquasecurity/trivy/releases/download/v$(trivyVersion)/trivy_$(trivyVersion)_Linux-64bit.deb
sudo dpkg -i trivy_$(trivyVersion)_Linux-64bit.deb
trivy -v
displayName: 'Download and install Trivy'
- task: CmdLine@2
displayName: "Run trivy scan"
inputs:
steps:
- task: Docker@2
displayName: Build
inputs:
command: build
containerRegistry: "ACR01"
repository: "image_name"
dockerfile: /path/to/Dockerfile
tags: |
$(Build.SourceVersion) # commit sha
steps:
- task: NodeTool@0
inputs:
versionSpec: 12.x
displayName: Cache Yarn packages
- script: yarn install --prefer-offline --pure-lockfile --no-progress
displayName: Yarn Install
- script: yarn test:ci -w 2
displayName: 'Run tests'
- script: yarn security:check
stages:
- stage: CI
displayName: CI
jobs:
- job: Tests
displayName: Tests
pool:
vmImage: ubuntu-latest
steps:
- template: tests.yaml
trigger:
- master
pr:
branches:
include:
- master