Skip to content

Commit

Permalink
Revert "[cli] Revert "Disallow promoting preview deployments to produ…
Browse files Browse the repository at this point in the history
…ction (#11363)"" (#11411)

Reverts #11410 to reinstate #11363
  • Loading branch information
EndangeredMassa committed Apr 10, 2024
1 parent 627b79f commit cddf3fa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/nine-countries-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'vercel': major
---

Disables promotion of preview deployments
10 changes: 2 additions & 8 deletions packages/cli/src/commands/promote/request-promote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,9 @@ export default async function requestPromote({
output: client.output,
});

if (deployment.target !== 'production') {
output.warn(
'Promoting a preview deployment to production is deprecated and will be removed in the next major release. This behavior will be removed entirely on 2024-05-03.'
);
}

if (deployment.target !== 'production' && !yes) {
const question =
'This deployment does not target production, therefore promotion will not apply production environment variables. Are you sure you want to continue?';
'This deployment is not a production deployment and cannot be directly promoted. A new deployment will be built using your production environment. Are you sure you want to continue?';
const answer = await confirm(client, question, false);
if (!answer) {
output.error('Canceled');
Expand All @@ -49,7 +43,7 @@ export default async function requestPromote({
}

// request the promotion
await client.fetch(`/v9/projects/${project.id}/promote/${deployment.id}`, {
await client.fetch(`/v10/projects/${project.id}/promote/${deployment.id}`, {
body: {}, // required
json: false,
method: 'POST',
Expand Down
8 changes: 6 additions & 2 deletions packages/cli/test/unit/commands/promote.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ describe('promote', () => {
`Fetching deployment "${previousDeployment.url}" in ${previousDeployment.creator?.username}`
);
await expect(client.stderr).toOutput(
'? This deployment does not target production, therefore promotion will not apply\n production environment variables. Are you sure you want to continue?'
'? This deployment is not a production deployment and cannot be directly \n' +
'promoted. A new deployment will be built using your production environment. Are \n' +
'you sure you want to continue? (y/N)'
);

// say "no" to the prompt
Expand All @@ -138,7 +140,9 @@ describe('promote', () => {
`Fetching deployment "${previousDeployment.url}" in ${previousDeployment.creator?.username}`
);
await expect(client.stderr).toOutput(
'? This deployment does not target production, therefore promotion will not apply\n production environment variables. Are you sure you want to continue?'
'? This deployment is not a production deployment and cannot be directly \n' +
'promoted. A new deployment will be built using your production environment. Are \n' +
'you sure you want to continue? (y/N)'
);

// say "yes" to the prompt
Expand Down

0 comments on commit cddf3fa

Please sign in to comment.