mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 07:25:10 +00:00
[FABCI-482] Update Nexus URL's to Artifactory (#93)
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
This commit is contained in:
parent
562791dd2b
commit
2c1d2ad5b9
14 changed files with 27 additions and 592 deletions
178
Jenkinsfile
vendored
178
Jenkinsfile
vendored
|
|
@ -1,178 +0,0 @@
|
|||
#!groovy
|
||||
// Copyright IBM Corp All Rights Reserved
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
// Jenkinfile will get triggered on verify and merge jobs and run byfn, eyfn and fabcar
|
||||
// tests.
|
||||
|
||||
// global shared library from ci-management repository
|
||||
// https://github.com/hyperledger/ci-management/tree/master/vars (Global Shared scripts)
|
||||
@Library("fabric-ci-lib") _
|
||||
pipeline {
|
||||
agent {
|
||||
// Execute tests on x86_64 build nodes
|
||||
// Set this value from Jenkins Job Configuration
|
||||
label env.NODE_ARCH
|
||||
}
|
||||
options {
|
||||
// Using the Timestamper plugin we can add timestamps to the console log
|
||||
timestamps()
|
||||
// Set build timeout for 60 mins
|
||||
timeout(time: 60, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
ROOTDIR = pwd()
|
||||
// Applicable only on x86_64 nodes
|
||||
// LF team has to install the newer version in Jenkins global config
|
||||
// Send an email to helpdesk@hyperledger.org to add newer version
|
||||
nodeHome = tool 'nodejs-8.11.3'
|
||||
MARCH = sh(returnStdout: true, script: "uname -m | sed 's/x86_64/amd64/g'").trim()
|
||||
OS_NAME = sh(returnStdout: true, script: "uname -s|tr '[:upper:]' '[:lower:]'").trim()
|
||||
props = "null"
|
||||
}
|
||||
stages {
|
||||
stage('Clean Environment') {
|
||||
steps {
|
||||
script {
|
||||
// delete working directory
|
||||
deleteDir()
|
||||
// Clean build env before start the build
|
||||
fabBuildLibrary.cleanupEnv()
|
||||
// Display jenkins environment details
|
||||
fabBuildLibrary.envOutput()
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout SCM') {
|
||||
steps {
|
||||
script {
|
||||
// Get changes from gerrit
|
||||
fabBuildLibrary.cloneRefSpec('fabric-samples')
|
||||
// Load properties from ci.properties file
|
||||
props = fabBuildLibrary.loadProperties()
|
||||
}
|
||||
}
|
||||
}
|
||||
// Pull build artifacts
|
||||
stage('Pull Build Artifacts') {
|
||||
steps {
|
||||
script {
|
||||
if(props["IMAGE_SOURCE"] == "build") {
|
||||
println "BUILD ARTIFACTS"
|
||||
// Set PATH
|
||||
env.GOPATH = "$WORKSPACE/gopath"
|
||||
env.GOROOT = "/opt/go/go" + props["GO_VER"] + ".linux." + "$MARCH"
|
||||
env.PATH = "$GOPATH/bin:$GOROOT/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:${nodeHome}/bin:$PATH"
|
||||
// Clone fabric repo
|
||||
fabBuildLibrary.cloneScm('fabric', '$GERRIT_BRANCH')
|
||||
// Build fabric docker images and binaries
|
||||
fabBuildLibrary.fabBuildImages('fabric', 'docker dist')
|
||||
// Clone fabric-ca repo
|
||||
fabBuildLibrary.cloneScm('fabric-ca', '$GERRIT_BRANCH')
|
||||
// Build fabric docker images and binaries
|
||||
fabBuildLibrary.fabBuildImages('fabric-ca', 'docker dist')
|
||||
// Copy binaries to fabric-samples dir
|
||||
sh 'cp -r $ROOTDIR/gopath/src/github.com/hyperledger/fabric/release/$OS_NAME-$MARCH/bin $ROOTDIR/$BASE_DIR/'
|
||||
// Pull Thirdparty Docker Images from hyperledger DockerHub
|
||||
fabBuildLibrary.pullThirdPartyImages(props["FAB_BASEIMAGE_VERSION"], props["FAB_THIRDPARTY_IMAGES_LIST"])
|
||||
} else {
|
||||
dir("$ROOTDIR/$BASE_DIR") {
|
||||
// Set PATH
|
||||
env.GOPATH = "$WORKSPACE/gopath"
|
||||
env.GOROOT = "/opt/go/go" + props["GO_VER"] + ".linux." + "$MARCH"
|
||||
env.PATH = "$GOPATH/bin:$GOROOT/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:${nodeHome}/bin:$PATH"
|
||||
// Pull Binaries with latest version from nexus2
|
||||
fabBuildLibrary.pullBinaries(props["FAB_BINARY_VER"], props["FAB_BINARY_REPO"])
|
||||
// Pull Docker Images from nexus3
|
||||
fabBuildLibrary.pullDockerImages(props["FAB_BASE_VERSION"], props["FAB_IMAGES_LIST"])
|
||||
// Pull Thirdparty Docker Images from hyperledger DockerHub
|
||||
fabBuildLibrary.pullThirdPartyImages(props["FAB_BASEIMAGE_VERSION"], props["FAB_THIRDPARTY_IMAGES_LIST"])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Run byfn, eyfn tests (default, custom channel, couchdb, nodejs, java chaincode)
|
||||
stage('Run byfn_eyfn Tests') {
|
||||
steps {
|
||||
script {
|
||||
// making the output color coded
|
||||
// wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) {
|
||||
try {
|
||||
dir("$ROOTDIR/$BASE_DIR/scripts/ci_scripts") {
|
||||
// Run BYFN, EYFN tests
|
||||
sh './ciScript.sh --byfn_eyfn_Tests'
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
failure_stage = "byfn_eyfn_Tests"
|
||||
currentBuild.result = 'FAILURE'
|
||||
throw err
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
// Run fabcar tests
|
||||
stage('Run Fab Car Tests') {
|
||||
steps {
|
||||
script {
|
||||
// making the output color coded
|
||||
// wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) {
|
||||
try {
|
||||
dir("$ROOTDIR/$BASE_DIR/scripts/ci_scripts") {
|
||||
// Run fabcar tests
|
||||
sh './ciScript.sh --fabcar_Tests'
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
failure_stage = "fabcar_Tests"
|
||||
currentBuild.result = 'FAILURE'
|
||||
throw err
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
// Run Commercial Paper tests
|
||||
stage('Run Commercial Paper Tests') {
|
||||
steps {
|
||||
script {
|
||||
// making the output color coded
|
||||
// wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) {
|
||||
try {
|
||||
dir("$ROOTDIR/$BASE_DIR/scripts/ci_scripts") {
|
||||
// Run fabcar tests
|
||||
sh './ciScript.sh --commercialpaper_Tests'
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
failure_stage = "commercialpaper_Tests"
|
||||
currentBuild.result = 'FAILURE'
|
||||
throw err
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
} // stages
|
||||
post {
|
||||
always {
|
||||
// Archiving the .log files and ignore if empty
|
||||
archiveArtifacts artifacts: '**/*.log', allowEmptyArchive: true
|
||||
}
|
||||
failure {
|
||||
script {
|
||||
if (env.JOB_TYPE == 'merge') {
|
||||
// Send rocketChat notification to channel
|
||||
// Send merge build failure email notifications to the submitter
|
||||
sendNotifications(currentBuild.result, props["CHANNEL_NAME"])
|
||||
// Delete workspace when build is done
|
||||
cleanWs notFailBuild: true
|
||||
}
|
||||
}
|
||||
}
|
||||
} // post
|
||||
} // pipeline
|
||||
|
|
@ -13,7 +13,7 @@ group 'org.hyperledger.fabric.samples'
|
|||
version '1.0-SNAPSHOT'
|
||||
|
||||
dependencies {
|
||||
implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:1.4.3'
|
||||
implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:1.4+'
|
||||
implementation 'com.owlike:genson:1.5'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2'
|
||||
testImplementation 'org.assertj:assertj-core:3.11.1'
|
||||
|
|
@ -22,7 +22,7 @@ dependencies {
|
|||
|
||||
repositories {
|
||||
maven {
|
||||
url "https://nexus.hyperledger.org/content/repositories/snapshots/"
|
||||
url "https://hyperledger.jfrog.io/hyperledger/fabric-maven"
|
||||
}
|
||||
jcenter()
|
||||
maven {
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
# Set "nexus" if you would like to pull images from nexus3
|
||||
# Set "build" if you would like build fabric, fabric-ca on latest commits
|
||||
IMAGE_SORUCE=nexus
|
||||
# set only "javaenv" image if you set IMAGE_SOURCE to "build"
|
||||
# Pull below list of images from nexus3 if IMAGE_SOURCE is set to "nexus" or "build"
|
||||
FAB_IMAGES_LIST=ca peer orderer ccenv tools javaenv
|
||||
# Set fabric if you would like pull only fabric binaries
|
||||
FAB_BINARY_REPO=fabric fabric-ca
|
||||
# Pull below list of images from Hyperledger DockerHub
|
||||
FAB_THIRDPARTY_IMAGES_LIST=kafka zookeeper couchdb
|
||||
# Pull latest binaries of latest commit of release-1.4 from nexus snapshots
|
||||
# Applicable only when set IMAGE_SOURCE to "nexus"
|
||||
FAB_BINARY_VER=1.4.4-stable
|
||||
# Set base version from fabric branch
|
||||
FAB_BASE_VERSION=1.4.4
|
||||
# Set base image version from fabric branch
|
||||
FAB_BASEIMAGE_VERSION=0.4.15
|
||||
# Set related rocketChat channel name. Default: jenkins-robot
|
||||
CHANNEL_NAME=jenkins-robot
|
||||
# Set compaitable go version
|
||||
GO_VER=1.11.5
|
||||
|
|
@ -4,31 +4,26 @@
|
|||
|
||||
steps:
|
||||
- script: |
|
||||
set -ex
|
||||
mvn dependency:get -DremoteRepositories=https://nexus.hyperledger.org/content/repositories/snapshots -Dartifact=org.hyperledger.fabric:hyperledger-fabric-1.4.5-stable:linux-amd64.1.4.5-stable-SNAPSHOT:tar.gz
|
||||
mvn dependency:copy -Dartifact=org.hyperledger.fabric:hyperledger-fabric-1.4.5-stable:linux-amd64.1.4.5-stable-SNAPSHOT:tar.gz -DoutputDirectory=/tmp
|
||||
cd /usr/local
|
||||
sudo tar xzvf /tmp/hyperledger-fabric-1.4.5-stable-linux-amd64.1.4.5-stable-SNAPSHOT.tar.gz
|
||||
set -eo pipefail
|
||||
wget -q -P /tmp https://hyperledger.jfrog.io/hyperledger/fabric-binaries/hyperledger-fabric-linux-amd64-1.4.5-stable.tar.gz
|
||||
sudo tar xzvf /tmp/hyperledger-fabric-linux-amd64-1.4.5-stable.tar.gz -C /usr/local
|
||||
displayName: Download Fabric CLI
|
||||
- script: |
|
||||
set -ex
|
||||
mvn dependency:get -DremoteRepositories=https://nexus.hyperledger.org/content/repositories/snapshots -Dartifact=org.hyperledger.fabric-ca:hyperledger-fabric-ca-1.4.5-stable:linux-amd64.1.4.5-stable-SNAPSHOT:tar.gz
|
||||
mvn dependency:copy -Dartifact=org.hyperledger.fabric-ca:hyperledger-fabric-ca-1.4.5-stable:linux-amd64.1.4.5-stable-SNAPSHOT:tar.gz -DoutputDirectory=/tmp
|
||||
cd /usr/local
|
||||
sudo tar xzvf /tmp/hyperledger-fabric-ca-1.4.5-stable-linux-amd64.1.4.5-stable-SNAPSHOT.tar.gz
|
||||
set -eo pipefail
|
||||
wget -q -P /tmp https://hyperledger.jfrog.io/hyperledger/fabric-binaries/hyperledger-fabric-ca-linux-amd64-1.4.5-stable.tar.gz
|
||||
sudo tar xzvf /tmp/hyperledger-fabric-ca-linux-amd64-1.4.5-stable.tar.gz -C /usr/local
|
||||
displayName: Download Fabric CA CLI
|
||||
- script: |
|
||||
set -ex
|
||||
version=1.4.5
|
||||
for i in ca ccenv javaenv peer orderer tools; do
|
||||
docker pull nexus3.hyperledger.org:10001/hyperledger/fabric-$i:amd64-1.4.5-stable
|
||||
docker tag nexus3.hyperledger.org:10001/hyperledger/fabric-$i:amd64-1.4.5-stable hyperledger/fabric-$i:amd64-1.4.5-stable
|
||||
docker tag nexus3.hyperledger.org:10001/hyperledger/fabric-$i:amd64-1.4.5-stable hyperledger/fabric-$i:amd64-1.4.5
|
||||
docker tag nexus3.hyperledger.org:10001/hyperledger/fabric-$i:amd64-1.4.5-stable hyperledger/fabric-$i:1.4.5
|
||||
docker tag nexus3.hyperledger.org:10001/hyperledger/fabric-$i:amd64-1.4.5-stable hyperledger/fabric-$i:latest
|
||||
done
|
||||
for i in couchdb; do
|
||||
docker pull nexus3.hyperledger.org:10001/hyperledger/fabric-$i:0.4.15
|
||||
docker tag nexus3.hyperledger.org:10001/hyperledger/fabric-$i:0.4.15 hyperledger/fabric-$i:0.4.15
|
||||
docker tag nexus3.hyperledger.org:10001/hyperledger/fabric-$i:0.4.15 hyperledger/fabric-$i:latest
|
||||
docker pull hyperledger-fabric.jfrog.io/fabric-$i:amd64-$version-stable
|
||||
docker tag hyperledger-fabric.jfrog.io/fabric-$i:amd64-$version-stable hyperledger/fabric-$i:amd64-$version-stable
|
||||
docker tag hyperledger-fabric.jfrog.io/fabric-$i:amd64-$version-stable hyperledger/fabric-$i:amd64-$version
|
||||
docker tag hyperledger-fabric.jfrog.io/fabric-$i:amd64-$version-stable hyperledger/fabric-$i:$version
|
||||
docker tag hyperledger-fabric.jfrog.io/fabric-$i:amd64-$version-stable hyperledger/fabric-$i:latest
|
||||
done
|
||||
|
||||
docker pull hyperledger/fabric-couchdb:0.4.15
|
||||
docker tag hyperledger/fabric-couchdb:0.4.15 hyperledger/fabric-couchdb:latest
|
||||
displayName: Pull Fabric Docker images
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@
|
|||
<repositories>
|
||||
<repository>
|
||||
<id>hyperledger</id>
|
||||
<name>Hyperledger Nexus</name>
|
||||
<url>https://nexus.hyperledger.org/content/repositories/snapshots</url>
|
||||
<name>Hyperledger Artifactory</name>
|
||||
<url>https://hyperledger.jfrog.io/hyperledger/fabric-maven</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@
|
|||
<repositories>
|
||||
<repository>
|
||||
<id>hyperledger</id>
|
||||
<name>Hyperledger Nexus</name>
|
||||
<url>https://nexus.hyperledger.org/content/repositories/snapshots</url>
|
||||
<name>Hyperledger Artifactory</name>
|
||||
<url>https://hyperledger.jfrog.io/hyperledger/fabric-maven</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ repositories {
|
|||
url 'https://jitpack.io'
|
||||
}
|
||||
maven {
|
||||
url "https://nexus.hyperledger.org/content/repositories/snapshots/"
|
||||
url "https://hyperledger.jfrog.io/hyperledger/fabric-maven"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@
|
|||
<repositories>
|
||||
<repository>
|
||||
<id>hyperledger</id>
|
||||
<name>Hyperledger Nexus</name>
|
||||
<url>https://nexus.hyperledger.org/content/repositories/snapshots</url>
|
||||
<name>Hyperledger Artifactory</name>
|
||||
<url>https://hyperledger.jfrog.io/hyperledger/fabric-maven</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@
|
|||
<repositories>
|
||||
<repository>
|
||||
<id>hyperledger</id>
|
||||
<name>Hyperledger Nexus</name>
|
||||
<url>https://nexus.hyperledger.org/content/repositories/snapshots</url>
|
||||
<name>Hyperledger Artifactory</name>
|
||||
<url>https://hyperledger.jfrog.io/hyperledger/fabric-maven</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ repositories {
|
|||
url 'https://jitpack.io'
|
||||
}
|
||||
maven {
|
||||
url "https://nexus.hyperledger.org/content/repositories/snapshots/"
|
||||
url "https://hyperledger.jfrog.io/hyperledger/fabric-maven"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,109 +0,0 @@
|
|||
# Continuous Integration Process
|
||||
|
||||
This document explains the fabric-samples Jenkins pipeline flow and FAQ's on the build
|
||||
process to help developer to get more familiarize with the process flow.
|
||||
|
||||
We use Jenkins as a CI tool and to manage jobs, we use [JJB](https://docs.openstack.org/infra/jenkins-job-builder).
|
||||
Please see the pipeline job configuration template here https://ci-docs.readthedocs.io/en/latest/source/pipeline_jobs.html#job-templates.
|
||||
|
||||
## CI Pipeline flow
|
||||
|
||||
- Every Gerrit patchset triggers a verify job with the Gerrit Refspec on the parent commit
|
||||
of the patchset and runs the below tests from the `Jenkinsfile`. Note: when you are ready
|
||||
to merge the patchset, it's always a best practice to rebase the patchset on the latest commit.
|
||||
|
||||
All the below tests runs on the Hyperledger infarstructure x86_64 build nodes. All these nodes
|
||||
uses the packer with pre-configured software packages. This helps us to run the tests in much
|
||||
faster than installing required packages everytime.
|
||||
|
||||
Below steps shows what each stage does in the Jenkins pipeline verify and merge flow.
|
||||
Before execute the below tests, it clean the environment (Deletes the left over build artifiacts)
|
||||
and clone the repository with the Gerrit Refspec.
|
||||
|
||||

|
||||
|
||||
Based on the value provided to **IMAGE_SOURCE** in ci.properties file, Jenkinsfile execute the
|
||||
steps. If the IMAGE_SOURCE is set to "build", Jenkins clones the latest commits of fabric
|
||||
and fabric-ca and builds the docker images and binaries. If you specify IMAGE_SOURCE as "nexus",
|
||||
it always pulls the latest fabric and fabric-ca images published from nightly job which triggers
|
||||
everyday at 8:00 PM EST.
|
||||
|
||||
Also, it pulls the "javaenv" and "nodeenv" images from the latest published images from nexus3.
|
||||
NOTE: nodeenv image is available only in master branch.
|
||||
|
||||
Once the artifacts stage is ready, Jenkins executes the below tests
|
||||
|
||||
- byfn & eyfn tests
|
||||
- on default channel
|
||||
- Custom channel with couchdb
|
||||
- on node chanincode
|
||||
|
||||
- fabcar tests
|
||||
- go
|
||||
- javascript
|
||||
- typescript
|
||||
|
||||
Above pipeline flow works the same on both `fabric-samples-verify-x86_64` and `fabric-samples-merge-x86_64` pipeline jobs.
|
||||
|
||||
See below **FAQ's** for more information on the pipeline process.
|
||||
|
||||
## FAQ's
|
||||
|
||||
#### How to re-trigger failed tests?
|
||||
|
||||
You can post comments `reverify` or `reverify-x` on the gerrit patchset to trigger the `fabric-samples-verify-x86_64`
|
||||
job which triggers the pipeline flow as mentioned above. Also, we provided `remerge` or `remerge-x`
|
||||
comment phrases to re-trigger the failed merge job.
|
||||
|
||||
#### Where should I see the output of the stages?
|
||||
|
||||
Piepline supports two views (stages and blueocean). **Staged views** shows on the Jenkins job
|
||||
main page and it shows each stage in order and the status. For better view, we suggest you
|
||||
to access BlueOcean plugin. Click on the build number and click on the **Open Blue Ocean**
|
||||
link that shows the build stages in pipeline view.
|
||||
|
||||
#### How to add more stages to this pipeline flow?
|
||||
|
||||
We use scripted pipeline syntax with groovy and shell scripts. Also, we use global shared
|
||||
library scripts which are placed in https://github.com/hyperledger/ci-management/tree/master/vars.
|
||||
Try to leverage these common functions in your code. All you have to do is, undestand the pipeline
|
||||
flow of the tests and conditions, add more stages as mentioned in the existing Jenkinsfile.
|
||||
|
||||
#### How will I get build failure notifications?
|
||||
|
||||
On every merge failure, we send build failure email notications to the submitter of the
|
||||
patchset and sends the build details to the Rocket Chat **jenkins-robot** channel. Check the
|
||||
result here https://chat.hyperledger.org/channel/jenkins-robot
|
||||
|
||||
#### What steps I have to modify when I create a new branch from master?
|
||||
|
||||
As the Jenkinsfile is completely parametrzed, you no need to modify anything in the
|
||||
Jenkinsfile but you may endup modifying **ci.properties** file with the appropirate
|
||||
Base Versions, Baseimage versions etc... in the new branch. We suggest you to modify this
|
||||
file immediately after you create a new branch to avoid running tests on older versions.
|
||||
|
||||
#### On what platforms these tests triggers?
|
||||
|
||||
- x86_64 (Run the above mentioned tests on verify and merge jobs)
|
||||
- s390x (Run the above mentioned tests in daily jobs)
|
||||
|
||||
#### Where can I see the Build Scripts.
|
||||
|
||||
We use global shared library scripts and Jenkinsfile along with the build file.
|
||||
|
||||
Global Shared Library - https://github.com/hyperledger/ci-management/tree/master/vars
|
||||
|
||||
Jenkinsfile - https://github.com/hyperledger/fabric-samples/tree/release-1.4/Jenkinsfile
|
||||
|
||||
ci.properties - https://github.com/hyperledger/fabric-samples/tree/release-1.4/ci.properties
|
||||
(ci.properties is the only file you have to modify with the values requried for the specific branch.)
|
||||
|
||||
Packer Scripts - https://github.com/hyperledger/ci-management/blob/master/packer/provision/docker.sh
|
||||
(Packer is a tool for automatically creating VM and container images, configuring them and
|
||||
post-processing them into standard output formats. We build Hyperledger's CI images via Packer
|
||||
and attach them to x86_64 build nodes. On s390x, we install manually. See the packages we
|
||||
install as a pre-requisite in the CI x86 build nodes.)
|
||||
|
||||
#### How to reach out to CI team?
|
||||
|
||||
Post your questions or feedback in https://chat.hyperledger.org/channel/ci-pipeline or https://chat.hyperledger.org/channel/fabric-ci Rocket Chat channels. Also, you can create JIRA tasks or bugs in FABCI project. https://jira.hyperledger.org/projects/FABCI
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB |
|
|
@ -1,155 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
#
|
||||
# Copyright IBM Corp All Rights Reserved
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# exit on first error
|
||||
|
||||
export BASE_FOLDER=$WORKSPACE/gopath/src/github.com/hyperledger
|
||||
export ORG_NAME="hyperledger/fabric"
|
||||
|
||||
Parse_Arguments() {
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--env_Info)
|
||||
env_Info
|
||||
;;
|
||||
--pull_Docker_Images)
|
||||
pull_Docker_Images
|
||||
;;
|
||||
--pull_Fabric_CA_Images)
|
||||
pull_Fabric_CA_Images
|
||||
;;
|
||||
--clean_Environment)
|
||||
clean_Environment
|
||||
;;
|
||||
--byfn_eyfn_Tests)
|
||||
byfn_eyfn_Tests
|
||||
;;
|
||||
--fabcar_Tests)
|
||||
fabcar_Tests
|
||||
;;
|
||||
--commercialpaper_Tests)
|
||||
commercialpaper_Tests
|
||||
;;
|
||||
--pull_Thirdparty_Images)
|
||||
pull_Thirdparty_Images
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
clean_Environment() {
|
||||
|
||||
echo "-----------> Clean Docker Containers & Images, unused/lefover build artifacts"
|
||||
function clearContainers () {
|
||||
CONTAINER_IDS=$(docker ps -aq)
|
||||
if [ -z "$CONTAINER_IDS" ] || [ "$CONTAINER_IDS" = " " ]; then
|
||||
echo "---- No containers available for deletion ----"
|
||||
else
|
||||
docker rm -f $CONTAINER_IDS || true
|
||||
docker ps -a
|
||||
fi
|
||||
}
|
||||
|
||||
function removeUnwantedImages() {
|
||||
for i in $(docker images | grep none | awk '{print $3}'); do
|
||||
docker rmi ${i} || true
|
||||
done
|
||||
|
||||
for i in $(docker images | grep -vE ".*baseimage.*(0.4.13|0.4.14)" | grep -vE ".*baseos.*(0.4.13|0.4.14)" | grep -vE ".*couchdb.*(0.4.13|0.4.14)" | grep -vE ".*zoo.*(0.4.13|0.4.14)" | grep -vE ".*kafka.*(0.4.13|0.4.14)" | grep -v "REPOSITORY" | awk '{print $1":" $2}'); do
|
||||
docker rmi ${i} || true
|
||||
done
|
||||
}
|
||||
|
||||
# Remove /tmp/fabric-shim
|
||||
docker run -v /tmp:/tmp library/alpine rm -rf /tmp/fabric-shim || true
|
||||
|
||||
# remove tmp/hfc and hfc-key-store data
|
||||
rm -rf /home/jenkins/.nvm /home/jenkins/npm /tmp/fabric-shim /tmp/hfc* /tmp/npm* /home/jenkins/kvsTemp /home/jenkins/.hfc-key-store
|
||||
|
||||
rm -rf /var/hyperledger/*
|
||||
|
||||
rm -rf gopath/src/github.com/hyperledger/fabric-ca/vendor/github.com/cloudflare/cfssl/vendor/github.com/cloudflare/cfssl_trust/ca-bundle || true
|
||||
# yamllint disable-line rule:line-length
|
||||
rm -rf gopath/src/github.com/hyperledger/fabric-ca/vendor/github.com/cloudflare/cfssl/vendor/github.com/cloudflare/cfssl_trust/intermediate_ca || true
|
||||
|
||||
clearContainers
|
||||
removeUnwantedImages
|
||||
}
|
||||
|
||||
env_Info() {
|
||||
# This function prints system info
|
||||
|
||||
#### Build Env INFO
|
||||
echo "-----------> Build Env INFO"
|
||||
# Output all information about the Jenkins environment
|
||||
uname -a
|
||||
cat /etc/*-release
|
||||
env
|
||||
gcc --version
|
||||
docker version
|
||||
docker info
|
||||
docker-compose version
|
||||
pgrep -a docker
|
||||
}
|
||||
|
||||
# Pull Thirdparty Docker images (kafka, couchdb, zookeeper baseos)
|
||||
pull_Thirdparty_Images() {
|
||||
echo "------> BASE_IMAGE_TAG:" $BASE_IMAGE_TAG
|
||||
for IMAGES in kafka couchdb zookeeper baseos; do
|
||||
echo "-----------> Pull $IMAGES image"
|
||||
echo
|
||||
docker pull $ORG_NAME-$IMAGES:${BASE_IMAGE_TAG} > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "\033[31m FAILED to pull docker images" "\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
docker tag $ORG_NAME-$IMAGES:${BASE_IMAGE_TAG} $ORG_NAME-$IMAGES
|
||||
docker tag $ORG_NAME-$IMAGES:${BASE_IMAGE_TAG} $ORG_NAME-$IMAGES:$VERSION
|
||||
done
|
||||
echo
|
||||
docker images | grep hyperledger/fabric
|
||||
}
|
||||
# pull Docker images from nexus
|
||||
pull_Docker_Images() {
|
||||
for IMAGES in ca peer orderer tools ccenv; do
|
||||
echo "-----------> pull $IMAGES image"
|
||||
echo
|
||||
docker pull $ORG_NAME-$IMAGES:$VERSION > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "\033[31m FAILED to pull docker images" "\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
docker tag $ORG_NAME-$IMAGES:$VERSION $ORG_NAME-$IMAGES
|
||||
done
|
||||
echo
|
||||
docker images | grep hyperledger/fabric
|
||||
}
|
||||
|
||||
# run byfn,eyfn tests
|
||||
byfn_eyfn_Tests() {
|
||||
echo
|
||||
echo "-----------> Execute Byfn and Eyfn Tests"
|
||||
./byfn_eyfn.sh
|
||||
}
|
||||
# run fabcar tests
|
||||
fabcar_Tests() {
|
||||
echo
|
||||
echo "npm version ------> $(npm -v)"
|
||||
echo "node version ------> $(node -v)"
|
||||
echo "-----------> Execute FabCar Tests"
|
||||
./fabcar.sh
|
||||
echo "Also running the compilation and lint tests of CommercialPaper"
|
||||
make -f ../../commercial-paper/.build/makefile
|
||||
}
|
||||
|
||||
# run commercial paper tests
|
||||
commercialpaper_Tests() {
|
||||
echo
|
||||
echo "-----------> Execute Commercial Paper Tests"
|
||||
make -f ../../commercial-paper/.build/makefile
|
||||
}
|
||||
Parse_Arguments $@
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright IBM Corp All Rights Reserved
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# docker container list
|
||||
CONTAINER_LIST=(peer0.org1 peer1.org1 peer0.org2 peer1.org2 peer0.org3 peer1.org3 orderer)
|
||||
COUCHDB_CONTAINER_LIST=(couchdb0 couchdb1 couchdb2 couchdb3 couchdb4 couchdb5)
|
||||
MARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}')
|
||||
echo "MARCH: $MARCH"
|
||||
echo "======== PULL fabric BINARIES ========"
|
||||
echo
|
||||
cd $BASE_FOLDER/fabric-samples || exit
|
||||
# Download fabric binaries from nexus
|
||||
curl https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/$MARCH-$VERSION/hyperledger-fabric-$MARCH-$VERSION.tar.gz | tar xz
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "\033[31m FAILED to download binaries" "\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $BASE_FOLDER/fabric-samples/first-network || exit
|
||||
export PATH=$BASE_FOLDER/fabric-samples/bin:$PATH
|
||||
|
||||
logs() {
|
||||
|
||||
# Create Docker_Container_Logs directory
|
||||
mkdir -p $WORKSPACE/Docker_Container_Logs
|
||||
|
||||
# Save logs in Logs directory
|
||||
for CONTAINER in ${CONTAINER_LIST[*]}; do
|
||||
docker logs $CONTAINER.example.com >& $WORKSPACE/Docker_Container_Logs/$CONTAINER-$1.log
|
||||
echo
|
||||
done
|
||||
}
|
||||
|
||||
if [ ! -z $2 ]; then
|
||||
|
||||
for CONTAINER in ${COUCHDB_CONTAINER_LIST[*]}; do
|
||||
docker logs $CONTAINER >& $WORKSPACE/Docker_Container_Logs/$CONTAINER-$1.log
|
||||
echo
|
||||
done
|
||||
fi
|
||||
|
||||
copy_logs() {
|
||||
|
||||
# Call logs function
|
||||
logs $2 $3
|
||||
|
||||
if [ $1 != 0 ]; then
|
||||
echo -e "\033[31m $2 test case is FAILED" "\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo "############## BYFN,EYFN DEFAULT CHANNEL TEST ###################"
|
||||
echo "#################################################################"
|
||||
echo y | ./byfn.sh -m down
|
||||
echo y | ./byfn.sh -m up -t 60
|
||||
copy_logs $? default-channel
|
||||
echo y | ./eyfn.sh -m up -t 60
|
||||
copy_logs $? default-channel
|
||||
echo y | ./eyfn.sh -m down
|
||||
echo
|
||||
|
||||
echo "############### BYFN,EYFN CUSTOM CHANNEL WITH COUCHDB TEST ##############"
|
||||
echo "#########################################################################"
|
||||
echo y | ./byfn.sh -m up -c custom-channel-couchdb -s couchdb -t 75 -d 15
|
||||
copy_logs $? custom-channel-couch couchdb
|
||||
echo y | ./eyfn.sh -m up -c custom-channel-couchdb -s couchdb -t 75 -d 15
|
||||
copy_logs $? custom-channel-couch
|
||||
echo y | ./eyfn.sh -m down
|
||||
echo
|
||||
|
||||
echo "############### BYFN,EYFN WITH NODE Chaincode. TEST ################"
|
||||
echo "####################################################################"
|
||||
echo y | ./byfn.sh -m up -l node -t 60
|
||||
copy_logs $? default-channel-node
|
||||
echo y | ./eyfn.sh -m up -l node -t 60
|
||||
copy_logs $? default-channel-node
|
||||
echo y | ./eyfn.sh -m down
|
||||
echo
|
||||
|
||||
echo "############### BYFN WITH CA TEST ################"
|
||||
echo "##################################################"
|
||||
echo y | ./byfn.sh -m up -a
|
||||
copy_logs $? default-channel-ca
|
||||
echo y | ./byfn.sh -m down -a
|
||||
echo
|
||||
|
||||
echo "############### BYFN WITH NO CHAINCODE TEST ################"
|
||||
echo "############################################################"
|
||||
echo y | ./byfn.sh -m up -n
|
||||
copy_logs $? default-channel-ca
|
||||
echo y | ./byfn.sh -m down -n
|
||||
echo
|
||||
Loading…
Reference in a new issue