From 0c2f520105c4d1a96e48c79a13dd75f326a93f10 Mon Sep 17 00:00:00 2001 From: heatherlp <40789053+heatherlp@users.noreply.github.com> Date: Tue, 3 Dec 2019 11:49:25 +0000 Subject: [PATCH] Remove redundant jenkins scripts (#58) Signed-off-by: heatherlp --- scripts/ci_scripts/ciScript.sh | 123 ------------------------ scripts/ci_scripts/publishApiDocs.sh | 34 ------- scripts/ci_scripts/publishNpmModules.sh | 94 ------------------ 3 files changed, 251 deletions(-) delete mode 100755 scripts/ci_scripts/ciScript.sh delete mode 100755 scripts/ci_scripts/publishApiDocs.sh delete mode 100755 scripts/ci_scripts/publishNpmModules.sh diff --git a/scripts/ci_scripts/ciScript.sh b/scripts/ci_scripts/ciScript.sh deleted file mode 100755 index ab65d788a2..0000000000 --- a/scripts/ci_scripts/ciScript.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -e -# -# Copyright IBM Corp All Rights Reserved -# -# SPDX-License-Identifier: Apache-2.0 -# - -export CONTAINER_LIST=(orderer peer0.org1 peer0.org2 ca0 ca1) - -# error check -err_Check() { - - echo -e "\033[31m $1" "\033[0m" - docker images | grep hyperledger && docker ps -a - - # Write orderer, peer & ca logs - for CONTAINER in ${CONTAINER_LIST[*]}; do - docker logs $CONTAINER.example.com >& $CONTAINER.log - done - - # Write couchdb container logs into couchdb.log file - docker logs couchdb >& couchdb.log - - # Copy debug log - cp ${WORKSPACE}/gopath/src/github.com/hyperledger/fabric-sdk-node/test/temp/*.log $WORKSPACE - exit 1 -} - -Parse_Arguments() { - while [ $# -gt 0 ]; do - case $1 in - --sdk_e2e_Tests) - sdk_e2e_Tests - ;; - --publish_NpmModules) - publish_NpmModules - ;; - --publish_ApiDocs) - publish_ApiDocs - ;; - *) - echo "Wrong function called" - exit 1 - ;; - esac - shift - done -} - -# Install npm -install_Npm() { - echo "-------> MARCH:" $MARCH - if [[ $MARCH == "s390x" || $MARCH == "ppc64le" ]]; then - set -x - # Source nvmrc.sh - source /etc/profile.d/nvmrc.sh - # Delete any existing prefix - npm config delete prefix - # Install NODE_VER - echo "------> Use $NODE_VER" - nvm install $NODE_VER || true - nvm use --delete-prefix v$NODE_VER --silent - npm install || err_Check "ERROR!!! npm install failed" - npm config set prefix ~/npm && npm install -g gulp && npm install -g istanbul - - echo -e "\033[32m npm version ------> $(npm -v)" "\033[0m" - echo -e "\033[32m node version ------> $(node -v)" "\033[0m" - set +x - else - echo -e "\033[32m npm version ------> $(npm -v)" "\033[0m" - echo -e "\033[32m node version ------> $(node -v)" "\033[0m" - set -x - npm install || err_Check "ERROR!!! npm install failed" - npm install -g gulp && npm install -g istanbul - set +x - fi -} - -# run sdk e2e tests -sdk_e2e_Tests() { - - cd ${WORKSPACE}/gopath/src/github.com/hyperledger/fabric-sdk-node - - # Install npm before start the tests - install_Npm - - # Generate crypto material before running the tests - if [ $ARCH == "s390x" ]; then - set -x - # Run the s390x gulp task - gulp install-and-generate-certs-s390 || err_Check "ERROR!!! gulp install and generation of test certificates failed" - set +x - else - set -x - # Run the amd64 gulp task - gulp install-and-generate-certs || err_Check "ERROR!!! gulp install and generation of test certificates failed" - set +x - fi - - echo " ########################" - echo -e "\033[1m RUN gulp TESTS \033[0m" - echo " ####################### " - - echo -e "\033[32m Execute Headless and Integration Tests" "\033[0m" - set -x - gulp test || err_Check "ERROR!!! gulp test failed" - set +x -} - -# Publish npm modules after successful merge on amd64 -publish_NpmModules() { - echo - echo -e "\033[32m -----------> Publish npm modules from amd64" "\033[0m" - ./publishNpmModules.sh -} - -# Publish NODE_SDK API docs after successful merge on amd64 -publish_ApiDocs() { - echo - echo -e "\033[32m -----------> Publish NODE_SDK API docs after successful merge on amd64" "\033[0m" - ./publishApiDocs.sh -} -Parse_Arguments $@ diff --git a/scripts/ci_scripts/publishApiDocs.sh b/scripts/ci_scripts/publishApiDocs.sh deleted file mode 100755 index 769ba794dd..0000000000 --- a/scripts/ci_scripts/publishApiDocs.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -e -# -# Copyright IBM Corp All Rights Reserved -# -# SPDX-License-Identifier: Apache-2.0 -# - -cd ${WORKSPACE}/gopath/src/github.com/hyperledger/fabric-sdk-node -# Generate SDK-Node API docs -gulp docs -# Short Head commit -SDK_COMMIT=$(git rev-parse --short HEAD) -echo "-------> SDK_COMMIT:" $SDK_COMMIT -TARGET_REPO=$NODE_SDK_USERNAME.github.io.git -git config --global user.email "fabricsdknode@gmail.com" -git config --global user.name "fabric-sdk-node" -# Clone SDK_NODE API doc repository -git clone https://github.com/$NODE_SDK_USERNAME/$TARGET_REPO -# Copy API docs to target repository & push to gh-pages URL -cp -r docs/gen/* $NODE_SDK_USERNAME.github.io -cd $NODE_SDK_USERNAME.github.io -git add . -git commit -m "SDK commit - $SDK_COMMIT" -# Credentials are stored as Global Variables in Jenkins -git config remote.gh-pages.url https://$NODE_SDK_USERNAME:$NODE_SDK_PASSWORD@github.com/$NODE_SDK_USERNAME/$TARGET_REPO -# Push API docs to target repository - -echo " ____ _ _ ____ _ _ _ ____ ___ ____ ___ ____ ____ " -echo "| _ \| | | / ___|| | | | / \ | _ \_ _| | _ \ / _ \ / ___/ ___| " -echo "| |_) | | | \___ \| |_| | / _ \ | |_) | | | | | | | | | | \___ \ " -echo "| __/| |_| |___) | _ | / ___ \| __/| | | |_| | |_| | |___ ___) | " -echo "|_| \___/|____/|_| |_| /_/ \_\_| |___| |____/ \___/ \____|____/ " - -git push gh-pages master diff --git a/scripts/ci_scripts/publishNpmModules.sh b/scripts/ci_scripts/publishNpmModules.sh deleted file mode 100755 index 3737f438af..0000000000 --- a/scripts/ci_scripts/publishNpmModules.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -e -# -# Copyright IBM Corp All Rights Reserved -# -# SPDX-License-Identifier: Apache-2.0 -# - -nodeModules="fabric-protos fabric-common fabric-ca-client fabric-client fabric-network" - -npmPublish() { - if [[ "$CURRENT_TAG" = *"skip"* ]]; then - echo -e "\033[34m----> Don't publish $1 npm modules on skip tag \033[0m" - elif [[ "$CURRENT_TAG" = *"unstable"* ]]; then - echo - # Get the current unstable version of a module from npm registry - UNSTABLE_VER=$(npm dist-tags ls "$1" | awk "/$CURRENT_TAG"":"/'{ - ver=$NF - rel=$NF - sub(/.*\./,"",rel) - sub(/\.[[:digit:]]+$/,"",ver) - print ver"."rel+1}') - if [[ $UNSTABLE_VER = "" ]]; then - echo -e "\033[34m ----> unstable ver is blank \033[0m" - UNSTABLE_INCREMENT=1 - else - # Get last digit of the unstable version built above - UNSTABLE_INCREMENT=$(echo $UNSTABLE_VER| rev | cut -d '.' -f 1 | rev) - fi - echo -e "\033[32m======> UNSTABLE_INCREMENT:" $UNSTABLE_INCREMENT "\033[0m" - # Append last digit with the package.json version - export UNSTABLE_INCREMENT_VERSION=$RELEASE_VERSION.$UNSTABLE_INCREMENT - echo -e "\033[32m======> UNSTABLE_INCREMENT_VERSION:" $UNSTABLE_INCREMENT_VERSION "\033[0" - for module in ${nodeModules}; do - sed -i "s/\"${module}\": \".*\"/\"${module}\": \"${CURRENT_TAG}\"/" package.json - done - - # Replace existing version with $UNSTABLE_INCREMENT_VERSION - sed -i 's/\(.*\"version\"\: \"\)\(.*\)/\1'$UNSTABLE_INCREMENT_VERSION\"\,'/' package.json - # Show Version after modify the package.json with latest version to publish - grep '"version":' package.json | cut -d\" -f4 - # Publish unstable versions to npm registry - npm publish --tag $CURRENT_TAG - if [ $? != 0 ]; then - echo -e "\033[31m FAILED to publish $CURRENT_TAG of $1 npm module" "\033[0m" - exit 1 - fi - echo -e "\033[32m ========> PUBLISHED $CURRENT_TAG tag of $1 npm module SUCCESSFULLY" "\033[0m" - - else - # Publish node modules on latest tag - echo -e "\033[32m ========> PUBLISH $RELEASE_VERSION" "\033[0m" - for module in ${nodeModules}; do - sed -i "s/\"${module}\": \".*\"/\"${module}\": \"${CURRENT_TAG}\"/" package.json - done - - npm publish --tag $CURRENT_TAG - if [ $? != 0 ]; then - echo -e "\033[31m FAILED TO PUBLISH $CURRENT_TAG of $1 npm module" "\033[0m" - exit 1 - fi - echo -e "\033[32m ========> PUBLISHED $CURRENT_TAG tag of $1 npm module SUCCESSFULLY" "\033[0m" - fi -} - -versions() { - # Get the unstable tag from package.json - CURRENT_TAG=$(grep '"tag":' package.json | cut -d\" -f4) - echo -e "\033[32m ======> Current TAG: $CURRENT_TAG" "\033[0m" - # Get the version from package.json - RELEASE_VERSION=$(grep '"version":' package.json | cut -d\" -f4) - echo -e "\033[32m ======> Current Version: $RELEASE_VERSION" "\033[0m" -} - -echo " ____ _ _ ____ _ ___ ____ _ _ _ _ ____ __ __" -echo "| _ \| | | | __ )| | |_ _/ ___|| | | | | \ | | _ \| \/ |" -echo "| |_) | | | | _ \| | | |\___ \| |_| | | \| | |_) | |\/| |" -echo "| __/| |_| | |_) | |___ | | ___) | _ | | |\ | __/| | | |" -echo "|_| \___/|____/|_____|___|____/|_| |_| |_| \_|_| |_| |_|" - -cd $WORKSPACE/gopath/src/github.com/hyperledger/fabric-sdk-node -# Set NPM_TOKEN from CI configuration -# Please post in #ci-pipeline channel if you observe npm_token issue -npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN - -# Publish node modules -for module in ${nodeModules}; do - if [ -d "$module" ]; then - echo -e "\033[32m Publishing $module" "\033[0m" - cd $module - versions - npmPublish $module - cd - - fi -done