This repository has been archived by the owner on Jan 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathazure-pipelines.yml
80 lines (78 loc) · 2.89 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
70
71
72
73
74
75
76
77
78
79
80
#
# SPDX-License-Identifier: Apache-2.0
#
---
trigger:
branches:
include:
- "*"
tags:
include:
- "*"
pool:
vmImage: "ubuntu-latest"
steps:
- script: sudo apt-get update && sudo apt-get install -y moreutils
displayName: Install Ubuntu dependencies
- task: UsePythonVersion@0
inputs:
versionSpec: "3.x"
displayName: Use Python 3.x
- script: pip install ansible ansible-lint docker yamllint
displayName: Install Python dependencies
- script: |
set -ex
wget -qO fabric-bins.tar.gz https://github.com/hyperledger/fabric/releases/download/v1.4.6/hyperledger-fabric-linux-amd64-1.4.6.tar.gz
sudo tar xvf fabric-bins.tar.gz -C /usr/local
rm fabric-bins.tar.gz
displayName: Download Fabric CLI
- script: |
set -ex
wget -qO fabric-ca-bins.tar.gz https://github.com/hyperledger/fabric-ca/releases/download/v1.4.6/hyperledger-fabric-ca-linux-amd64-1.4.6.tar.gz
sudo tar xvf fabric-ca-bins.tar.gz -C /usr/local
rm fabric-ca-bins.tar.gz
displayName: Download Fabric CA CLI
- script: |
set -ex
ansible-lint . -x 208
yamllint .
displayName: Lint
- script: |
set -ex
docker pull ibmblockchain/vscode-prereqs:latest || true
displayName: Pull Docker image
- script: docker/build.sh
displayName: Build Docker image
- script: |
set -ex
mkdir -p ~/.ansible/roles
ln -s $(Build.Repository.LocalPath) ~/.ansible/roles/ibm.blockchain_platform_manager
displayName: Link Playbook dependencies
- script: |
set -ex
ansible-playbook tests/test.yml
ansible-playbook --extra-vars "state=absent" tests/test.yml
displayName: Run Playbook tests
- script: |
set -ex
ansible-galaxy login --github-token=$(GitHub Token)
ansible-galaxy import IBM-Blockchain ansible-role-blockchain-platform-manager
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: Publish to Ansible Galaxy
- script: |
set -ex
docker login -u $(Docker Username) -p $(Docker Password)
docker tag ibmblockchain/ansible:latest ibmblockchain/vscode-prereqs:unstable
docker push ibmblockchain/vscode-prereqs:unstable
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: Push Docker image to Docker Hub (merge build)
- script: |
set -ex
docker login -u $(Docker Username) -p $(Docker Password)
VERSION=$(git describe --exact-match --tags $(Build.SourceVersion))
docker tag ibmblockchain/ansible:latest ibmblockchain/vscode-prereqs:${VERSION}
docker tag ibmblockchain/vscode-prereqs:${VERSION} ibmblockchain/vscode-prereqs:latest
docker push ibmblockchain/vscode-prereqs:${VERSION}
docker push ibmblockchain/vscode-prereqs:latest
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
displayName: Push Docker image to Docker Hub (release build)