Skip to content

Commit

Permalink
Merge "[FAB-17114] Add AZP support for Fabric"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Yellick authored and Gerrit Code Review committed Nov 20, 2019
2 parents 2d9bacd + 0830665 commit 454a9fa
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 0 deletions.
28 changes: 28 additions & 0 deletions ci/azure-pipelines-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright the Hyperledger Fabric contributors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

name: $(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rrr)
trigger:
- master
- release-2.*
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.13.4

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.13.4

stages:
- stage: BuildBinaries
dependsOn: []
displayName: "Build Fabric Binaries"
jobs:
- job: Build
pool:
vmImage: ubuntu-16.04
container: golang:$(GOVER)
strategy:
matrix:
Linux-amd64:
TARGET: linux-amd64
MacOS-amd64:
TARGET: darwin-amd64
Windows-amd64:
TARGET: windows-amd64
steps:
- 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
65 changes: 65 additions & 0 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright the Hyperledger Fabric contributors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

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

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

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
19 changes: 19 additions & 0 deletions ci/scripts/publish_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/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 baseos 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})"
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 454a9fa

Please sign in to comment.