From 731288d7fbc340c02a6cfa08e7ad30677fad232e Mon Sep 17 00:00:00 2001 From: heatherlp Date: Tue, 29 Oct 2019 11:02:47 +0000 Subject: [PATCH] Clean up jenkins - moved the jenkins scripts to tools dir - removed references to jenkins build status Signed-off-by: heatherlp --- .gitignore | 4 +- CONTRIBUTING.md | 2 +- Jenkinsfile.x | 225 ------------------ apis/fabric-contract-api/README.md | 2 +- docs/apidocs/README.md | 4 +- libraries/fabric-shim/README.md | 2 +- .../scripts}/Jenkins_Scripts/CI_Script.sh | 0 .../Jenkins_Scripts/Publish_NPM_Modules.sh | 0 {scripts => tools/scripts}/changelog.sh | 0 {scripts => tools/scripts}/gittag.sh | 0 {scripts => tools/scripts}/multiarch.sh | 0 {scripts => tools/scripts}/release.sh | 0 12 files changed, 7 insertions(+), 232 deletions(-) delete mode 100644 Jenkinsfile.x rename {scripts => tools/scripts}/Jenkins_Scripts/CI_Script.sh (100%) rename {scripts => tools/scripts}/Jenkins_Scripts/Publish_NPM_Modules.sh (100%) rename {scripts => tools/scripts}/changelog.sh (100%) rename {scripts => tools/scripts}/gittag.sh (100%) rename {scripts => tools/scripts}/multiarch.sh (100%) rename {scripts => tools/scripts}/release.sh (100%) diff --git a/.gitignore b/.gitignore index ffa27aee..49bfb3d4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,9 @@ npm-debug.log .DS_Store fabric-shim/.DS_Store test/.DS_Store -// ignore vscode config +# ignore vscode config .vscode -// ignore webstorm config +# ignore webstorm config .idea yarn.lock .nyc_output diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e2f72e51..17a65ea9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,7 +33,7 @@ They also need to have the `nodeenv` image present - this is build as part of th ## Using the repo -* Clone the repo, and ensure you are using nove v10, and have rush installed +* Clone the repo, and ensure you are using node v10, and have rush installed * `rush update` is needed to ensure everything is correctly linked and updated. At this point the repo is fully ready for use and running tests, etc. A full sequence of build-test that is equivalent to the CI pipeline is diff --git a/Jenkinsfile.x b/Jenkinsfile.x deleted file mode 100644 index 1274917f..00000000 --- a/Jenkinsfile.x +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright IBM Corp All Rights Reserved -// -// SPDX-License-Identifier: Apache-2.0 -// -timeout(40) { - node ('hyp-x') { // trigger build on x86_64 node - timestamps { - def ROOTDIR = pwd() // workspace dir (/w/workspace/) - try { - env.PROJECT_DIR = "gopath/src/github.com/hyperledger" - env.PROJECT = "fabric-chaincode-node" - env.GOPATH = "$WORKSPACE/gopath" - env.ARCH = "amd64" - def nodeHome = tool 'nodejs-10.15.2' - env.VERSION = sh(returnStdout: true, script: 'curl -O https://raw.githubusercontent.com/hyperledger/fabric/master/Makefile && cat Makefile | grep "BASE_VERSION =" | cut -d "=" -f2').trim() - env.IMAGE_TAG = "${ARCH}-latest" // fabric latest stable version from nexus - env.PATH = "$GOPATH/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:${nodeHome}/bin:$PATH" - def jobname = sh(returnStdout: true, script: 'echo ${JOB_NAME} | grep -q "verify" && echo patchset || echo merge').trim() - def failure_stage = "none" - env.PATH = "${env.PATH}:${nodeHome}/bin" - // delete working directory - deleteDir() - stage("Fetch Patchset") { - cleanWs() - try { - if (jobname == "patchset") { - println "IN VERIFY PATCHSET" - println "$GERRIT_REFSPEC" - println "$GERRIT_BRANCH" - checkout([ - $class: 'GitSCM', - branches: [[name: '$GERRIT_REFSPEC']], - extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'gopath/src/github.com/hyperledger/$PROJECT'], [$class: 'CheckoutOption', timeout: 10]], - userRemoteConfigs: [[credentialsId: 'hyperledger-jobbuilder', name: 'origin', refspec: '$GERRIT_REFSPEC:$GERRIT_REFSPEC', url: '$GIT_BASE']] - ]) - dir("${ROOTDIR}/$PROJECT_DIR") { - sh ''' - # Clone fabric repository - git clone --single-branch -b $GERRIT_BRANCH https://github.com/hyperledger/fabric - # Clone fabric-samples repository - git clone --single-branch -b $GERRIT_BRANCH --depth=1 https://github.com/hyperledger/fabric-samples - ''' - } - } else { - // Clone fabric-chaincode-node on merge - println "Clone $PROJECT repository" - checkout([ - $class: 'GitSCM', - branches: [[name: 'refs/heads/$GERRIT_BRANCH']], - extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'gopath/src/github.com/hyperledger/$PROJECT']], - userRemoteConfigs: [[credentialsId: 'hyperledger-jobbuilder', name: 'origin', refspec: '+refs/heads/$GERRIT_BRANCH:refs/remotes/origin/$GERRIT_BRANCH', url: '$GIT_BASE']] - ]) - dir("${ROOTDIR}/$PROJECT_DIR") { - sh ''' - # Clone fabric repository - git clone --single-branch -b $GERRIT_BRANCH https://github.com/hyperledger/fabric - # Clone fabric-samples repository - git clone --single-branch -b $GERRIT_BRANCH --depth=1 https://github.com/hyperledger/fabric-samples - ''' - } - } - - dir("${ROOTDIR}/$PROJECT_DIR/$PROJECT") { - sh ''' - # Print last two commit details - echo - git log -n2 --pretty=oneline --abbrev-commit - echo - ''' - } - } catch (err) { - failure_stage = "Fetch patchset" - currentBuild.result = 'FAILURE' - throw err - } - } - - // clean environment and get env data - stage("Clean Environment - Get Env Info") { - // wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) { - try { - dir("${ROOTDIR}/$PROJECT_DIR/fabric-chaincode-node/scripts/Jenkins_Scripts") { - sh './CI_Script.sh --clean_Environment --env_Info' - } - } catch (err) { - failure_stage = "Clean Environment - Get Env Info" - currentBuild.result = 'FAILURE' - throw err - } - // } - } - - // Pull Fabric, Fabric-ca Images - stage("Pull Docker Images") { - // wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) { - try { - dir("${ROOTDIR}/$PROJECT_DIR/fabric-chaincode-node/scripts/Jenkins_Scripts") { - sh './CI_Script.sh --pull_Docker_Images' - } - } catch (err) { - failure_stage = "Pull fabric, fabric-ca docker images" - currentBuild.result = 'FAILURE' - throw err - } - // } - } - - // Run Full Builds - stage("Run Full Build") { - // wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) { - try { - dir("${ROOTDIR}/$PROJECT_DIR/fabric-chaincode-node/scripts/Jenkins_Scripts") { - sh './CI_Script.sh --fullBuild' - } - } catch (err) { - failure_stage = "fullBuild" - currentBuild.result = 'FAILURE' - throw err - } - // } - } - - // Publish hyperledger/fabric-nodeenv image from merged job only - if (env.JOB_NAME == "fabric-chaincode-node-merge-x86_64") { - publishNodeenv() - } else { - echo "------> Don't publish nodeenv image from verify job" - } - - // Publish npm modules from merged job - if (env.JOB_NAME == "fabric-chaincode-node-merge-x86_64") { - publishNpm() - } else { - echo "------> Don't publish npm modules from verify job" - } - - // Publish API Docs from merged job only - if (env.JOB_NAME == "fabric-chaincode-node-merge-x86_64") { - apiDocs() - } else { - echo "------> Don't publish API Docs from verify job" - } - - } finally { - // the multiple report files that are now generated as a side effect of using rush are not - // supported within Jenkins. As these are revered as part of the developer build this reporting is not - // a concern - - dir("${ROOTDIR}/$PROJECT_DIR/fabric-chaincode-node/") { - archiveArtifacts allowEmptyArchive: true, artifacts: '**/*.log' - } - if (env.JOB_NAME == "fabric-chaincode-node-merge-x86_64") { - if (currentBuild.result == 'FAILURE') { // Other values: SUCCESS, UNSTABLE - rocketSend "Build Notification - STATUS: *${currentBuild.result}* - BRANCH: *${env.GERRIT_BRANCH}* - PROJECT: *${env.PROJECT}* - BUILD_URL - (<${env.BUILD_URL}|Open>)" - } - } - } // finally block - } // timestamps block - } // node block -} // timeout block - -// Publish npm modules after successful merge -def publishNpm() { - stage("Publish npm Modules") { - def ROOTDIR = pwd() - withCredentials([[$class : 'StringBinding', - credentialsId: 'NPM_LOCAL', - variable : 'NPM_TOKEN']]) { - // wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) { - try { - dir("${ROOTDIR}/$PROJECT_DIR/fabric-chaincode-node/scripts/Jenkins_Scripts") { - sh './CI_Script.sh --publish_NpmModules' - } - } catch (err) { - failure_stage = "publish_NpmModules" - currentBuild.result = 'FAILURE' - throw err - } - // } - } - } -} - -// Publish Chaincode node API docs after successful merge -def apiDocs() { - stage("Publish API Docs") { - def ROOTDIR = pwd() - withCredentials([[$class : 'UsernamePasswordMultiBinding', - credentialsId: 'chaincode-node-credentials', - usernameVariable: 'CHAINCODE_NODE_USERNAME', - passwordVariable: 'CHAINCODE_NODE_PASSWORD']]) { - // wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) { - try { - dir("${ROOTDIR}/$PROJECT_DIR/fabric-chaincode-node/scripts/Jenkins_Scripts") { - sh './CI_Script.sh --publish_ApiDocs' - } - } catch (err) { - failure_stage = "publish_Api_Docs" - currentBuild.result = 'FAILURE' - throw err - } - // } - } - } -} - -// Publish Chaincode_node nodeenv image after successful merge -def publishNodeenv() { - stage("Publish nodeenv image") { - def ROOTDIR = pwd() - configFileProvider([configFile(fileId: 'fabric-settings', variable: 'SETTINGS_FILE')]) { - // wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) { - try { - dir("${ROOTDIR}/$PROJECT_DIR/fabric-chaincode-node/scripts/Jenkins_Scripts") { - sh './CI_Script.sh --publish_Nodeenv_Image' - } - } catch (err) { - failure_stage = "publish_nodeenv_image" - currentBuild.result = 'FAILURE' - throw err - } - // } - } - } -} diff --git a/apis/fabric-contract-api/README.md b/apis/fabric-contract-api/README.md index e4c8a330..cb9f2da2 100644 --- a/apis/fabric-contract-api/README.md +++ b/apis/fabric-contract-api/README.md @@ -2,7 +2,7 @@ [![NPM](https://nodei.co/npm/fabric-shim.svg?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/fabric-shim/) -[![Version](https://badge.fury.io/js/fabric-shim.svg)](http://badge.fury.io/js/fabric-shim) [![Build Status](https://jenkins.hyperledger.org/buildStatus/icon?job=fabric-chaincode-node-merge-x86_64)](https://jenkins.hyperledger.org/view/fabric-chaincode-node/job/fabric-chaincode-node-merge-x86_64) +[![Version](https://badge.fury.io/js/fabric-shim.svg)](http://badge.fury.io/js/fabric-shim) The `fabric-contract-api` provides the *contract interface* a high level API for application developers to implement [Smart Contracts](https://hyperledger-fabric.readthedocs.io/en/latest/glossary.html#smart-contract). Working with this API provides a high level entry point to writing business logic. diff --git a/docs/apidocs/README.md b/docs/apidocs/README.md index 69d470b5..1383897c 100644 --- a/docs/apidocs/README.md +++ b/docs/apidocs/README.md @@ -1,10 +1,10 @@ [![NPM](https://nodei.co/npm/fabric-contract-api.svg?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/fabric-contract-api/) -[![Version](https://badge.fury.io/js/fabric-contract-api.svg)](http://badge.fury.io/js/fabric-contract-api) [![Build Status](https://jenkins.hyperledger.org/buildStatus/icon?job=fabric-chaincode-node-merge-x86_64)](https://jenkins.hyperledger.org/view/fabric-chaincode-node/job/fabric-chaincode-node-merge-x86_64) +[![Version](https://badge.fury.io/js/fabric-contract-api.svg)](http://badge.fury.io/js/fabric-contract-api) [![NPM](https://nodei.co/npm/fabric-shim.svg?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/fabric-shim/) -[![Version](https://badge.fury.io/js/fabric-shim.svg)](http://badge.fury.io/js/fabric-shim) [![Build Status](https://jenkins.hyperledger.org/buildStatus/icon?job=fabric-chaincode-node-merge-x86_64)](https://jenkins.hyperledger.org/view/fabric-chaincode-node/job/fabric-chaincode-node-merge-x86_64) +[![Version](https://badge.fury.io/js/fabric-shim.svg)](http://badge.fury.io/js/fabric-shim) ## Introduction diff --git a/libraries/fabric-shim/README.md b/libraries/fabric-shim/README.md index 962b8ad1..15a690e7 100644 --- a/libraries/fabric-shim/README.md +++ b/libraries/fabric-shim/README.md @@ -2,7 +2,7 @@ -[![Version](https://badge.fury.io/js/fabric-shim.svg)](http://badge.fury.io/js/fabric-shim) [![Build Status](https://jenkins.hyperledger.org/buildStatus/icon?job=fabric-chaincode-node-merge-x86_64)](https://jenkins.hyperledger.org/view/fabric-chaincode-node/job/fabric-chaincode-node-merge-x86_64) +[![Version](https://badge.fury.io/js/fabric-shim.svg)](http://badge.fury.io/js/fabric-shim) The `fabric-shim` provides the *chaincode interface*, a lower level API for implementing "Smart Contracts". To confirm that this is the same as the `fabric-shim` in previous versions of Hyperledger Fabric. diff --git a/scripts/Jenkins_Scripts/CI_Script.sh b/tools/scripts/Jenkins_Scripts/CI_Script.sh similarity index 100% rename from scripts/Jenkins_Scripts/CI_Script.sh rename to tools/scripts/Jenkins_Scripts/CI_Script.sh diff --git a/scripts/Jenkins_Scripts/Publish_NPM_Modules.sh b/tools/scripts/Jenkins_Scripts/Publish_NPM_Modules.sh similarity index 100% rename from scripts/Jenkins_Scripts/Publish_NPM_Modules.sh rename to tools/scripts/Jenkins_Scripts/Publish_NPM_Modules.sh diff --git a/scripts/changelog.sh b/tools/scripts/changelog.sh similarity index 100% rename from scripts/changelog.sh rename to tools/scripts/changelog.sh diff --git a/scripts/gittag.sh b/tools/scripts/gittag.sh similarity index 100% rename from scripts/gittag.sh rename to tools/scripts/gittag.sh diff --git a/scripts/multiarch.sh b/tools/scripts/multiarch.sh similarity index 100% rename from scripts/multiarch.sh rename to tools/scripts/multiarch.sh diff --git a/scripts/release.sh b/tools/scripts/release.sh similarity index 100% rename from scripts/release.sh rename to tools/scripts/release.sh