Skip to content

Commit

Permalink
Log note of upcoming change of "Deployment ID" to "Version ID" (#5400)
Browse files Browse the repository at this point in the history
  • Loading branch information
RamIdeas committed Mar 28, 2024
1 parent b341614 commit c90dd6b
Show file tree
Hide file tree
Showing 7 changed files with 731 additions and 215 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-bees-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

chore: log of impending change of "Deployment ID" to "Version ID" in `wrangler deploy`, `wrangler deployments list`, `wrangler deployments view` and `wrangler rollback`. This is a warning of a future change for anyone depending on the output text format, for example by grepping the output in automated flows.
858 changes: 657 additions & 201 deletions packages/wrangler/src/__tests__/deploy.test.ts

Large diffs are not rendered by default.

55 changes: 44 additions & 11 deletions packages/wrangler/src/__tests__/deployments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ describe("deployments", () => {
Author: Jean-Luc-Picard@federation.org
Source: Rollback from Wrangler 🤠
Rollback from: MOCK-DEPLOYMENT-ID-2222
🟩 Active"
🟩 Active
NOTE: \\"Deployment ID\\" in this output will be changed to \\"Version ID\\" in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments"
`);
});

Expand Down Expand Up @@ -139,7 +142,10 @@ describe("deployments", () => {
Author: Jean-Luc-Picard@federation.org
Source: Rollback from Wrangler 🤠
Rollback from: MOCK-DEPLOYMENT-ID-2222
🟩 Active"
🟩 Active
NOTE: \\"Deployment ID\\" in this output will be changed to \\"Version ID\\" in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments"
`);
});

Expand Down Expand Up @@ -171,7 +177,10 @@ describe("deployments", () => {
Handlers: fetch
--------------------------bindings--------------------------
None
"
NOTE: \\"Deployment ID\\" in this output will be changed to \\"Version ID\\" in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments"
`);
});

Expand All @@ -197,7 +206,10 @@ describe("deployments", () => {
binding = \\"MY_BUCKET\\"
bucket_name = \\"testr2\\"
"
NOTE: \\"Deployment ID\\" in this output will be changed to \\"Version ID\\" in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments"
`);
});
it("should automatically log latest deployment details", async () => {
Expand All @@ -219,7 +231,10 @@ describe("deployments", () => {
Handlers: fetch
--------------------------bindings--------------------------
None
"
NOTE: \\"Deployment ID\\" in this output will be changed to \\"Version ID\\" in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments"
`);
});
});
Expand Down Expand Up @@ -287,7 +302,10 @@ describe("deployments", () => {
Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name
Current Deployment ID: galactic_mission_alpha"
Current Deployment ID: galactic_mission_alpha
NOTE: \\"Deployment ID\\" in this output will be changed to \\"Version ID\\" in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments"
`);

expect(requests.count).toEqual(1);
Expand Down Expand Up @@ -323,7 +341,10 @@ describe("deployments", () => {
🤖 Using default value in non-interactive context:
Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name
Current Deployment ID: galactic_mission_alpha"
Current Deployment ID: galactic_mission_alpha
NOTE: \\"Deployment ID\\" in this output will be changed to \\"Version ID\\" in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments"
`);

expect(requests.count).toEqual(1);
Expand All @@ -339,7 +360,10 @@ describe("deployments", () => {
Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name
Current Deployment ID: galactic_mission_alpha"
Current Deployment ID: galactic_mission_alpha
NOTE: \\"Deployment ID\\" in this output will be changed to \\"Version ID\\" in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments"
`);

expect(requests.count).toEqual(1);
Expand All @@ -355,7 +379,10 @@ describe("deployments", () => {
Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name
Current Deployment ID: galactic_mission_alpha"
Current Deployment ID: galactic_mission_alpha
NOTE: \\"Deployment ID\\" in this output will be changed to \\"Version ID\\" in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments"
`);

expect(requests.count).toEqual(1);
Expand All @@ -379,7 +406,10 @@ describe("deployments", () => {
Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name
Current Deployment ID: galactic_mission_alpha"
Current Deployment ID: galactic_mission_alpha
NOTE: \\"Deployment ID\\" in this output will be changed to \\"Version ID\\" in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments"
`);

expect(requests.count).toEqual(1);
Expand Down Expand Up @@ -410,7 +440,10 @@ describe("deployments", () => {
Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:something-else
Current Deployment ID: galactic_mission_alpha"
Current Deployment ID: galactic_mission_alpha
NOTE: \\"Deployment ID\\" in this output will be changed to \\"Version ID\\" in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments"
`);

expect(requests.count).toEqual(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ describe("deprecated-usage-model", () => {
Uploaded test-name (TIMINGS)
Published test-name (TIMINGS)
https://test-name.test-sub-domain.workers.dev
Current Deployment ID: Galaxy-Class",
Current Deployment ID: Galaxy-Class
NOTE: \\"Deployment ID\\" in this output will be changed to \\"Version ID\\" in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments",
"warn": "",
}
`);
Expand Down
5 changes: 5 additions & 0 deletions packages/wrangler/src/deploy/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
getSourceMappedString,
maybeRetrieveFileSourceMap,
} from "../sourcemap";
import { logVersionIdChange } from "../utils/deployment-id-version-id-change";
import { getZoneForRoute } from "../zones";
import type { FetchError } from "../cfetch";
import type { Config } from "../config";
Expand Down Expand Up @@ -962,6 +963,8 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
}

logger.log("Current Deployment ID:", deploymentId);

logVersionIdChange();
}

function deployWfpUserWorker(
Expand All @@ -971,6 +974,8 @@ function deployWfpUserWorker(
// Will go under the "Uploaded" text
logger.log(" Dispatch Namespace:", dispatchNamespace);
logger.log("Current Deployment ID:", deploymentId);

logVersionIdChange();
}

export function helpIfErrorIsSizeOrScriptStartup(
Expand Down
8 changes: 6 additions & 2 deletions packages/wrangler/src/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { mapBindings } from "./init";
import { logger } from "./logger";
import * as metrics from "./metrics";
import { requireAuth } from "./user";
import { logVersionIdChange } from "./utils/deployment-id-version-id-change";
import { getScriptName, printWranglerBanner } from ".";
import type { Config } from "./config";
import type { WorkerMetadataBinding } from "./deployment-bundle/create-worker-upload-form";
Expand Down Expand Up @@ -102,6 +103,8 @@ Source: ${triggerStr}`;

versionMessages[versionMessages.length - 1] += "🟩 Active";
logger.log(...versionMessages);

logVersionIdChange();
}

function formatSource(source: string): string {
Expand Down Expand Up @@ -210,6 +213,8 @@ export async function rollbackDeployment(

logger.log(`\nSuccessfully rolled back to Deployment ID: ${deploymentId}`);
logger.log("Current Deployment ID:", deployment_id);

logVersionIdChange();
}

async function rollbackRequest(
Expand Down Expand Up @@ -318,8 +323,7 @@ ${

logger.log(version);

// early return to skip the deployments listings
return;
logVersionIdChange();
}

export async function commonDeploymentCMDSetup(
Expand Down
10 changes: 10 additions & 0 deletions packages/wrangler/src/utils/deployment-id-version-id-change.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { logger } from "../logger";

export function logVersionIdChange() {
const docsLink =
"https://developers.cloudflare.com/workers/configuration/versions-and-deployments";

logger.log(
`\n\nNOTE: "Deployment ID" in this output will be changed to "Version ID" in a future version of Wrangler. To learn more visit: ${docsLink}`
);
}

0 comments on commit c90dd6b

Please sign in to comment.