forked from Templum/rabbitmq-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
66 lines (52 loc) · 1.74 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Docker
# Build a Docker image
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
- develop
resources:
- repo: self
stages:
- stage: Build
displayName: Build image
jobs:
- job: Build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- script: |
VERSION_TAG=$(git describe --abbrev=0 --tags 2>/dev/null || echo "latest")
echo "##vso[task.setvariable variable=VERSION_TAG]$VERSION_TAG"
echo "Tag: $VERSION_TAG"
displayName: Get git tag
- task: Docker@2
displayName: Login to docker registry
inputs:
containerRegistry: 'azurecr-oaf'
command: 'login'
- task: Docker@2
displayName: Build an image
inputs:
command: build
dockerfile: '$(Build.SourcesDirectory)/Dockerfile'
tags: oaftech.azurecr.io/oneacrefund/rabbitmq-connector:$(VERSION_TAG)
- script: docker images
displayName: List all local images
- script: echo $(VERSION_TAG)
displayName: Echo Version Tag
- script: |
IMAGE_ID=$(docker images -q | head -n 1)
docker tag $IMAGE_ID oaftech.azurecr.io/oneacrefund/rabbitmq-connector:$(VERSION_TAG)
displayName: Tag latest image
- script: |
docker images
docker push oaftech.azurecr.io/oneacrefund/rabbitmq-connector:$(VERSION_TAG)
displayName: manual push image to registry
- task: PublishBuildArtifacts@1
displayName: Publish configuration package
# Only publish main branch
# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)
ArtifactName: rabbitmq
publishLocation: Container