-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathazure-pipelines.yml
69 lines (64 loc) · 1.64 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
67
68
69
# The pipeline builds the docker image, tags it as 'latest' and pushes it to the Docker Hub
variables:
- group: AzureKeyVault
- name: repository
value: griffinplus/strongswan
- name: image_tag
value: latest
- name: registry_user
value: $(dockerhub-user)
- name: registry_password
value: $(dockerhub-password)
# trigger when branch 'master' changes
# (the pipeline is triggered as well when the base image pipeline completes)
trigger:
branches:
include:
- master
paths:
exclude:
- client-route-manager/*
- README.md
- README-DockerHub.md
# do not trigger on pull requests to avoid that tag 'latest' is pushed for pull requests
pr: none
pool:
vmImage: ubuntu-latest
steps:
- task: Docker@2
displayName: Login
inputs:
command: login
containerregistry: Docker Hub
- task: Docker@2
displayName: Build
inputs:
command: build
Dockerfile: ./Dockerfile
repository: $(repository)
tags: $(image_tag)
- script: |
sudo apt-get update
sudo apt-get install python3-venv
tests/run-tests.sh
displayName: Test
- task: Docker@2
displayName: Push
inputs:
command: push
repository: $(repository)
tags: $(image_tag)
- script: |
docker run \
-v $PWD:/workspace \
-e DOCKERHUB_USERNAME='$(registry_user)' \
-e DOCKERHUB_PASSWORD='$(registry_password)' \
-e DOCKERHUB_REPOSITORY='$(repository)' \
-e README_FILEPATH='/workspace/README-DockerHub.md' \
griffinplus/dockerhub-description:latest
displayName: Update Image Description
- task: Docker@2
displayName: Logout
inputs:
command: logout
containerRegistry: Docker Hub