forked from pulumi/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Travis job for uploading zipfile to S3 (pulumi#29)
- Loading branch information
1 parent
88c79b4
commit 5fed47c
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.pulumi | ||
Pulumi.*.yaml | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
if: branch = master | ||
sudo: true # give us 7.5GB and >2 bursted cores. | ||
before_install: | ||
# Install the AWS CLI, which is required by upload-examples.sh | ||
- pip install --upgrade --user awscli | ||
script: | ||
- ./upload-examples.sh | ||
notifications: | ||
webhooks: https://ufci1w66n3.execute-api.us-west-2.amazonaws.com/stage/travis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
# publish-examples.sh downloads a GitHub zipfile of examples repo and writes to | ||
# s3:https://rel.pulumi.com/releases/examples/pulumi-examples.zip. | ||
set -o nounset -o errexit -o pipefail | ||
|
||
ROOT=$(dirname $0) | ||
EXAMPLES_FILENAME="pulumi.examples.zip" | ||
EXAMPLES_PATH="${ROOT}/${EXAMPLES_FILENAME}" | ||
|
||
echo -e "Downloading ${EXAMPLES_PATH} to publish to S3" | ||
|
||
# Download the zipfile for the examples repo at master | ||
curl -H "Authorization: token ${GITHUB_TOKEN}" \ | ||
-L "https://github.com/pulumi/examples/archive/master.zip" > ${EXAMPLES_PATH} | ||
|
||
# Assume the UploadPulumiReleases role first | ||
CREDS_JSON=$(aws sts assume-role \ | ||
--role-arn "arn:aws:iam::058607598222:role/UploadPulumiReleases" \ | ||
--role-session-name "upload-plugin-pulumi-resource-aws" \ | ||
--external-id "upload-pulumi-release") | ||
|
||
# Use the credentials we just assumed | ||
export AWS_ACCESS_KEY_ID=$(echo ${CREDS_JSON} | jq ".Credentials.AccessKeyId" --raw-output) | ||
export AWS_SECRET_ACCESS_KEY=$(echo ${CREDS_JSON} | jq ".Credentials.SecretAccessKey" --raw-output) | ||
export AWS_SECURITY_TOKEN=$(echo ${CREDS_JSON} | jq ".Credentials.SessionToken" --raw-output) | ||
|
||
aws s3 cp --only-show-errors "${EXAMPLES_PATH}" "s3:https://rel.pulumi.com/examples/${EXAMPLES_FILENAME}" | ||
|
||
rm "${EXAMPLES_PATH}" |