-
Notifications
You must be signed in to change notification settings - Fork 0
Document Foundry auto-deploy + optional OAuth registry login #21
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,70 @@ | ||
| # Foundry Auto-Deploy (OpenAPI -> Functions) | ||
|
|
||
| This repo is set up so a tagged release can publish a Docker image to Foundry and make its FastAPI routes importable as Foundry **functions**. | ||
|
|
||
| The key idea: publish a container image that includes a Foundry-compatible OpenAPI contract (as the `server.openapi` image label). In Foundry, you can then run **Detect from OpenAPI specification** to auto-register the functions. | ||
|
|
||
| ## What You Get | ||
|
|
||
| - A deterministic OpenAPI surface area (`openapi.foundry.json`) for Foundry import. | ||
| - A container image with the OpenAPI contract embedded in metadata. | ||
| - UI-driven function registration from the contract (no handwritten wrappers). | ||
|
|
||
| ## How It Works (High Level) | ||
|
|
||
| 1. Generate a Foundry-constrained OpenAPI spec. | ||
| 2. Build a linux/amd64 image that embeds the spec as `server.openapi`. | ||
| 3. Push the image to a Foundry Artifact Repository. | ||
| 4. In Foundry Compute Modules, link the image tag and run **Detect from OpenAPI specification**. | ||
|
|
||
| ## Screenshots | ||
|
|
||
| Compute module function-call flow (functions module + query panel): | ||
|
|
||
|  | ||
|
|
||
| OpenAPI schema view inside Foundry (this is the contract Foundry imports): | ||
|
|
||
|  | ||
|
|
||
| Artifact repository tags (images pushed by CI/CD show up here): | ||
|
|
||
|  | ||
|
|
||
| Add any additional Foundry UI screenshots to `assets/` and reference them from this doc and `README.md`. | ||
|
|
||
| ## Commands (Local) | ||
|
|
||
| Generate and validate the Foundry-constrained OpenAPI artifact: | ||
|
|
||
| ```bash | ||
| uv run python scripts/deploy/foundry_openapi.py --generate --spec-path openapi.foundry.json | ||
| uv run python scripts/deploy/foundry_openapi.py --spec-path openapi.foundry.json | ||
| ``` | ||
|
|
||
| Build an image that includes the OpenAPI as metadata: | ||
|
|
||
| ```bash | ||
| export OPENAPI_JSON="$(uv run python -c 'import json; print(json.dumps(json.load(open("openapi.foundry.json", encoding="utf-8")), separators=(",", ":")))')" | ||
|
|
||
| docker buildx build \ | ||
| --platform linux/amd64 \ | ||
| --build-arg SERVER_OPENAPI="${OPENAPI_JSON}" \ | ||
| --tag "<registry>/<repo>/<image>:<tag>" \ | ||
| --load \ | ||
| . | ||
| ``` | ||
|
|
||
| ## CI/CD (Recommended) | ||
|
|
||
| - `/.github/workflows/publish-foundry.yml` publishes to Foundry on tag builds (`v*`). | ||
| - `/.github/workflows/release-version.yml` can auto-create a `vX.Y.Z` tag after CI passes on `main`. | ||
|
|
||
| Foundry workflow docs live in: | ||
|
|
||
| - `docs/deploy-ci.md` | ||
| - `docs/foundry-openapi-runbook.md` | ||
|
|
||
| ## Auth Notes | ||
|
|
||
| For CI, prefer a dedicated non-admin Foundry user that has **Edit** permission on the target Artifact Repository. Generate a long-lived token as that user and store it as the GitHub secret `FOUNDRY_TOKEN`. | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auth notes are inconsistent with other docs and missing OAuth2 option.
Two issues:
Inconsistency: This doc recommends a "long-lived token" for
FOUNDRY_TOKEN, butdocs/deploy-ci.md(line 62) statesFOUNDRY_TOKENis "short-lived" and needs refreshing before each publish window.Missing OAuth2 guidance: The workflow now supports OAuth2 client credentials as the preferred authentication method (via
FOUNDRY_URL,FOUNDRY_OAUTH_CLIENT_ID,FOUNDRY_OAUTH_CLIENT_SECRET), but this section only mentions the legacyFOUNDRY_TOKENapproach.📝 Suggested update to align auth guidance
🤖 Prompt for AI Agents