-
Notifications
You must be signed in to change notification settings - Fork 1k
Fdc brownfield setup #8150
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
Merged
Merged
Fdc brownfield setup #8150
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
cf4feab
Helper functions and basic setup for dataconnect:sql:setup
tammam-g 37bdfa5
Refactor setupIamUsers for better composability
tammam-g 830e010
FDC MVP brownfield and greenfield to brownfield schema setup
tammam-g 2f445be
Add required logic inside schemaMigration for handling brownfield
tammam-g ee20d66
Cleanup and fix bugs in brownfield setup
tammam-g f7edd16
Use firebasesuperuser instead of cloudsqlsuper user for brownfield mi…
tammam-g bf5c904
Add default permissions for brownfield
tammam-g d4d80e0
Fix lint/format
tammam-g 4fce5d3
Refactor to allow setup reruns
tammam-g b1931e4
Fix small things and address comments
tammam-g e928a6b
Fix bug in role grants
tammam-g ff1b518
Add logging that database setup completed
tammam-g f8e4ec1
Make grant command not go through setup if roles can be granted in br…
tammam-g fc51dae
bug fix from changing the getting schema owner command
tammam-g f53e45b
Simplify getSchemaMetaData in permissions.ts
tammam-g 61e66fc
Merge branch 'master' into fdc-brownfield-setup
tammam-g 0c72a2b
Fix log statement
tammam-g 17e3c58
Split permissions.ts into front facing permissions_setup.ts and keep …
tammam-g 8e29299
No need to ask user if they want to rerun greenfield setup
tammam-g f52a6b1
Make setupSQLPermissions return a setup status instead of a boolean
tammam-g 7038a28
Change an if statment to switch statement
tammam-g 486ab5b
Keep upserting new user in grant command
tammam-g 59e343a
Bump FDC local toolkit to v1.8.0. (#8210)
rosalyntan 9209c10
First pass at auto generating sdk configs (#7833)
maneesht 6f269bc
13.31.0
google-oss-bot 405a876
[firebase-release] Removed change log and reset repo after 13.31.0 re…
google-oss-bot e717aca
FDC Emulator Update v1.8.1(#8216)
maneesht a5950df
13.31.1
google-oss-bot 3ec0f2a
[firebase-release] Removed change log and reset repo after 13.31.1 re…
google-oss-bot 543a785
Update formatting of connector evolution and insecure operation issue…
rosalyntan 63e56d3
Use correct import path for data connect emulator (#8220)
joehan 7b07e17
Don't surface insecure operations errors in VSCode. (#8215)
rosalyntan 2052bc1
Add path information to formatted GraphqlError. (#8228)
rosalyntan d73ac95
App Hosting Emulator bug - apphosting emulator info is not complete w…
mathu97 409dde6
Bump FDC local toolkit to v1.8.2. (#8232)
rosalyntan 6acc6ae
13.31.2
google-oss-bot e3a6e8c
[firebase-release] Removed change log and reset repo after 13.31.2 re…
google-oss-bot a958110
fix: #8168 - enforce webframeworks only when needed (#8169)
fivecar cf4f30e
Added env var to magically import data connect service from console (…
joehan 0c009ea
Add initial delay when loading python functions (#8239)
taeold ddc0514
Update vscode to 0.13.1 (#8236)
hlshen 8fcccce
Propagate overrides (#8253)
sarahec 01bbf36
Print warning about --location removal from apphosting commands. (#8229)
annajowang f49703f
Fix issue where apps:init breaks on app creation (#8258)
maneesht c1aa045
Rename MetaData to Metadata
tammam-g 8840d77
Change setup to set up in firebase error
tammam-g b5500fa
Improve logger message
tammam-g 16d7144
Merge branch 'master' into fdc-brownfield-setup
tammam-g b962c71
Fix bugs in brownfield setup status checks
tammam-g 916129b
fix lint issues
tammam-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
- Fix webframeworks deployments when using `site` in `firebase.json`. (#8295) | ||
- Add support for brownfield project onboard `dataconnect:sql:setup` (#8150) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Command } from "../command"; | ||
import { Options } from "../options"; | ||
import { needProjectId } from "../projectUtils"; | ||
import { pickService } from "../dataconnect/fileUtils"; | ||
import { FirebaseError } from "../error"; | ||
import { requireAuth } from "../requireAuth"; | ||
import { requirePermissions } from "../requirePermissions"; | ||
import { ensureApis } from "../dataconnect/ensureApis"; | ||
import { setupSQLPermissions, getSchemaMetadata } from "../gcp/cloudsql/permissions_setup"; | ||
import { DEFAULT_SCHEMA } from "../gcp/cloudsql/permissions"; | ||
import { getIdentifiers } from "../dataconnect/schemaMigration"; | ||
|
||
export const command = new Command("dataconnect:sql:setup [serviceId]") | ||
.description("Setup your CloudSQL database") | ||
.before(requirePermissions, [ | ||
"firebasedataconnect.services.list", | ||
"firebasedataconnect.schemas.list", | ||
"firebasedataconnect.schemas.update", | ||
"cloudsql.instances.connect", | ||
]) | ||
.before(requireAuth) | ||
.action(async (serviceId: string, options: Options) => { | ||
const projectId = needProjectId(options); | ||
await ensureApis(projectId); | ||
const serviceInfo = await pickService(projectId, options.config, serviceId); | ||
const instanceId = | ||
serviceInfo.dataConnectYaml.schema.datasource.postgresql?.cloudSql.instanceId; | ||
if (!instanceId) { | ||
throw new FirebaseError( | ||
"dataconnect.yaml is missing field schema.datasource.postgresql.cloudsql.instanceId", | ||
); | ||
} | ||
|
||
const { databaseId } = getIdentifiers(serviceInfo.schema); | ||
|
||
const schemaInfo = await getSchemaMetadata(instanceId, databaseId, DEFAULT_SCHEMA, options); | ||
await setupSQLPermissions(instanceId, databaseId, schemaInfo, options); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.