summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLusheng Ji <lji@research.att.com>2018-03-18 22:23:18 -0400
committerLusheng Ji <lji@research.att.com>2018-03-19 02:33:38 +0000
commita1e833237a0503e0985d901461dc46d2f967ede1 (patch)
treede3b30c7686f5f593cb941b96e0399fca1fee0d3
parent5a3dbbb503eb686ded5ccc03a211b3fcae8e5505 (diff)
Add uploading wagon as archive
Add functions for building and uploading archives (zip and tgz) instead of wagons. This offers the option for wagon builders to download Cloudify Manger plugins as archive and build wagon packages in preferred environment (CentOS), instead of building them as part of CICD because Linux Foundation Jenkins servers are all Ubuntu. Issue-ID: DCAEGEN2-206 Change-Id: Iba38398d2102bbc088932243bbac8207c9f73c6c Signed-off-by: Lusheng Ji <lji@research.att.com>
-rw-r--r--scripts/mvn-phase-lib.sh58
1 files changed, 57 insertions, 1 deletions
diff --git a/scripts/mvn-phase-lib.sh b/scripts/mvn-phase-lib.sh
index 9ed0643..a0084df 100644
--- a/scripts/mvn-phase-lib.sh
+++ b/scripts/mvn-phase-lib.sh
@@ -271,6 +271,35 @@ build_wagons()
rm -rf venv-pkg
}
+build_archives_for_wagons()
+{
+ rm -rf ./*.wgn venv-pkg
+ virtualenv ./venv-pkg
+ source ./venv-pkg/bin/activate
+ pip install --upgrade pip
+ pip install wagon
+
+ SETUPFILES=$(find . -name "setup.py")
+ CURDIR=$(pwd)
+ for SETUPFILE in $SETUPFILES; do
+ PLUGIN_DIR=$(dirname "$SETUPFILE")
+ PLUGIN_NAME=$(grep 'name' "$SETUPFILE" | cut -f2 -d'=' | sed 's/[^0-9a-zA-Z\.]*//g')
+ PLUGIN_VERSION=$(grep 'version' "$SETUPFILE" | cut -f2 -d'=' | sed 's/[^0-9\.]*//g')
+
+ cd ${PLUGIN_DIR}/..
+ echo "In $(pwd), build plugin zip $PLUGIN_NAME, version $PLUGIN_VERSION"
+
+ zip -r "${PLUGIN_NAME}-${PLUGIN_VERSION}.zip" "./${PLUGIN_DIR}"
+ tar -czvf "${PLUGIN_NAME}-${PLUGIN_VERSION}.tgz" "./${PLUGIN_DIR}"
+
+ echo "Built archives for package ${PLUGIN_NAME}-${PLUGIN_VERSION}"
+ cd "$CURDIR"
+ done
+
+ deactivate
+ rm -rf venv-pkg
+}
+
upload_raw_file()
{
@@ -320,7 +349,35 @@ upload_raw_file()
curl -vkn --netrc-file "${NETRC}" --upload-file "${OUTPUT_FILE}" -X PUT -H "Content-Type: $OUTPUT_FILE_TYPE" "${SEND_TO}/${OUTPUT_FILE}"
}
+upload_wagon_archives()
+{
+ SETUPFILES=$(find . -name "setup.py")
+ CURDIR=$(pwd)
+ for SETUPFILE in $SETUPFILES; do
+ PLUGIN_DIR=$(dirname "$SETUPFILE")
+ PLUGIN_NAME=$(grep 'name' "$SETUPFILE" | cut -f2 -d'=' | sed 's/[^0-9a-zA-Z\.]*//g')
+ PLUGIN_VERSION=$(grep 'version' "$SETUPFILE" | cut -f2 -d'=' | sed 's/[^0-9\.]*//g')
+ cd ${PLUGIN_DIR}/..
+ echo "In $(pwd), upload zip archive for $PLUGIN_NAME, version $PLUGIN_VERSION"
+ ARCHIVE_FILE_NAME="${PLUGIN_NAME}-${PLUGIN_VERSION}.zip"
+ if [ -z "$ARCHIVE_FILE_NAME" ]; then
+ echo "!!! No zip archive file found ${ARCHIVE_FILE_NAME}"
+ exit -1
+ fi
+ upload_raw_file "${ARCHIVE_FILE_NAME}" "${PLUGIN_NAME}/${PLUGIN_VERSION}"
+
+ echo "In $(pwd), upload tgz archive for $PLUGIN_NAME, version $PLUGIN_VERSION"
+ ARCHIVE_FILE_NAME="${PLUGIN_NAME}-${PLUGIN_VERSION}.tgz"
+ if [ -z "$ARCHIVE_FILE_NAME" ]; then
+ echo "!!! No tgz archive file found ${ARCHIVE_FILE_NAME}"
+ exit -1
+ fi
+ upload_raw_file "${ARCHIVE_FILE_NAME}" "${PLUGIN_NAME}/${PLUGIN_VERSION}"
+
+ cd ${CURDIR}
+ done
+}
upload_wagons_and_type_yamls()
{
@@ -462,4 +519,3 @@ build_and_push_docker()
done
fi
}
-