Skip to content

Commit 0c3e948

Browse files
committed
fix: fix release script to use endpoint url flag instead of env var for aws (#2685)
<!-- Please make sure there is an issue that this PR is correlated to. --> ## Changes <!-- If there are frontend changes, please include screenshots. -->
1 parent fc15db0 commit 0c3e948

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

scripts/release/artifacts.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ export async function updateArtifacts(opts: ReleaseOpts) {
1313
Deno.env.get("R2_RELEASES_SECRET_ACCESS_KEY") ??
1414
(await $`op read "op://Engineering/rivet-releases R2 Upload/password"`.text());
1515

16+
const endpointUrl = "https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com";
17+
1618
// Create AWS CLI command builder with credentials
1719
const awsCommand = new CommandBuilder().env({
1820
AWS_ACCESS_KEY_ID: awsAccessKeyId,
1921
AWS_SECRET_ACCESS_KEY: awsSecretAccessKey,
20-
AWS_ENDPOINT_URL:
21-
"https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com",
2222
AWS_DEFAULT_REGION: "auto",
2323
});
2424

@@ -27,7 +27,7 @@ export async function updateArtifacts(opts: ReleaseOpts) {
2727
$.logStep("Listing Original Files", commitPrefix);
2828
const commitFiles = await awsCommand
2929
.command(
30-
`aws s3api list-objects --bucket rivet-releases --prefix ${commitPrefix}`,
30+
`aws s3api list-objects --bucket rivet-releases --prefix ${commitPrefix} --endpoint-url ${endpointUrl}`,
3131
)
3232
.json();
3333
assert(
@@ -37,34 +37,35 @@ export async function updateArtifacts(opts: ReleaseOpts) {
3737

3838
// Copy files to version directory
3939
const versionTarget = `rivet/${opts.version}/`;
40-
await copyFiles(awsCommand, commitPrefix, versionTarget);
41-
await generateInstallScripts(awsCommand, opts, opts.version);
40+
await copyFiles(awsCommand, commitPrefix, versionTarget, endpointUrl);
41+
await generateInstallScripts(awsCommand, opts, opts.version, endpointUrl);
4242

4343
// If this is the latest version, copy to latest directory
4444
if (opts.latest) {
45-
await copyFiles(awsCommand, commitPrefix, "rivet/latest/");
46-
await generateInstallScripts(awsCommand, opts, "latest");
45+
await copyFiles(awsCommand, commitPrefix, "rivet/latest/", endpointUrl);
46+
await generateInstallScripts(awsCommand, opts, "latest", endpointUrl);
4747
}
4848
}
4949

5050
async function copyFiles(
5151
awsCommand: CommandBuilder,
5252
sourcePrefix: string,
5353
targetPrefix: string,
54+
endpointUrl: string,
5455
) {
5556
$.logStep("Copying Files", targetPrefix);
5657
await $.logGroup(async () => {
5758
// Delete existing files in target directory using --recursive
5859
$.logStep("Deleting existing files in", targetPrefix);
5960
await awsCommand
60-
.command(`aws s3 rm s3://rivet-releases/${targetPrefix} --recursive`)
61+
.command(`aws s3 rm s3://rivet-releases/${targetPrefix} --recursive --endpoint-url ${endpointUrl}`)
6162
.spawn();
6263

6364
// Copy new files using --recursive
6465
$.logStep("Copying files from", sourcePrefix, "to", targetPrefix);
6566
await awsCommand
6667
.command(
67-
`aws s3 cp s3://rivet-releases/${sourcePrefix} s3://rivet-releases/${targetPrefix} --recursive --copy-props none`,
68+
`aws s3 cp s3://rivet-releases/${sourcePrefix} s3://rivet-releases/${targetPrefix} --recursive --copy-props none --endpoint-url ${endpointUrl}`,
6869
)
6970
.spawn();
7071
});
@@ -74,6 +75,7 @@ async function generateInstallScripts(
7475
awsCommand: CommandBuilder,
7576
opts: ReleaseOpts,
7677
version: string,
78+
endpointUrl: string,
7779
) {
7880
const installScriptPaths = [
7981
resolve(opts.root, "scripts/release/static/install.sh"),
@@ -89,7 +91,7 @@ async function generateInstallScripts(
8991
// Upload the install script to S3
9092
$.logStep("Uploading Install Script", uploadKey);
9193
await awsCommand
92-
.command(`aws s3 cp - s3://rivet-releases/${uploadKey}`)
94+
.command(`aws s3 cp - s3://rivet-releases/${uploadKey} --endpoint-url ${endpointUrl}`)
9395
.stdinText(scriptContent)
9496
.spawn();
9597
}

0 commit comments

Comments
 (0)