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

Add --dry-run to deploy #7574

Merged
merged 13 commits into from
Sep 19, 2024
Merged

Add --dry-run to deploy #7574

merged 13 commits into from
Sep 19, 2024

Conversation

joehan
Copy link
Contributor

@joehan joehan commented Aug 20, 2024

Description

Adds a new --dry-run flag to firebase deploy. firebase deploy --dry-run will run any validations or build steps, and then report information about what change would have been made, without making any changes to your project.

Under the hood, this means that we only run the prepare step, and skip release/deploy. I reviewed prepare.ts for each product to ensure they don't make any production changes, and moved some validation from later stages to prepare where it belongs.

src/dataconnect/provisionCloudSql.ts Outdated Show resolved Hide resolved
src/dataconnect/provisionCloudSql.ts Show resolved Hide resolved
src/dataconnect/provisionCloudSql.ts Outdated Show resolved Hide resolved
src/deploy/dataconnect/deploy.ts Outdated Show resolved Hide resolved
src/deploy/dataconnect/prepare.ts Outdated Show resolved Hide resolved
src/deploy/dataconnect/prepare.ts Outdated Show resolved Hide resolved
@@ -276,9 +277,12 @@ export async function prepare(
// ===Phase 7. Finalize preparation by "fixing" all extraneous environment issues like IAM policies.
// We limit the scope endpoints being deployed.
await backend.checkAvailability(context, matchingBackend);
await ensureServiceAgentRoles(projectId, projectNumber, matchingBackend, haveBackend);
// TODO: CheckServiceAgentRoles when dryRun = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you will do this TODO before you submit this PR?

await validate.secretsAreValid(projectId, matchingBackend);
await ensure.secretAccess(projectId, matchingBackend, haveBackend);
// TODO: CheckSecretAccess when dryRun = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here

src/deploy/index.ts Outdated Show resolved Hide resolved
src/deploy/extensions/prepare.ts Show resolved Hide resolved
src/deploy/functions/prepare.ts Show resolved Hide resolved
Copy link
Contributor Author

@joehan joehan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the sloppiness here, and ty for the detailed reviews!

src/dataconnect/provisionCloudSql.ts Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 26.96629% with 65 lines in your changes missing coverage. Please review.

Project coverage is 52.79%. Comparing base (8f34600) to head (e1ff4e7).
Report is 35 commits behind head on master.

Files with missing lines Patch % Lines
src/dataconnect/provisionCloudSql.ts 0.00% 21 Missing ⚠️
src/deploy/dataconnect/prepare.ts 26.66% 11 Missing ⚠️
src/deploy/extensions/prepare.ts 16.66% 10 Missing ⚠️
src/deploy/firestore/prepare.ts 25.00% 6 Missing ⚠️
src/deploy/index.ts 0.00% 5 Missing ⚠️
src/deploy/functions/ensure.ts 33.33% 3 Missing and 1 partial ⚠️
src/deploy/functions/checkIam.ts 25.00% 2 Missing and 1 partial ⚠️
src/deploy/firestore/release.ts 33.33% 2 Missing ⚠️
src/deploy/functions/prepare.ts 0.00% 2 Missing ⚠️
src/deploy/dataconnect/deploy.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7574      +/-   ##
==========================================
- Coverage   53.06%   52.79%   -0.28%     
==========================================
  Files         391      394       +3     
  Lines       27003    27525     +522     
  Branches     5571     5687     +116     
==========================================
+ Hits        14330    14532     +202     
- Misses      11393    11703     +310     
- Partials     1280     1290      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -55,6 +58,36 @@ export default async function (context: any, options: Options): Promise<void> {
filters,
};
utils.logLabeledBullet("dataconnect", `Successfully prepared schema and connectors`);
if (options.dryRun) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From chatting offline -- we should invoke diffSchema here to surface migration diffs in dryRun

@joehan joehan added this pull request to the merge queue Sep 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 19, 2024
@joehan joehan added this pull request to the merge queue Sep 19, 2024
Merged via the queue into master with commit f0a608c Sep 19, 2024
41 checks passed
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.

5 participants