Merge branch 'cloudflare:master' into tunnel-health

This commit is contained in:
Mads Jon Nielsen 2024-08-01 10:46:25 +02:00 committed by GitHub
commit bec84aeb7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 52 additions and 44 deletions

View File

@ -7,6 +7,12 @@ if [[ "$(uname)" != "Darwin" ]] ; then
exit 1 exit 1
fi fi
if [[ "amd64" != "${TARGET_ARCH}" && "arm64" != "${TARGET_ARCH}" ]]
then
echo "TARGET_ARCH must be amd64 or arm64"
exit 1
fi
go version go version
export GO111MODULE=on export GO111MODULE=on
@ -23,6 +29,8 @@ INSTALLER_CERT="installer.cer"
BUNDLE_ID="com.cloudflare.cloudflared" BUNDLE_ID="com.cloudflare.cloudflared"
SEC_DUP_MSG="security: SecKeychainItemImport: The specified item already exists in the keychain." SEC_DUP_MSG="security: SecKeychainItemImport: The specified item already exists in the keychain."
export PATH="$PATH:/usr/local/bin" export PATH="$PATH:/usr/local/bin"
FILENAME="$(pwd)/artifacts/cloudflared-darwin-$TARGET_ARCH.tgz"
PKGNAME="$(pwd)/artifacts/cloudflared-$TARGET_ARCH.pkg"
mkdir -p ../src/github.com/cloudflare/ mkdir -p ../src/github.com/cloudflare/
cp -r . ../src/github.com/cloudflare/cloudflared cp -r . ../src/github.com/cloudflare/cloudflared
cd ../src/github.com/cloudflare/cloudflared cd ../src/github.com/cloudflare/cloudflared
@ -137,56 +145,50 @@ fi
# cleanup the build directory because the previous execution might have failed without cleaning up. # cleanup the build directory because the previous execution might have failed without cleaning up.
rm -rf "${TARGET_DIRECTORY}" rm -rf "${TARGET_DIRECTORY}"
archs=("amd64" "arm64") export TARGET_OS="darwin"
export TARGET_OS=darwin GOCACHE="$PWD/../../../../" GOPATH="$PWD/../../../../" CGO_ENABLED=1 make cloudflared
for arch in ${archs[@]}; do
FILENAME="$(pwd)/artifacts/cloudflared-darwin-$arch.tgz" # sign the cloudflared binary
PKGNAME="$(pwd)/artifacts/cloudflared-$arch.pkg" if [[ ! -z "$CODE_SIGN_NAME" ]]; then
TARGET_ARCH=$arch GOCACHE="$PWD/../../../../" GOPATH="$PWD/../../../../" CGO_ENABLED=1 make cloudflared codesign -s "${CODE_SIGN_NAME}" -f -v --timestamp --options runtime ${BINARY_NAME}
# sign the cloudflared binary # notarize the binary
if [[ ! -z "$CODE_SIGN_NAME" ]]; then # TODO: TUN-5789
codesign -s "${CODE_SIGN_NAME}" -f -v --timestamp --options runtime ${BINARY_NAME} fi
# notarize the binary ARCH_TARGET_DIRECTORY="${TARGET_DIRECTORY}/${TARGET_ARCH}-build"
# TODO: TUN-5789 # creating build directory
fi rm -rf $ARCH_TARGET_DIRECTORY
mkdir -p "${ARCH_TARGET_DIRECTORY}"
mkdir -p "${ARCH_TARGET_DIRECTORY}/contents"
cp -r ".mac_resources/scripts" "${ARCH_TARGET_DIRECTORY}/scripts"
ARCH_TARGET_DIRECTORY="${TARGET_DIRECTORY}/${arch}-build" # copy cloudflared into the build directory
# creating build directory cp ${BINARY_NAME} "${ARCH_TARGET_DIRECTORY}/contents/${PRODUCT}"
rm -rf $ARCH_TARGET_DIRECTORY
mkdir -p "${ARCH_TARGET_DIRECTORY}"
mkdir -p "${ARCH_TARGET_DIRECTORY}/contents"
cp -r ".mac_resources/scripts" "${ARCH_TARGET_DIRECTORY}/scripts"
# copy cloudflared into the build directory # compress cloudflared into a tar and gzipped file
cp ${BINARY_NAME} "${ARCH_TARGET_DIRECTORY}/contents/${PRODUCT}" tar czf "$FILENAME" "${BINARY_NAME}"
# compress cloudflared into a tar and gzipped file # build the installer package
tar czf "$FILENAME" "${BINARY_NAME}" if [[ ! -z "$PKG_SIGN_NAME" ]]; then
pkgbuild --identifier com.cloudflare.${PRODUCT} \
--version ${VERSION} \
--scripts ${ARCH_TARGET_DIRECTORY}/scripts \
--root ${ARCH_TARGET_DIRECTORY}/contents \
--install-location /usr/local/bin \
--sign "${PKG_SIGN_NAME}" \
${PKGNAME}
# build the installer package # notarize the package
if [[ ! -z "$PKG_SIGN_NAME" ]]; then # TODO: TUN-5789
else
pkgbuild --identifier com.cloudflare.${PRODUCT} \ pkgbuild --identifier com.cloudflare.${PRODUCT} \
--version ${VERSION} \ --version ${VERSION} \
--scripts ${ARCH_TARGET_DIRECTORY}/scripts \ --scripts ${ARCH_TARGET_DIRECTORY}/scripts \
--root ${ARCH_TARGET_DIRECTORY}/contents \ --root ${ARCH_TARGET_DIRECTORY}/contents \
--install-location /usr/local/bin \ --install-location /usr/local/bin \
--sign "${PKG_SIGN_NAME}" \ ${PKGNAME}
${PKGNAME} fi
# notarize the package
# TODO: TUN-5789
else
pkgbuild --identifier com.cloudflare.${PRODUCT} \
--version ${VERSION} \
--scripts ${ARCH_TARGET_DIRECTORY}/scripts \
--root ${ARCH_TARGET_DIRECTORY}/contents \
--install-location /usr/local/bin \
${PKGNAME}
fi
done
# cleanup build directory because this script is not ran within containers, # cleanup build directory because this script is not ran within containers,
# which might lead to future issues in subsequent runs. # which might lead to future issues in subsequent runs.

View File

@ -1,3 +1,9 @@
2024.7.3
- 2024-07-31 TUN-8546: Fix final artifacts paths
2024.7.2
- 2024-07-17 TUN-8546: rework MacOS build script
2024.7.1 2024.7.1
- 2024-07-16 TUN-8543: use -p flag to create intermediate directories - 2024-07-16 TUN-8543: use -p flag to create intermediate directories