Skip to content

Commit

Permalink
Enable VCPKG_BINARY_SOURCES explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Nov 8, 2024
1 parent 6edf62e commit acf6b87
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 31 deletions.
4 changes: 3 additions & 1 deletion ci/docker/python-wheel-manylinux.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ RUN /arrow/ci/scripts/install_ccache.sh ${ccache} /usr/local
# Install vcpkg
ARG GITHUB_REPOSITORY_OWNER
ARG GITHUB_TOKEN
ARG VCPKG_BINARY_SOURCES
ARG vcpkg
COPY ci/vcpkg/*.patch \
ci/vcpkg/*linux*.cmake \
Expand All @@ -79,12 +80,13 @@ ARG build_type=release
ENV CMAKE_BUILD_TYPE=${build_type} \
GITHUB_REPOSITORY_OWNER="${GITHUB_REPOSITORY_OWNER}" \
GITHUB_TOKEN="${GITHUB_TOKEN}" \
VCPKG_BINARY_SOURCES="clear;nuget,GitHub,readwrite" \
VCPKG_BINARY_SOURCES="${VCPKG_BINARY_SOURCES}" \
VCPKG_DEFAULT_TRIPLET=${arch_short}-linux-static-${build_type} \
VCPKG_FEATURE_FLAGS="manifests" \
VCPKG_FORCE_SYSTEM_BINARIES=1 \
VCPKG_OVERLAY_TRIPLETS=/arrow/ci/vcpkg

# TODO: Use --mount=type=secret for GITHUB_TOKEN
RUN arrow/ci/scripts/install_vcpkg.sh ${VCPKG_ROOT} ${vcpkg}
ENV PATH="${PATH}:${VCPKG_ROOT}"

Expand Down
53 changes: 23 additions & 30 deletions ci/scripts/install_vcpkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,40 +53,33 @@ if [ -f "${vcpkg_ports_patch}" ]; then
echo "Patch successfully applied to the VCPKG port files!"
fi

if [ -n "${GITHUB_TOKEN:-}" ] && [ -n "${GITHUB_REPOSITORY_OWNER:-}" ]; then
can_use_nuget=yes
if [ -n "${GITHUB_TOKEN:-}" ] && \
[ -n "${GITHUB_REPOSITORY_OWNER:-}" ] && \
[ -n "${VCPKG_BINARY_SOURCES:-}" ] ; then
if type dnf 2>/dev/null; then
dnf install -y epel-release
if dnf info mono-complete 2>/dev/null; then
dnf install -y mono-complete
curl \
--location \
--output "${vcpkg_destination}/nuget" \
https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
else
# manylinux2014_aarch64 image doesn't have mono-complete in
# EPEL. It has Mono but it's old.
can_use_nuget=no
fi
dnf install -y mono-complete
curl \
--location \
--output "${vcpkg_destination}/nuget" \
https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
fi
if [ "${can_use_nuget}" = "yes" ]; then
PATH="${vcpkg_destination}:${PATH}"
nuget_url="https://nuget.pkg.github.com/${GITHUB_REPOSITORY_OWNER}/index.json"
nuget="$(vcpkg fetch nuget | tail -n 1)"
if type mono 2>/dev/null; then
nuget="mono ${nuget}"
fi
${nuget} \
sources add \
-source "${nuget_url}" \
-storepasswordincleartext \
-name "GitHub" \
-username "${GITHUB_REPOSITORY_OWNER}" \
-password "${GITHUB_TOKEN}"
${nuget} \
setapikey "${GITHUB_TOKEN}" \
-source "${nuget_url}"
PATH="${vcpkg_destination}:${PATH}"
nuget_url="https://nuget.pkg.github.com/${GITHUB_REPOSITORY_OWNER}/index.json"
nuget="$(vcpkg fetch nuget | tail -n 1)"
if type mono 2>/dev/null; then
nuget="mono ${nuget}"
fi
${nuget} \
sources add \
-source "${nuget_url}" \
-storepasswordincleartext \
-name "GitHub" \
-username "${GITHUB_REPOSITORY_OWNER}" \
-password "${GITHUB_TOKEN}"
${nuget} \
setapikey "${GITHUB_TOKEN}" \
-source "${nuget_url}"
fi

popd
6 changes: 6 additions & 0 deletions dev/tasks/java-jars/github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ jobs:
{{ macros.github_set_sccache_envvars()|indent(8) }}
GITHUB_TOKEN: {{ '${{ secrets.GITHUB_TOKEN }}' }}
run: |
if [ "${ARCH}" = "aarch_64" ]; then
# We can't use NuGet on manylinux2014_aarch64 because Mono is old.
:
else
export VCPKG_BINARY_SOURCES="clear;nuget,GitHub,readwrite"
fi
archery docker run \
-e ARROW_JAVA_BUILD=OFF \
-e ARROW_JAVA_TEST=OFF \
Expand Down
6 changes: 6 additions & 0 deletions dev/tasks/python-wheels/github.linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ jobs:
env:
GITHUB_TOKEN: {{ '${{ secrets.GITHUB_TOKEN }}' }}
run: |
if [ "{{ manylinux_version }}" = "2014" ] && [ "{{ arch }}" = "arm64" ]; then
# We can't use NuGet on manylinux2014_aarch64 because Mono is old.
:
else
export VCPKG_BINARY_SOURCES="clear;nuget,GitHub,readwrite"
fi
archery docker run \
-e SETUPTOOLS_SCM_PRETEND_VERSION={{ arrow.no_rc_version }} \
python-wheel-manylinux-{{ manylinux_version }}
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ x-vcpkg-build-args: &vcpkg-build-args
vcpkg: ${VCPKG}
GITHUB_REPOSITORY_OWNER:
GITHUB_TOKEN:
VCPKG_BINARY_SOURCES:

# CPU/memory limit presets to pass to Docker.
#
Expand Down

0 comments on commit acf6b87

Please sign in to comment.