Skip to content

Commit

Permalink
package.sh: upload raw binaries to S3
Browse files Browse the repository at this point in the history
  • Loading branch information
sparrc committed Sep 2, 2015
1 parent b86c6bb commit 0c106c0
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ else
debian_package=telegraf_${VERSION}_amd64.deb
fi

COMMON_FPM_ARGS="-C $TMP_WORK_DIR --vendor $VENDOR --url $URL --license $LICENSE --maintainer $MAINTAINER --after-install $POST_INSTALL_PATH --name telegraf --version $VERSION --config-files $CONFIG_ROOT_DIR ."
COMMON_FPM_ARGS="-C $TMP_WORK_DIR --vendor $VENDOR --url $URL --license $LICENSE \
--maintainer $MAINTAINER --after-install $POST_INSTALL_PATH \
--name telegraf --version $VERSION --config-files $CONFIG_ROOT_DIR ."
$rpm_args fpm -s dir -t rpm --description "$DESCRIPTION" $COMMON_FPM_ARGS
if [ $? -ne 0 ]; then
echo "Failed to create RPM package -- aborting."
Expand Down Expand Up @@ -289,16 +291,35 @@ if [ "$CIRCLE_BRANCH" == "" ]; then
cleanup_exit 1
fi

# Upload .deb and .rpm packages
for filepath in `ls *.{deb,rpm}`; do
echo "Uploading $filepath to S3"
filename=`basename $filepath`
echo "Uploading $filename to s3://get.influxdb.org/telegraf/$filename"
AWS_CONFIG_FILE=$AWS_FILE aws s3 cp $filepath s3://get.influxdb.org/telegraf/$filename --acl public-read --region us-east-1
AWS_CONFIG_FILE=$AWS_FILE aws s3 cp $filepath \
s3://get.influxdb.org/telegraf/$filename \
--acl public-read --region us-east-1
if [ $? -ne 0 ]; then
echo "Upload failed -- aborting".
cleanup_exit 1
fi
done

# Upload binaries
for b in ${BINS[*]}; do
bin = $GOPATH_INSTALL/bin/$b
zippedbin = $b_$VERSION_linux_amd64.zip
# Zip the binary
zip $TMP_WORK_DIR/$zippedbin $bin
echo "Uploading binary: $zippedbin to S3"
AWS_CONFIG_FILE=$AWS_FILE aws s3 cp $TMP_WORK_DIR/$zippedbin \
s3://get.influxdb.org/telegraf/$zippedbin \
--acl public-read --region us-east-1
if [ $? -ne 0 ]; then
echo "Binary upload failed -- aborting".
cleanup_exit 1
fi
done
else
echo "Not publishing packages to S3."
fi
Expand Down

0 comments on commit 0c106c0

Please sign in to comment.