Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding note to README about GCP/Azure concurrency #134

Merged
merged 1 commit into from
Apr 20, 2023
Merged

Adding note to README about GCP/Azure concurrency #134

merged 1 commit into from
Apr 20, 2023

Conversation

danopia
Copy link
Contributor

@danopia danopia commented May 14, 2022

In reaction to:

If you do want to address the deployment race condition without using import-map-deployer, we'd love to hear what you come up with. Consider leaving a PR to these docs that explain what you did!

S3 does not allow for this strategy, but it's valid on several other storage providers as mentioned.

example

To verify the process, I've implemented a basic GCP flow in a rough shell script:

#!/bin/bash
set -euxo pipefail

Bucket="${1}"
Specifier="${2}"
Destination="${3}"
JsonFile="${Bucket}/bundles/latest.json"

# Check that the target is really there
gsutil cat "${Bucket}${Destination}" | wc -c

# Operate optimistically on a single generation
# (If we race someone else with the file, only one will succeed)
CurrentVersion=$(gsutil ls -a "${JsonFile}" | cut -d'#' -f2)
gsutil cat "${JsonFile}#${CurrentVersion}" \
| jq \
    --arg specifier "$Specifier" \
    --arg target "$Destination" \
    '.imports[$specifier] = $target' \
| gsutil \
    -h "x-goog-if-generation-match: ${CurrentVersion}" \
    -h "cache-control: max-age=60" \
    cp - "${JsonFile}"

It didn't seem fit to include in the README itself, given the scope of the doc/repo.

S3 _does not_ allow for this strategy, but it's valid on several other storage providers as mentioned.
@TheMcMurder TheMcMurder merged commit 598a5c6 into single-spa:main Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants