Skip to content

CP-13581 linux-pkg: build windows-connector on-demand, caching result in Artifactory third-party-local instead of rebuilding every run - #407

Open
vimleshmishra wants to merge 1 commit into
developfrom
dlpx/pr/vimleshmishra/11095495-a4c1-407f-8957-f85b9e3d7ab9
Open

CP-13581 linux-pkg: build windows-connector on-demand, caching result in Artifactory third-party-local instead of rebuilding every run#407
vimleshmishra wants to merge 1 commit into
developfrom
dlpx/pr/vimleshmishra/11095495-a4c1-407f-8957-f85b9e3d7ab9

Conversation

@vimleshmishra

@vimleshmishra vimleshmishra commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

The windows-connector package is rebuilt from scratch on every linux-pkg pipeline run, even when its version (project.ext.connectorVersion in appliance/host/windows/build.gradle) hasn't changed since the last successful build. Unlike other linux-pkg packages, windows-connector's build toolchain (nsis/mono/mingw-w64) lives outside our own source and can drift independently of any windows-connector code change — rebuilding on every unrelated trigger risks silently shipping a different toolchain combination without anyone deciding to re-certify it. This also masks the underlying dependency-drift bug (see dlpx-app-gate#4648) — the failure only surfaces when a buildserver's live apt mirror happens to have moved out of sync with the previously-pinned Artifactory dependency zips.

Solution

Change config.sh's build() so the package is only rebuilt when its version changes, reusing existing linux-pkg infrastructure rather than adding anything new:

  • Look up windows-connector's own current latest post-push artifact via get_package_dependency_s3_url — the same lookup every linux-pkg package already uses to fetch its own build dependencies. This resolves correctly to snapshot-de-images for ongoing branches (develop/release/patch) and to the frozen, non-expiring release snapshot for hotfix/release-tag builds, with no special-casing needed here.
  • If windows-connector_<version>_all.deb already exists there, download and reuse it instead of rebuilding.
  • Otherwise, build it (gradlew build + createDebPackage) as before. No explicit upload is needed — the shared post-push Publish stage already syncs the result to S3 and updates latest for us, exactly like every other package.
  • The existence check fails soft: if the previous artifact (or its latest pointer) is ever missing for any reason, it just falls through to a normal build and republishes, rather than aborting.
  • Writes BUILD_STATUS (reused or built_fresh) into the artifacts directory, so the existing Slack build notification can report which path a given run took (follow-up devops-gate change, tracked separately).

This is a revision of the original approach in this PR, which used a bespoke release-de-images/windows-connector-cache/ path. That required no new credential either, but this version needs even less — no new S3 location at all, since it reuses infrastructure (snapshot-de-images's latest, kept alive indefinitely by the existing s3-artifact-refresh job) that already runs today for every package.

Testing Done

Tested end-to-end on real production Jenkins with the revised logic: build #1008 — version 2.3.0.0 already cached (build #935's artifact). Confirmed from the console log:

  • windows-connector 2.3.0.0 already built (latest); reusing it instead of rebuildingthe reuse branch was taken; gradlew build/createDebPackage did not run at all.
  • BUILD_STATUS was written and picked up by the Publish stage alongside the other build metadata files.
  • Artifact re-synced and republished normally as build #1008's latest.
  • Finished: SUCCESS.

Notes to Reviewers

No devops-gate or dlpx-app-gate changes are required for this PR to be safe to land — it only reads from infrastructure that already exists and is already running. Related, separately-tracked follow-ups:

  • dlpx-app-gate#4648: drop the pinned mono/mingw/nsis Artifactory zip, install those tools live from apt.
  • A git review pre-commit check (and/or CI check) in dlpx-app-gate requiring connectorVersion to be bumped whenever appliance/server/connector or appliance/host/windows source changes — without it, a merged windows-connector fix that forgets the version bump would be silently served from cache instead of shipping.
  • A small devops-gate change to surface BUILD_STATUS in the existing Slack build notification.

Tracked under epic CP-13579, alongside CP-13582 (app-gate).

@vimleshmishra
vimleshmishra force-pushed the dlpx/pr/vimleshmishra/11095495-a4c1-407f-8957-f85b9e3d7ab9 branch from f31f0e7 to d0a21e4 Compare August 5, 2026 14:03
@vimleshmishra
vimleshmishra marked this pull request as ready for review August 5, 2026 14:49
Comment thread packages/windows-connector/config.sh Outdated
Comment thread packages/windows-connector/config.sh Outdated
Comment thread packages/windows-connector/config.sh Outdated
@vimleshmishra
vimleshmishra force-pushed the dlpx/pr/vimleshmishra/11095495-a4c1-407f-8957-f85b9e3d7ab9 branch 3 times, most recently from be78e4c to f243840 Compare August 6, 2026 05:11
Comment thread packages/windows-connector/config.sh Outdated
Comment thread packages/windows-connector/config.sh Outdated
@vimleshmishra
vimleshmishra force-pushed the dlpx/pr/vimleshmishra/11095495-a4c1-407f-8957-f85b9e3d7ab9 branch from f243840 to 719b072 Compare August 7, 2026 05:01
@vimleshmishra
vimleshmishra force-pushed the dlpx/pr/vimleshmishra/11095495-a4c1-407f-8957-f85b9e3d7ab9 branch from 719b072 to 7ce82a9 Compare August 20, 2026 14:09
@vimleshmishra
vimleshmishra requested a review from sebroy August 20, 2026 14:27
Comment on lines +79 to +82
echo "windows-connector $version already built (latest); reusing it instead of rebuilding"
logmust cd "$WORKDIR/artifacts"
logmust aws s3 cp --only-show-errors "$latest_s3_url/$deb_name" .
reused=true

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 is not needed, and wastes s3 object space for nothing. The previously built package is already referenced by the "latest" combine-packages object, so there is no reason to have to copy that and call combine-packages again. IMO we should do nothing at all in this case. There is an explicit Jenkins build status to represent that something wasn't built ("NOT_BUILT"). That feels appropriate here. We should exit with some code that results in the build-package job ending as "NOT_BUILT".

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.

I agree.

@prakashsurya prakashsurya left a comment

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.

I agree with seb's latest comment..

IMO, if we really want to keep the post-push build trigger on the app-gate git repository, then I think this is overly complicated.. and really, we want a way to denote the build as "skipped".. instead of the S3 file manipulation.. and do nothing when it's skipped, as the prior artifact will already be preserved "forever"..

With that said, since we want to tightly control when we do rebuilds of the connector, I might suggest an even more simple approach.. and disable the post-push trigger entirely, and instead rely on folks to manually trigger new builds.. then, we can carefully control when we rebuild it, and tie that into w/e "recertification" process we currently have (correct me if this doesn't make sense, I'm unfamiliar with the current certification process that's mentioned in the PR description).. and the build script can just be simple like it is today, and always do a build..

To me, this feels awfully complicated for what essentially equates to "do nothing, if connector version hasn't changed".. there's no need to copy the S3 artifacts around..

Comment on lines +100 to +104
if [[ "$reused" == true ]]; then
echo "reused" >"$WORKDIR/artifacts/BUILD_STATUS"
else
echo "built_fresh" >"$WORKDIR/artifacts/BUILD_STATUS"
fi

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.

why does this matter? this essentially equates to it always being "reused", due to the cadence of app-gate pushes to connect version bumps.. regardless, what consumes this, and why?

feels overly complicated for no good reason, IMO..

Comment on lines +79 to +82
echo "windows-connector $version already built (latest); reusing it instead of rebuilding"
logmust cd "$WORKDIR/artifacts"
logmust aws s3 cp --only-show-errors "$latest_s3_url/$deb_name" .
reused=true

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.

I agree.

Comment on lines +93 to +97
#
# No explicit upload here -- the shared post-push Publish stage already
# syncs $WORKDIR/artifacts to S3 and updates "latest" for us, exactly
# like every other linux-pkg package.
#

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.

unnecessary comment, this is core behavior provided by the linux-pkg infra, and relied on by every package.. don't think it needs a package specific comment.

local version
version=$(grep "project.ext.connectorVersion" "$INSTALLER_DIR/build.gradle" |
sed -E "s/.*'([^']+)'.*/\1/")
local deb_name="windows-connector_${version}_all.deb"

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 assumes a rebuild will produce an artifact of this specific filename.. without actually controlling it here.. IMO, that coupling is fragile, as the filename can change in the app-gate repo, and this repo would then not behave properly (e.g. it'd start to rebuild when we don't want it to)..

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants