Skip to content

Commit

Permalink
[FAB-17114] Add AZP support for Fabric
Browse files Browse the repository at this point in the history
This change adds PR, Merge and Release
pipeline definition files for Hyperledger
Fabric.

Signed-off-by: Brett Logan <Brett.T.Logan@ibm.com>
Change-Id: I9401bfc3f636e852fb10c48b4a69548f12e36cc5
Signed-off-by: Brett Logan <Brett.T.Logan@ibm.com>
  • Loading branch information
Brett Logan committed Nov 20, 2019
1 parent 9998978 commit 2c3282e
Show file tree
Hide file tree
Showing 7 changed files with 238 additions and 0 deletions.
27 changes: 27 additions & 0 deletions ci/azure-pipelines-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright the Hyperledger Fabric contributors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

name: $(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rrr)
trigger:
- release-1.*
pr: none

variables:
GOPATH: $(Agent.BuildDirectory)/go
PATH: $(Agent.BuildDirectory)/go/bin:/usr/local/go/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
GOVER: 1.12.12

jobs:
- job: UnitTests
pool:
vmImage: ubuntu-16.04
steps:
- template: install_deps.yml
- checkout: self
path: 'go/src/github.com/hyperledger/fabric'
displayName: Checkout Fabric Code
- script: ./ci/scripts/setup_hsm.sh
displayName: Install SoftHSM
- script: make unit-test
displayName: Run Unit Tests
89 changes: 89 additions & 0 deletions ci/azure-pipelines-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Copyright the Hyperledger Fabric cont ributors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

name: RELEASE-$(Date:yyyyMMdd)$(Rev:.rrr)
trigger: none
pr: none

variables:
- group: credentials
- name: GOPATH
value: $(Agent.BuildDirectory)/go
- name: GOVER
value: 1.12.12

stages:
- stage: BuildBinaries
dependsOn: []
displayName: "Build Fabric Binaries"
jobs:
- job: Build
pool:
vmImage: ubuntu-16.04
strategy:
matrix:
Linux-amd64:
TARGET: linux-amd64
MacOS-amd64:
TARGET: darwin-amd64
Windows-amd64:
TARGET: windows-amd64
steps:
- template: install_deps.yml
- checkout: self
path: 'go/src/github.com/hyperledger/fabric'
displayName: Checkout Fabric Code
- script: ./ci/scripts/create_binary_package.sh
displayName: Compile Binary and Create Tarball
- publish: release/$(TARGET)/hyperledger-fabric-$(TARGET)-$(RELEASE).tar.gz
artifact: hyperledger-fabric-$(TARGET)-$(RELEASE).tar.gz
displayName: Publish Release Artifact

- stage: BuildAndPushDockerImages
dependsOn: []
displayName: "Build and Push Fabric Docker Images"
jobs:
- job: Docker
pool:
vmImage: ubuntu-16.04
steps:
- template: install_deps.yml
- checkout: self
path: 'go/src/github.com/hyperledger/fabric'
displayName: Checkout Fabric Code
- script: ./ci/scripts/publish_docker.sh
env:
DOCKER_PASSWORD: $(DockerHub-Password)
DOCKER_USERNAME: $(DockerHub-Username)
displayName: Publish Docker Images

- stage: DraftRelease
displayName: "Draft GitHub Release"
dependsOn:
- BuildBinaries
- BuildAndPushDockerImages
jobs:
- job: Release
pool:
vmImage: ubuntu-16.04
steps:
- download: current
patterns: '*.tar.gz'
displayName: Download Artifacts
- checkout: self
- task: GitHubRelease@0
inputs:
action: create
addChangeLog: true
assets: $(Pipeline.Workspace)/*amd64*/*
compareWith: lastFullRelease
gitHubConnection: fabric-release
isDraft: true
releaseNotesFile: release_notes/v$(RELEASE).md
repositoryName: $(Build.Repository.Name)
releaseNotesSource: file
tag: v$(RELEASE)
tagSource: manual
title: v$(RELEASE)
displayName: Draft Release of Fabric
64 changes: 64 additions & 0 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright the Hyperledger Fabric contributors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

name: $(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rrr)
trigger: none
pr:
- release-1.4

variables:
GOPATH: $(Agent.BuildDirectory)/go
PATH: $(Agent.BuildDirectory)/go/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
GOVER: 1.12.12

jobs:
- job: VerifyBuild
pool:
vmImage: ubuntu-16.04
steps:
- template: install_deps.yml
- checkout: self
path: 'go/src/github.com/hyperledger/fabric'
displayName: Checkout Fabric Code
- script: make basic-checks native
displayName: Verify Build

- job: DocBuild
pool:
vmImage: ubuntu-16.04
container:
image: n42org/tox:3.4.0
steps:
- checkout: self
path: 'go/src/github.com/hyperledger/fabric'
displayName: Checkout Fabric Code
- script: tox -edocs
displayName: Build Documentation
- publish: 'docs/_build/html'
displayName: Publish Documentation Artifacts

- job: UnitTests
pool:
vmImage: ubuntu-16.04
steps:
- template: install_deps.yml
- checkout: self
path: 'go/src/github.com/hyperledger/fabric'
displayName: Checkout Fabric Code
- script: ./ci/scripts/setup_hsm.sh
displayName: Install SoftHSM
- script: make unit-test
displayName: Run Unit Tests

- job: IntegrationTests
pool:
vmImage: ubuntu-16.04
timeoutInMinutes: 120
steps:
- template: install_deps.yml
- checkout: self
path: 'go/src/github.com/hyperledger/fabric'
displayName: Checkout Fabric Code
- script: make integration-test
displayName: Run Integration Tests
15 changes: 15 additions & 0 deletions ci/install_deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright the Hyperledger Fabric contributors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

steps:
- script: |
sudo apt-get clean
sudo apt-get update
sudo apt-get install -y libtool gcc make haveged
displayName: Install Dependencies
- task: GoTool@0
inputs:
version: $(GOVER)
goPath: $(GOPATH)
displayName: Install GoLang
11 changes: 11 additions & 0 deletions ci/scripts/create_binary_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail

make "release/${TARGET}"
mkdir "release/${TARGET}/config"
mv sampleconfig/*yaml "release/${TARGET}/config"
cd "release/${TARGET}"
tar -czvf "hyperledger-fabric-${TARGET}-${RELEASE}.tar.gz" bin config
20 changes: 20 additions & 0 deletions ci/scripts/publish_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail

make docker

wget -qO "$PWD/manifest-tool" https://github.com/estesp/manifest-tool/releases/download/v1.0.0/manifest-tool-linux-amd64
chmod +x ./manifest-tool

for image in peer orderer ccenv tools; do
docker login --username "${DOCKER_USERNAME}" --password "${DOCKER_PASSWORD}"
docker tag "hyperledger/fabric-${image}" "hyperledger/fabric-${image}:amd64-${RELEASE}"
docker push "hyperledger/fabric-${image}:amd64-${RELEASE}"

./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-${image}:amd64-${RELEASE}" --target "hyperledger/fabric-${image}:${RELEASE}"
./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-${image}:amd64-${RELEASE}" --target "hyperledger/fabric-${image}:$(sed 's/..$//' <<< ${RELEASE})"
./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-${image}:amd64-${RELEASE}" --target "hyperledger/fabric-${image}:latest"
done
12 changes: 12 additions & 0 deletions ci/scripts/setup_hsm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# Copyright the Hyperledger Fabric contributors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail

sudo apt-get install -y softhsm2
sudo mkdir -p /var/lib/softhsm/tokens
sudo softhsm2-util --init-token --slot 0 --label "ForFabric" --so-pin 1234 --pin 98765432
sudo chmod -R 777 /var/lib/softhsm
mkdir -p ~/.config/softhsm2
cp /usr/share/softhsm/softhsm2.conf ~/.config/softhsm2

0 comments on commit 2c3282e

Please sign in to comment.