Skip to content

chore: generate template dynamically for specific enabled plugins#127

Open
pkosiec wants to merge 2 commits intopkosiec/lakebase-plugin-2from
pkosiec/lakebase-plugin-3
Open

chore: generate template dynamically for specific enabled plugins#127
pkosiec wants to merge 2 commits intopkosiec/lakebase-plugin-2from
pkosiec/lakebase-plugin-3

Conversation

@pkosiec
Copy link
Member

@pkosiec pkosiec commented Feb 23, 2026

First phase of the dynamic template, that works with analytics and/or lakebase plugins.

Resolves https://databricks.atlassian.net/browse/LKB-9681

Video

lakebase-template.mp4

All PRs

  1. CLI: Display plugin setup instructions after apps init flow, remove empty files after template rendering cli#4549
  2. feat(lakebase): add ability to lookup DB username with API #123
  3. feat(appkit): introduce Lakebase plugin #126
  4. chore: generate template dynamically for specific enabled plugins #127

Scope

We agreed on the following scope:

  1. remove harcoded paths on CLI - maybe just trigger an npm command as a part of the template at the end (if necessary, let's see)
  2. from the template, I'll use Go templates to conditionally add/remove files content

@pkosiec pkosiec marked this pull request as ready for review February 23, 2026 18:10
@pkosiec pkosiec force-pushed the pkosiec/lakebase-plugin-2 branch from 52c4a14 to 884ae23 Compare February 23, 2026 18:13
@pkosiec pkosiec force-pushed the pkosiec/lakebase-plugin-3 branch from 7dc17cb to 884eb11 Compare February 23, 2026 18:14
@pkosiec pkosiec changed the title feat(template): generate template dynamically for specific enabled plugins chore: generate template dynamically for specific enabled plugins Feb 23, 2026
@pkosiec pkosiec force-pushed the pkosiec/lakebase-plugin-3 branch from 884eb11 to cb82241 Compare February 23, 2026 19:01
@pkosiec pkosiec force-pushed the pkosiec/lakebase-plugin-2 branch from 280e89e to 1e776a2 Compare February 24, 2026 11:24
@pkosiec pkosiec force-pushed the pkosiec/lakebase-plugin-3 branch from cb82241 to 488f59d Compare February 24, 2026 11:27
@pkosiec pkosiec force-pushed the pkosiec/lakebase-plugin-2 branch from 1e776a2 to b2e77c6 Compare February 24, 2026 12:44
@pkosiec pkosiec force-pushed the pkosiec/lakebase-plugin-3 branch 4 times, most recently from fd8adcb to 8e4e80e Compare February 25, 2026 09:54
@pkosiec pkosiec force-pushed the pkosiec/lakebase-plugin-3 branch from 8e4e80e to 5a02a65 Compare February 25, 2026 10:06
plugins: [
{{.plugin_usages}}
{{- if .plugins.lakebase}}
server({ autoStart: false }),
Copy link
Collaborator

Choose a reason for hiding this comment

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

since the server is already defined as "requiredByTemplate" it will be added automatically, we don't have to hard code it, what would be nice is to get the config from the manifest and inject it here instead, but I guess that can be added later. But this seems very specific to lakebase so it can extend the routes, maybe we can do this in a different way?

Comment on lines 1 to +17
command: ['npm', 'run', 'start']
{{- if .app_env}}
env:
{{.app_env}}
{{- if .plugins.analytics}}
- name: DATABRICKS_WAREHOUSE_ID
valueFrom: sql-warehouse
{{- end}}
{{- if .plugins.lakebase}}
- name: PGHOST
value: "" # Copy from the Lakebase Postgres UI
- name: PGDATABASE
value: "databricks_postgres" # Copy from the Lakebase Postgres UI
- name: LAKEBASE_ENDPOINT
value: "" # Run: databricks postgres list-endpoints projects/{project-id}/branches/{branch-id}
- name: PGSSLMODE
value: "require"
# - name: PGUSER
# value: "" # optional, defaults to DATABRICKS_CLIENT_ID
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is all very coupled to each plugin, right now the cli populates the env vars based on the resources from the manifest so we wouldn't need this for analytics.

I wonder if we can make it in a different way for lakebase so we can keep what we had instead of putting ifs all around checking for each plugin

"@databricks/appkit-ui": "0.9.0",
"@databricks/sdk-experimental": "^0.14.2",
"clsx": "^2.1.1",
"embla-carousel-react": "^8.6.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think some of these are being used by some of the components we have, why are we deleting them?

"lib": ["ES2020"],

/* Modules */
"module": "CommonJS",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wouldn't do this 😅

@MarioCadenas
Copy link
Collaborator

MarioCadenas commented Feb 25, 2026

I like the idea of making the template even more dynamic, but there are some things we need to polish 😄.
We also need to be very careful when we merge this. The template pinning should be merged before this, your changes on the CLI to use this template, and the CLI released with it, if not we can't merge this as it has a lot of breaking changes on the template

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.

2 participants