Skip to content

Commit

Permalink
Add S3 redirect to latest MSI package
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Mirić committed Apr 7, 2021
1 parent c34fc05 commit f4be53a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packaging/bin/create-msi-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ sync_to_s3() {
# Disable cache for index files.
s3cmd modify --recursive --exclude='*' --include='index.html' \
--add-header='Cache-Control:no-cache, max-age=0' "s3://${S3PATH}/"

# Update latest redirect
latest="$(find "$REPODIR" -name '*.msi' -printf '%P\n' | sort | tail -1)"
s3cmd put --add-header="x-amz-website-redirect-location:/msi/${latest}" \
--add-header='Cache-Control:no-cache, max-age=0' \
"$(mktemp)" "s3://${S3PATH}/k6-latest-amd64.msi"
}

mkdir -p "$REPODIR"
Expand All @@ -44,8 +50,6 @@ s3cmd sync --exclude='*' --include='*.msi' "s3://${S3PATH}/" "$REPODIR/"
# Copy the new packages in
find "$PKGDIR" -name "*.msi" -type f -print0 | xargs -r0 cp -t "$REPODIR"

# TODO: Handle k6-latest-amd64.msi

delete_old_pkgs "$REPODIR"

log "Generating index.html ..."
Expand Down

0 comments on commit f4be53a

Please sign in to comment.