|
| 1 | +#!/bin/bash |
| 2 | +set -ex |
| 3 | + |
| 4 | +export GITHUB_USERNAME=$1 |
| 5 | +export GITHUB_PASSWORD=$2 |
| 6 | +export AWS_ACCESS_KEY_ID=$3 |
| 7 | +export AWS_ACCESS_KEY=$4 |
| 8 | +export REPO=$5 |
| 9 | +export BRANCH=$6 |
| 10 | +export CORE_TAG_NAME="4.5.5.dev1" |
| 11 | +export CORE_BRANCH="master" |
| 12 | + |
| 13 | +set +e |
| 14 | +. /etc/profile.d/rvm.sh |
| 15 | +set -e |
| 16 | + |
| 17 | +curl -u $GITHUB_USERNAME:$GITHUB_PASSWORD https://raw.githubusercontent.com/cloudify-cosmo/${REPO}/${CORE_BRANCH}/packages-urls/common_build_env.sh -o ./common_build_env.sh && |
| 18 | +source common_build_env.sh && |
| 19 | +curl https://raw.githubusercontent.com/cloudify-cosmo/cloudify-common/${CORE_BRANCH}/packaging/common/provision.sh -o ./common-provision.sh && |
| 20 | +source common-provision.sh |
| 21 | + |
| 22 | +install_common_prereqs |
| 23 | +cd packaging/omnibus |
| 24 | +export CLI_BRANCH="$CORE_BRANCH" |
| 25 | + |
| 26 | +# Get Omnibus software from Chef Omnibus repo |
| 27 | +rm -rf omnibus-software |
| 28 | +git clone https://github.com/chef/omnibus-software.git --depth 1 -q |
| 29 | +list_of_omnibus_softwares="gdbm cacerts config_guess gdbm libffi makedepend |
| 30 | + ncurses openssl pkg-config-lite setuptools |
| 31 | + util-macros version-manifest xproto zlib" |
| 32 | +for omnibus_softwate in $list_of_omnibus_softwares |
| 33 | +do |
| 34 | + if [[ -e omnibus-software/config/software/$omnibus_softwate.rb ]] ; then |
| 35 | + cp -r omnibus-software/config/software/$omnibus_softwate.rb \ |
| 36 | + config/software/$omnibus_softwate.rb |
| 37 | + else |
| 38 | + echo "Missing software in Omnibus-Software repo" |
| 39 | + exit |
| 40 | + fi |
| 41 | + |
| 42 | + [[ -e omnibus-software/config/patches/$omnibus_softwate ]] && |
| 43 | + cp -r omnibus-software/config/patches/$omnibus_softwate config/patches/ |
| 44 | +done |
| 45 | + |
| 46 | +[ ! -d config/templates/ ] && mkdir config/templates/ |
| 47 | +cp -r omnibus-software/config/templates/* config/templates/ |
| 48 | +curl https://raw.githubusercontent.com/chef/omnibus-software/master/config/software/preparation.rb -o config/software/preparation.rb |
| 49 | +curl https://raw.githubusercontent.com/systemizer/omnibus-software/master/config/software/pip.rb -o config/software/pip.rb |
| 50 | + |
| 51 | +if [[ "$OSTYPE" == "darwin"* ]]; then |
| 52 | + grep -l '/opt' config/software/* | xargs sed -i "" 's|/opt|/usr/local/opt|g' |
| 53 | +fi |
| 54 | + |
| 55 | +omnibus build cloudify && result="success" |
| 56 | +cd pkg |
| 57 | +cat *.json || exit 1 |
| 58 | +rm -f version-manifest.json |
| 59 | +[ $(ls | grep rpm | sed -n 2p ) ] && FILEEXT="rpm" |
| 60 | +[ $(ls | grep deb | sed -n 2p ) ] && FILEEXT="deb" |
| 61 | +[ $(ls | grep pkg | sed -n 2p ) ] && FILEEXT="pkg" |
| 62 | + |
| 63 | +#remove the -1 - omnibus set the build_iteration to 1 if it null |
| 64 | +file=$(basename $(find . -type f -name "*.$FILEEXT")) |
| 65 | +echo "file=$file" |
| 66 | +file_no_build=$(echo "$file" | sed 's/\(.*\)-1/\1/' | sed 's/cloudify/cloudify-cli/') |
| 67 | +echo "file_no_build=$file_no_build" |
| 68 | +mv $file $file_no_build |
| 69 | + |
| 70 | +[ "$result" == "success" ] && create_md5 $FILEEXT && |
| 71 | +[ -z ${AWS_ACCESS_KEY} ] || upload_to_s3 $FILEEXT && upload_to_s3 "md5" && |
| 72 | +upload_to_s3 "json" |
0 commit comments