Skip to content
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

[release-3.11] hack: copy oc to kubectl #20958

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions hack/build-cross.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ if [[ "${OS_BUILD_RELEASE_ARCHIVES-}" != "n" ]]; then
os::build::release_sha
else
# Place binaries only
OS_BUILD_PLATFORMS=("${platforms[@]+"${platforms[@]}"}") \
os::build::place_bins "${OS_CROSS_COMPILE_BINARIES[@]}"
OS_BUILD_PLATFORMS=("${image_platforms[@]+"${image_platforms[@]}"}") \
os::build::place_bins "${OS_IMAGE_COMPILE_BINARIES[@]}"
OS_BUILD_PLATFORMS=("${platforms[@]+"${platforms[@]}"}")
os::build::place_bins "${OS_CROSS_COMPILE_BINARIES[@]}"
OS_BUILD_PLATFORMS=("${image_platforms[@]+"${image_platforms[@]}"}")
os::build::place_bins "${OS_IMAGE_COMPILE_BINARIES[@]}"
fi

if [[ "${OS_GIT_TREE_STATE:-dirty}" == "clean" ]]; then
Expand Down
18 changes: 13 additions & 5 deletions hack/lib/build/binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,18 @@ function os::build::place_bins() {
fi
done

# Link binaries that we want to link (eg. oc->kubectl)
local suffix=""
if [[ $platform == "windows/amd64" ]]; then
suffix=".exe"
fi
for linkname in "${OC_BINARY_COPY[@]}"; do
local src="${OS_OUTPUT_BINPATH}/${platform}/oc${suffix}"
if [[ -f "${src}" ]]; then
ln -f "$src" "${OS_OUTPUT_BINPATH}/${platform}/${linkname}${suffix}"
fi
done

# If no release archive was requested, we're done.
if [[ "${OS_RELEASE_ARCHIVE-}" == "" ]]; then
continue
Expand All @@ -342,14 +354,10 @@ function os::build::place_bins() {
done

# Create binary copies where specified.
local suffix=""
if [[ $platform == "windows/amd64" ]]; then
suffix=".exe"
fi
for linkname in "${OC_BINARY_COPY[@]}"; do
local src="${release_binpath}/oc${suffix}"
if [[ -f "${src}" ]]; then
ln "${release_binpath}/oc${suffix}" "${release_binpath}/${linkname}${suffix}"
cp -f "${release_binpath}/oc${suffix}" "${release_binpath}/${linkname}${suffix}"
fi
done

Expand Down