Skip to content

Commit

Permalink
Add support for R2 staging, print banner for list cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
cmackenzie1 committed Jan 21, 2025
1 parent c70d322 commit 8661d52
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/wrangler/src/pipelines/cli/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { requireAuth } from "../../user";
import { listPipelines } from "../client";
import type { CommonYargsOptions } from "../../yargs-types";
import type { ArgumentsCamelCase } from "yargs";
import { printWranglerBanner } from "../../wrangler-banner";

export async function listPipelinesHandler(
args: ArgumentsCamelCase<CommonYargsOptions>
) {
await printWranglerBanner();
const config = readConfig(args);
const accountId = await requireAuth(config);

Expand Down
9 changes: 7 additions & 2 deletions packages/wrangler/src/pipelines/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { HeadBucketCommand, S3Client } from "@aws-sdk/client-s3";
import { getCloudflareApiEnvironmentFromEnv } from "../environment-variables/misc-variables";
import { FatalError } from "../errors";
import { logger } from "../logger";
import { APIError } from "../parse";
Expand Down Expand Up @@ -49,7 +50,7 @@ export async function authorizeR2Bucket(
endpoint: getAccountR2Endpoint(accountId),
});

// Wait for token to settle/propagate, retry up to 10 times, with 1s waits in-between errors
// Wait for token to settle/propagate, retry up to 10 times, with 2s waits in-between errors
!__testSkipDelaysFlag &&
(await retryOnError(
async () => {
Expand All @@ -59,14 +60,18 @@ export async function authorizeR2Bucket(
})
);
},
1000,
2000,
10
));

return serviceToken;
}

export function getAccountR2Endpoint(accountId: string) {
const env = getCloudflareApiEnvironmentFromEnv();
if (env === "staging") {
return `https://${accountId}.r2-staging.cloudflarestorage.com`;
}
return `https://${accountId}.r2.cloudflarestorage.com`;
}

Expand Down

0 comments on commit 8661d52

Please sign in to comment.