pulumi/scripts/publish_tgz.sh
Matt Ellis c8b7e1fc71 Only publish some artifacts from a single Linux leg
We publish some artifacts from this repository, which are specific to
an OS. In the past, we only had a single Linux leg and so we did not
need any additional conditional logic.

However, we now have multiple Linux legs (across different node
versions) running in parallel, so if we try to publish the same
artifacts at the same time, we can run into issues because two `aws s3
cp` jobs try to write to the same file at the same time.

Follow similar logic to our skips we do around publishing NPM and PyPI
packages here, as well.
2019-01-15 10:42:28 -08:00

34 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
# publish.sh builds and publishes the tarballs that our other repositories consume.
set -o nounset
set -o errexit
set -o pipefail
# We run multiple legs on Linux, but only want to publish the tgz's from the one that publishes
# our NPM and PyPI packages. Otherwise, we may race with other legs when publishing to S3 which
# leads to issues about values being out of range.
if [ "${TRAVIS_OS_NAME:-}" = "linux" ] && [ "${TRAVIS_PUBLISH_PACKAGES:-}" != "true" ]; then
exit 0
fi
readonly ROOT=$(dirname "${0}")/..
readonly PUBLISH="${GOPATH}/src/github.com/pulumi/scripts/ci/publish.sh"
readonly PUBLISH_GOARCH=("amd64")
readonly PUBLISH_PROJECT="pulumi"
if [[ ! -f "${PUBLISH}" ]]; then
>&2 echo "error: Missing publish script at $PUBLISH"
exit 1
fi
readonly OS=$(go env GOOS)
echo "Publishing SDK build to s3://eng.pulumi.com/:"
for ARCH in "${PUBLISH_GOARCH[@]}"; do
export GOARCH="${ARCH}"
RELEASE_INFO=($($(dirname "${0}")/make_release.sh))
"${PUBLISH}" ${RELEASE_INFO[0]} "${PUBLISH_PROJECT}/${OS}/${ARCH}" ${RELEASE_INFO[@]:1}
done
exit 0