-
Notifications
You must be signed in to change notification settings - Fork 33
CP-13581 linux-pkg: skip rebuilding windows-connector when its cached artifact is already up to date #407
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
base: develop
Are you sure you want to change the base?
CP-13581 linux-pkg: skip rebuilding windows-connector when its cached artifact is already up to date #407
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Copyright 2025 Delphix | ||
| # Copyright 2025, 2026 Delphix | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
|
|
@@ -24,12 +24,51 @@ function prepare() { | |
| openjdk-17-jdk-headless | ||
| } | ||
|
|
||
| # | ||
| # Rebuilding windows-connector is expensive, so skip it unless connectorDebVersion | ||
| # (bumped whenever the connector source changes; independent of connectorVersion, | ||
| # which is bumped once per release) has no matching artifact yet. Reuses the same | ||
| # "latest" artifact lookup every package already uses for its build dependencies; | ||
| # fails soft (falls through to a real build) if nothing is found there. | ||
| # | ||
| function build() { | ||
| CONNECTOR_DIR="${WORKDIR}/repo/appliance/server/connector" | ||
| INSTALLER_DIR="${WORKDIR}/repo/appliance/host/windows" | ||
|
|
||
| local version | ||
| version=$(grep "project.ext.connectorDebVersion" "$INSTALLER_DIR/build.gradle" | | ||
| sed -E "s/.*'([^']+)'.*/\1/") | ||
| local deb_name="windows-connector_${version}_all.deb" | ||
|
vimleshmishra marked this conversation as resolved.
|
||
|
|
||
| # Subshell so a missing "latest" pointer (get_package_dependency_s3_url | ||
| # calls die/exit) only aborts this lookup, not the whole build. | ||
| local latest_s3_url | ||
| latest_s3_url=$( | ||
| get_package_dependency_s3_url "windows-connector" 1>&2 | ||
| printf '%s' "$_RET" | ||
| ) | ||
|
|
||
| if [[ -n "$latest_s3_url" ]]; then | ||
| local bucket="${latest_s3_url#s3://}" | ||
| bucket="${bucket%%/*}" | ||
| local key="${latest_s3_url#s3://"$bucket"/}" | ||
|
|
||
| if aws s3api head-object --bucket "$bucket" --key "$key/$deb_name" >/dev/null 2>&1; then | ||
| echo "windows-connector $version already built (latest); nothing to do" | ||
| # | ||
| # Marker file, not a special exit code: the Jenkins pipeline checks for | ||
| # this file's existence to set a NOT_BUILT result instead of relying on | ||
| # a distinguished exit code from this stage. | ||
| # | ||
| touch "$WORKDIR/artifacts/.build_skipped" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be done through an official contract/interface rather than a windows-connector one-off. The other issue here is that by the time |
||
| return 0 | ||
| fi | ||
| fi | ||
|
|
||
| echo "No reusable artifact found for windows-connector $version; building from source" | ||
| logmust cd "$CONNECTOR_DIR" | ||
| logmust sudo ../../gradlew build | ||
| logmust cd "$INSTALLER_DIR" | ||
| logmust sudo ../../gradlew createDebPackage | ||
| logmust sudo mv ./build/distributions/*deb "$WORKDIR/artifacts/" | ||
| logmust sudo mv ./build/distributions/*.deb "$WORKDIR/artifacts/" | ||
| } | ||
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.
need error handling