Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
build(azure): adds stages on azure pipeline yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
matteovivona committed Feb 15, 2020
1 parent 12ca8de commit eaf28e4
Showing 1 changed file with 77 additions and 74 deletions.
151 changes: 77 additions & 74 deletions azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,78 +5,81 @@ trigger:

pr: none

jobs:
- job: npm_job
continueOnError: false
pool:
vmImage: ubuntu-latest
strategy:
matrix:
node_12_x:
node_version: 12.x
maxParallel: 5
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- bash: npm install
displayName: 'Install dependencies'
- bash: npm run lint
displayName: 'Lint code'
- bash: npm run build
displayName: 'Build code'
- bash: npm run test:ci
displayName: 'Test compiled code'
stages:
- stage: Build, lint and test code
jobs:
- job: npm_job
continueOnError: false
pool:
vmImage: ubuntu-latest
strategy:
matrix:
node_12_x:
node_version: 12.x
maxParallel: 5
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- bash: npm install
displayName: 'Install dependencies'
- bash: npm run lint
displayName: 'Lint code'
- bash: npm run build
displayName: 'Build code'
- bash: npm run test:ci
displayName: 'Test compiled code'
- job: yarn_job
continueOnError: false
pool:
vmImage: ubuntu-latest
strategy:
matrix:
node_12_x:
node_version: 12.x
maxParallel: 5
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- bash: yarn install
displayName: 'Install dependencies'
- bash: yarn lint
displayName: 'Lint code'
- bash: yarn build
displayName: 'Build code'
- bash: yarn test:ci
displayName: 'Test compiled code'

- job: yarn_job
continueOnError: false
pool:
vmImage: ubuntu-latest
strategy:
matrix:
node_12_x:
node_version: 12.x
maxParallel: 5
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- bash: yarn install
displayName: 'Install dependencies'
- bash: yarn lint
displayName: 'Lint code'
- bash: yarn build
displayName: 'Build code'
- bash: yarn test:ci
displayName: 'Test compiled code'

- job: docker_job
dependsOn: [npm_job, yarn_job]
continueOnError: false
pool:
vmImage: ubuntu-latest
steps:
- script: |
echo '{ "experimental": true }' | sudo tee /etc/docker/daemon.json
sudo service docker restart
displayName: 'Enable Docker Engine experimental '
- script: |
GIT_TAG=`git describe --tags` && VERSION_TAG="$(cut -d'-' -f1 <<<"$GIT_TAG")" && echo "##vso[task.setvariable variable=VERSION_TAG]$VERSION_TAG"
displayName: 'Get Git Tag'
- task: Docker@0
displayName: 'Build an image'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryConnection: Docker # it is necessary to create a new "service connection" via Azure DevOps portal
dockerFile: ./Dockerfile
buildArguments: '--rm --squash'
imageName: '$(Build.Repository.Name):$(VERSION_TAG)'
- task: Docker@0
displayName: 'Push an image'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryConnection: Docker # it is necessary to create a new "service connection" via Azure DevOps portal
action: 'Push an image'
imageName: '$(Build.Repository.Name):$(VERSION_TAG)'
- stage: Docker image build and push
jobs:
- job: docker_job
dependsOn: [npm_job, yarn_job]
continueOnError: false
pool:
vmImage: ubuntu-latest
steps:
- script: |
echo '{ "experimental": true }' | sudo tee /etc/docker/daemon.json
sudo service docker restart
displayName: 'Enable Docker Engine experimental '
- script: |
GIT_TAG=`git describe --tags` && VERSION_TAG="$(cut -d'-' -f1 <<<"$GIT_TAG")" && echo "##vso[task.setvariable variable=VERSION_TAG]$VERSION_TAG"
displayName: 'Get Git Tag'
- task: Docker@0
displayName: 'Build an image'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryConnection: Docker # it is necessary to create a new "service connection" via Azure DevOps portal
dockerFile: ./Dockerfile
buildArguments: '--rm --squash'
imageName: '$(Build.Repository.Name):$(VERSION_TAG)'
- task: Docker@0
displayName: 'Push an image'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryConnection: Docker # it is necessary to create a new "service connection" via Azure DevOps portal
action: 'Push an image'
imageName: '$(Build.Repository.Name):$(VERSION_TAG)'

1 comment on commit eaf28e4

@vercel
Copy link

@vercel vercel bot commented on eaf28e4 Feb 15, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.