Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions aws_attach_integration_permissions/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,44 @@

set -e

VERSIONS_BUCKET="datadog-opensource-asset-versions"
VERSIONS_JSON_PATH=".attach_integration_permissions/versions.json"

generate_versions_json() {
echo "Generating ${VERSIONS_JSON_PATH} for version ${VERSION}..."

local version_number="${VERSION}"
local release_date=$(date +%Y-%m-%d)

# Remove previous versions.json
mkdir -p "$(dirname "${VERSIONS_JSON_PATH}")"
rm -f "${VERSIONS_JSON_PATH}"

local versions_json
versions_json=$(jq -r -n \
--arg ver "${version_number}" \
--arg date "${release_date}" \
'
{
latest: {
version: $ver,
release_date: $date
}
}
')

echo "${versions_json}" > "${VERSIONS_JSON_PATH}"
echo "Generated ${VERSIONS_JSON_PATH}"
}

upload_versions_json() {
echo "Uploading versions.json to s3://${VERSIONS_BUCKET}/attach_integration_permissions/versions.json..."

aws s3 cp "${VERSIONS_JSON_PATH}" "s3://${VERSIONS_BUCKET}/attach_integration_permissions/versions.json"

echo "Uploaded versions.json to S3!"
}

# Read the S3 bucket
if [ -z "$1" ]; then
echo "Must specify a S3 bucket to publish the template"
Expand Down Expand Up @@ -63,4 +101,14 @@ fi
echo "Done uploading the template, and here is the CloudFormation quick launch URL"
echo "https://console.aws.amazon.com/cloudformation/home#/stacks/create/review?stackName=datadog-aws-integration&templateURL=https://${BUCKET}.s3.amazonaws.com/aws_attach_integration_permissions/${VERSION}/main.yaml"

# Generate and upload versions.json
echo "Generating and uploading versions.json for the new release..."

generate_versions_json
upload_versions_json

echo "Done generating and uploading versions.json!"
echo "Please verify the uploaded file:"
echo "\thttps://${VERSIONS_BUCKET}.s3.amazonaws.com/attach_integration_permissions/versions.json"

echo "Done!"
Loading