Skip to content

feat(connectors): ship connector plugins in the iggy-connect docker image - #3658

Open
kriti-sc wants to merge 11 commits into
apache:masterfrom
kriti-sc:#3614-add-connectors-to-docker-image
Open

feat(connectors): ship connector plugins in the iggy-connect docker image#3658
kriti-sc wants to merge 11 commits into
apache:masterfrom
kriti-sc:#3614-add-connectors-to-docker-image

Conversation

@kriti-sc

@kriti-sc kriti-sc commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Closes #3614

Rationale

Dynamically inject plugins to the apache/iggy-connect image to reduce friction for testing out connectors.

What changed?

This change publishes the image in two flavors:

Fat (edge, x.y.z, latest): the runtime plus every connector plugin baked into /usr/local/lib, which is already on the runtime's plugin search path. A config can load a bundled plugin by file name with no path. This is the new default.
Slim (edge-slim, x.y.z-slim, latest-slim): the runtime binary only, i.e. today's image, for deployments that bring their own plugins.

To this end:

  1. Single source of truth for the plugin set. scripts/ci/connector-plugins.sh derives the plugin list from cargo metadata (every cdylib under core/connectors/). The edge tarball build, the Docker fat stage, the license gate, and the release notes all consume it, so a newly added connector is picked up everywhere with no hand-edited list.
  2. Dockerfile. The planner derives the plugin set; cook and build compile the plugin cdylibs alongside the runtime; a new runtime-fat stage copies the .so files in. The slim runtime stage is unchanged.
  3. Publish pipeline. The docker-buildx action gained a target input, and components can declare flavors in publish.yml. Each flavor keeps its own per-arch digest artifacts so the manifest step never merges flavors into one image, and only the default flavor creates the git release tag.
  4. Licensing. The third-party license gate now validates the runtime plus every plugin dependency closure (derived list), so a new connector is license-validated on the PR that adds it. The fat image ships a LICENSE-binary-fat covering the plugins; slim keeps the runtime-only manifest.
  5. Edge gate. The connectors image now refreshes :edge on any change under core/connectors/.
  6. Docs. Connectors README documents the flavors and zero-config plugin loading with a docker run quickstart; edge release notes derive the plugin list.

Local Execution

  • Built images locally. The fat image is 357 MB, and the build took 20 mins on a 4 CPU/12 GB Docker VM. Slim image is 163 MB. This validates that image will build comfortably on Github CI runners which are 4 CPU/16 GB.
  • Pre-commit hooks ran.

AI Usage

  1. Which tools? (e.g., GitHub Copilot, Claude, ChatGPT) Claude
  2. Scope of usage? (e.g., autocomplete, generated functions, entire implementation) First developed the design and pass criteria. Then, generated functions and debugging with Claude.
  3. How did you verify the generated code works correctly? Built the image locally and checked if all plugins present in the image.
  4. Can you explain every line of the code if asked? Yes.

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 17.31%. Comparing base (3b190c1) to head (ddcf3f4).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@              Coverage Diff              @@
##             master    #3658       +/-   ##
=============================================
- Coverage     75.55%   17.31%   -58.24%     
  Complexity      969      969               
=============================================
  Files          1317     1315        -2     
  Lines        154895   133818    -21077     
  Branches     128520   107520    -21000     
=============================================
- Hits         117027    23175    -93852     
- Misses        34321   110128    +75807     
+ Partials       3547      515     -3032     
Components Coverage Δ
Rust Core 2.02% <ø> (-73.50%) ⬇️
Java SDK 62.71% <ø> (ø)
C# SDK 71.13% <ø> (-1.13%) ⬇️
Python SDK 92.27% <ø> (ø)
PHP SDK 84.52% <ø> (ø)
Node SDK 95.30% <ø> (+0.17%) ⬆️
Go SDK 43.08% <ø> (ø)
see 812 files with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kriti-sc kriti-sc changed the title #3614 add connectors to docker image feat(connectors): ship connector plugins in the iggy-connect docker image Jul 12, 2026
@kriti-sc
kriti-sc marked this pull request as ready for review July 19, 2026 18:18
@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Jul 19, 2026
@kriti-sc

Copy link
Copy Markdown
Contributor Author

/ready

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs.

If you need a review, please ensure CI is green and the PR is rebased on the latest master. Don't hesitate to ping the maintainers - either @core on Discord or by mentioning them directly here on the PR.

Thank you for your contribution!

@github-actions github-actions Bot added the S-stale Inactive issue or pull request label Jul 30, 2026
@github-actions github-actions Bot removed the S-stale Inactive issue or pull request label Jul 30, 2026
Comment on lines +95 to +105
PLUGIN_FLAGS="$(sed 's/^/-p /' connector-plugins.txt | tr '\n' ' ')" && \
if [ "$PROFILE" = "debug" ]; then PROFILE_DIR=debug; PROFILE_FLAG=""; else PROFILE_DIR=release; PROFILE_FLAG="--release"; fi && \
cargo zigbuild --locked --target ${RUST_TARGET} -p iggy-connectors $PLUGIN_FLAGS $PROFILE_FLAG && \
cp /app/target/${RUST_TARGET}/${PROFILE_DIR}/iggy-connectors /app/iggy-connectors && \
mkdir -p /app/plugins && \
while IFS= read -r name; do \
[ -z "$name" ] && continue; \
so_file="/app/target/${RUST_TARGET}/${PROFILE_DIR}/lib${name}.so"; \
if [ ! -f "$so_file" ]; then echo "expected plugin artifact missing: $so_file" >&2 && exit 1; fi; \
cp "$so_file" /app/plugins/; \
done < connector-plugins.txt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The plugin compilation lives in the shared builder stage, so the slim flavor pays for it too.

runtime (slim) copies /app/iggy-connectors and /app/LICENSE-binary out of builder. Both of those are produced by RUN layers that sit at or after this one, so --target runtime still executes this cargo zigbuild -p iggy-connectors $PLUGIN_FLAGS (17 cdylibs) and the license RUN below that also generates LICENSE-binary-fat. BuildKit cannot skip a layer that an earlier needed artifact depends on.

Net effect: the -slim build goes from a runtime-binary-only compile to roughly the full fat build time (~20 min per the PR description), plus a cargo-about pass over 18 dependency closures, and then discards all of it. With the matrix at flavors x arches that is two extra full plugin compiles per publish run.

Suggestion: keep builder producing only the runtime binary and LICENSE-binary, then add a stage that only the fat image consumes:

FROM builder AS plugin-builder
# cargo zigbuild ... $PLUGIN_FLAGS, collect /app/plugins, generate LICENSE-binary-fat

FROM runtime AS runtime-fat
COPY --from=plugin-builder /app/plugins/ /usr/local/lib/
COPY --from=plugin-builder /app/LICENSE-binary-fat /usr/share/doc/iggy-connect/LICENSE-binary

--target runtime then stops at builder and the slim image build is unchanged from today.

with:
context: ${{ steps.ctx.outputs.context }}
file: ${{ steps.config.outputs.dockerfile }}
target: ${{ inputs.target }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

target now changes the build graph, but the buildx cache ref is still only component- and arch-scoped, so the two flavors fight over one cache entry.

The cache composition step above builds cache-to / cache-from as type=registry,ref=${img}:buildcache-${arch},mode=max (and the shared ${shared_deps}:buildcache-${arch}) with no flavor component. Since docker_matrix is now component x flavor x platform, the fat and slim jobs for the same arch run concurrently and both push mode=max to apache/iggy-connect:buildcache-amd64. The cache index is last-writer-wins, so each run one flavor's cache export is effectively lost, and cache-from may pull an index describing the other flavor's graph.

Layer integrity is fine (BuildKit verifies digests), but the fat build is the expensive one and is exactly the one that needs a warm cache. ${img}:latest in cache-from is also the fat image under the new tag scheme, which the slim build will now pull as inline cache.

Suggestion: thread the flavor into the cache ref, e.g. pass the flavor suffix into this action and use ${img}:buildcache${suffix}-${arch}, so each flavor keeps its own cache the same way it now keeps its own digest artifacts.

Comment on lines +259 to +261
if [[ ! -f "$so_file" ]]; then
echo "::error::expected connector plugin artifact missing: ${so_file}. The plugin crate built no cdylib, or its name does not match lib<crate>.so." >&2
exit 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This turns a previously tolerated miss into a hard failure at the same time as the plugin set silently grows, so the first master push after merge is the first real exercise of the new set.

Old behaviour was [[ -f "$so_file" ]] && cp "$so_file" "${outdir}/", a soft skip. Combined with default: "" at line 49, the derived list goes from the 10 hardcoded crates to 17: clickhouse_sink, delta_sink, doris_sink, http_sink, influxdb_sink, influxdb_source, mongodb_sink are new here. Any of those that does not emit lib<crate>.so on x86_64-unknown-linux-gnu / aarch64-unknown-linux-gnu now fails the edge release rather than being skipped.

The hard failure is the right call, the concern is that it is unverified for the 7 additions. Per the PR description the local validation was the docker image build, which is a different job and a different build graph. timeout-minutes: 60 is also unchanged for what is now a 17-crate release build on the standard runners, and the tarball grows accordingly (delta/arrow, iceberg, mongodb, surrealdb closures).

Worth running the Connector plugins job on this branch before merge to confirm all 17 produce a cdylib on both targets and that it fits in the timeout.

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

Labels

S-waiting-on-review PR is waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: ship connector plugins in the apache/iggy-connect docker image

2 participants