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

fix filter check to allow firestore targets #4722

Merged
merged 6 commits into from
Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixes issue where `firestore:*` did not work with `--only` in `deploy`. (#4698)
4 changes: 2 additions & 2 deletions src/checkValidTargetFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ export async function checkValidTargetFilters(options: Options): Promise<void> {
return reject(new FirebaseError("Cannot specify both --only and --except"));
}
const nonFilteredTypes = VALID_DEPLOY_TARGETS.filter(
(t) => !["hosting", "functions"].includes(t)
(t) => !["hosting", "functions", "firestore"].includes(t)

Choose a reason for hiding this comment

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

Hi @bkendall, just want to chime in. Does it also support storage?

Our pipeline also deploy storage rules with --only

firebase deploy --only storage:rules 

);
const targetsForNonFilteredTypes = targetsForTypes(only, ...nonFilteredTypes);
if (targetsForNonFilteredTypes.length && targetsHaveFilters(...targetsForNonFilteredTypes)) {
return reject(
new FirebaseError(
"Filters specified with colons (e.g. --only functions:func1,functions:func2) are only supported for functions and hosting"
"Filters specified with colons (e.g. --only functions:func1,functions:func2) are only supported for functions, hosting, and firestore"
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/checkValidTargetFilters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const SAMPLE_OPTIONS: Options = {
filteredTargets: [],
rc: new RC(),
};
const UNFILTERABLE_TARGETS = ["database", "storage", "firestore", "remoteconfig", "extensions"];
const UNFILTERABLE_TARGETS = ["database", "storage", "remoteconfig", "extensions"];

describe("checkValidTargetFilters", () => {
it("should resolve", async () => {
Expand Down Expand Up @@ -54,7 +54,7 @@ describe("checkValidTargetFilters", () => {
except: null,
});
await expect(checkValidTargetFilters(options)).to.be.rejectedWith(
"Filters specified with colons (e.g. --only functions:func1,functions:func2) are only supported for functions and hosting"
/Filters specified with colons \(e.g. --only functions:func1,functions:func2\) are only supported for .*/
);
});
});
Expand Down