Skip to content

Build DocumentDB images from custom gitHub sources#354

Open
hossain-rayhan wants to merge 3 commits intodocumentdb:mainfrom
hossain-rayhan:rayhan/build-with-custom-image
Open

Build DocumentDB images from custom gitHub sources#354
hossain-rayhan wants to merge 3 commits intodocumentdb:mainfrom
hossain-rayhan:rayhan/build-with-custom-image

Conversation

@hossain-rayhan
Copy link
Copy Markdown
Collaborator

This is needed for personal testing.

Copilot AI review requested due to automatic review settings April 22, 2026 19:50
Copy link
Copy Markdown
Collaborator

@guanzhousongmicrosoft guanzhousongmicrosoft left a comment

Choose a reason for hiding this comment

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

the PR is fine, but please set up the github repo so only admin/maintainers can start the build, so approve the build started by external contributors, to protect malicious PR and workflow build

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enables building DocumentDB extension and gateway images using configurable upstream sources for personal testing.

Changes:

  • Adds workflow_dispatch inputs to override the DocumentDB release repo and gateway source image repo.
  • Updates workflow-level env vars to derive DOCUMENTDB_RELEASE_REPO and GATEWAY_SOURCE_IMAGE_REPO from those inputs.

Comment thread .github/workflows/build_documentdb_images.yml Outdated
Comment thread .github/workflows/build_documentdb_images.yml Outdated
@hossain-rayhan
Copy link
Copy Markdown
Collaborator Author

the PR is fine, but please set up the github repo so only admin/maintainers can start the build, so approve the build started by external contributors, to protect malicious PR and workflow build

Allowed to modify only the repo/image name, not the owner. Now fork owner can only run workflow with their fork image and same for documentdb official repo.

Copy link
Copy Markdown
Collaborator

@WentingWu666666 WentingWu666666 left a comment

Choose a reason for hiding this comment

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

Suggest taking full owner/repo paths as inputs instead of coupling to github.repository_owner

The current design always prepends ${{ github.repository_owner }} to user-supplied values, so the user can override the repo name but never the owner. That has a few problems:

  1. The defaults are only correct on the upstream repo. On any fork say acme/documentdb-kubernetes-operator the default documentdb_repo: documentdb resolves to acme/documentdb, which probably doesn''t exist. The input has a "default" that''s effectively wrong everywhere except documentdb/documentdb-kubernetes-operator.

  2. Common dev workflows break. A developer who forks only the operator and wants to build/test against the upstream documentdb/documentdb extension can''t they''re forced to also fork documentdb/documentdb into their org just to satisfy the owner coupling.

  3. It conflates three independent things into one knob: the operator repo owner, the extension repo owner, and the gateway image registry path. They aren''t the same concept and shouldn''t be tied together.

  4. The gateway_source_image framing is confusing. It''s described as "path under owner" but its default is documentdb/documentdb-local (itself a slash-separated path). When concatenated with owner you get a triple-segment ghcr path like ghcr.io/owner/documentdb/documentdb-local, which doesn''t match the "path under owner" mental model.

  5. The security framing for restricting owner is weak. This is a workflow_dispatch workflow only people with write access to the repo can run it. Letting them point at an arbitrary org/repo isn''t meaningfully more dangerous than letting them edit the workflow file.

Suggested change take full paths

inputs:
  documentdb_release_repo:
    description: ''GitHub owner/repo for DocumentDB extension releases''
    required: false
    default: ''documentdb/documentdb''
  gateway_source_image_repo:
    description: ''Full container image repo for the gateway source image (registry/owner/path)''
    required: false
    default: ''ghcr.io/documentdb/documentdb/documentdb-local''

env:
  DOCUMENTDB_RELEASE_REPO: ${{ github.event.inputs.documentdb_release_repo || ''documentdb/documentdb'' }}
  GATEWAY_SOURCE_IMAGE_REPO: ${{ github.event.inputs.gateway_source_image_repo || ''ghcr.io/documentdb/documentdb/documentdb-local'' }}

Benefits:

  • Defaults are correct on upstream and on any fork
  • Forks of just the operator can still build against upstream extension releases
  • The input names match what they actually contain (no hidden owner concatenation)
  • One knob per independent concept; no implicit coupling to github.repository_owner
  • The repository_dispatch trigger keeps working unchanged because the env defaults handle the case when no inputs are provided

Rayhan Hossain added 3 commits April 24, 2026 11:42
Signed-off-by: Rayhan Hossain <rhossain@microsoft.com>
Signed-off-by: Rayhan Hossain <rhossain@microsoft.com>
Signed-off-by: Rayhan Hossain <rhossain@microsoft.com>
@hossain-rayhan hossain-rayhan force-pushed the rayhan/build-with-custom-image branch from 6d49e26 to a07e44b Compare April 24, 2026 18:42
@hossain-rayhan
Copy link
Copy Markdown
Collaborator Author

@guanzhousongmicrosoft / @WentingWu666666, Lets go back to original full path repo/image. Its cleaner. I will work with @xgerman to setup strict rules on who can run the workflow. I don't have admin permission.
Thanks.

@documentdb-triage-tool documentdb-triage-tool Bot added the enhancement New feature or request label Apr 25, 2026
@documentdb-triage-tool
Copy link
Copy Markdown

🤖 Auto-triaged by documentdb-triage-tool.

Applied: enhancement
Project fields suggested: Component ci · Priority P3 · Effort S · Status Needs Review
Confidence: 0.65 (mixed)

Reasoning

component from path globs (ci); effort from diff stats (14+6 LOC, 1 files); LLM: Adds CI workflow support for building DocumentDB images from custom GitHub sources, primarily for personal/developer testing convenience.

If a label is wrong, remove it manually and ping @patty-chow so the rules can be tuned. The bot will not re-label items that already have component labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants