From afa5e68fe5116b53144d9a81e67749dcb414bf2b Mon Sep 17 00:00:00 2001 From: Dalton Date: Thu, 17 Sep 2020 10:56:18 -0500 Subject: [PATCH] AUTH-3103 CI build fixes --- .teamcity/build-macos.sh | 26 ++++++++++++-------------- Makefile | 4 ++-- github_message.py | 2 +- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/.teamcity/build-macos.sh b/.teamcity/build-macos.sh index 124f0910..7f9fc3df 100755 --- a/.teamcity/build-macos.sh +++ b/.teamcity/build-macos.sh @@ -1,7 +1,5 @@ #!/bin/bash -#set -euo pipefail - if [[ "$(uname)" != "Darwin" ]] ; then echo "This should be run on macOS" exit 1 @@ -31,8 +29,8 @@ cd ../src/github.com/cloudflare/cloudflared GOCACHE="$PWD/../../../../" GOPATH="$PWD/../../../../" CGO_ENABLED=1 make cloudflared # Add code signing private key to the key chain -if [[ -n "${CFD_CODE_SIGN_KEY:-}" ]]; then - if [[ -n "${CFD_CODE_SIGN_PASS:-}" ]]; then +if [[ ! -z "$CFD_CODE_SIGN_KEY" ]]; then + if [[ ! -z "$CFD_CODE_SIGN_PASS" ]]; then # write private key to disk and then import it keychain echo -n -e ${CFD_CODE_SIGN_KEY} | base64 -D > ${CODE_SIGN_PRIV} out=$(security import ${CODE_SIGN_PRIV} -A -P "${CFD_CODE_SIGN_PASS}" 2>&1) @@ -52,7 +50,7 @@ if [[ -n "${CFD_CODE_SIGN_KEY:-}" ]]; then fi # Add code signing certificate to the key chain -if [[ -n "${CFD_CODE_SIGN_CERT:-}" ]]; then +if [[ ! -z "$CFD_CODE_SIGN_CERT" ]]; then # write certificate to disk and then import it keychain echo -n -e ${CFD_CODE_SIGN_CERT} | base64 -D > ${CODE_SIGN_CERT} out1=$(security import ${CODE_SIGN_CERT} -A 2>&1) @@ -73,8 +71,8 @@ if [[ -n "${CFD_CODE_SIGN_CERT:-}" ]]; then fi # Add package signing private key to the key chain -if [[ -n "${CFD_INSTALLER_KEY:-}" ]]; then - if [[ -n "${CFD_INSTALLER_PASS:-}" ]]; then +if [[ ! -z "$CFD_INSTALLER_KEY" ]]; then + if [[ ! -z "$CFD_INSTALLER_PASS" ]]; then # write private key to disk and then import it into the keychain echo -n -e ${CFD_INSTALLER_KEY} | base64 -D > ${INSTALLER_PRIV} out2=$(security import ${INSTALLER_PRIV} -A -P "${CFD_INSTALLER_PASS}" 2>&1) @@ -94,7 +92,7 @@ if [[ -n "${CFD_INSTALLER_KEY:-}" ]]; then fi # Add package signing certificate to the key chain -if [[ -n "${CFD_INSTALLER_CERT:-}" ]]; then +if [[ ! -z "$CFD_INSTALLER_CERT" ]]; then # write certificate to disk and then import it keychain echo -n -e ${CFD_INSTALLER_CERT} | base64 -D > ${INSTALLER_CERT} out3=$(security import ${INSTALLER_CERT} -A 2>&1) @@ -115,7 +113,7 @@ if [[ -n "${CFD_INSTALLER_CERT:-}" ]]; then fi # get the code signing certificate name -if [[ -n "${CFD_CODE_SIGN_NAME:-}" ]]; then +if [[ ! -z "$CFD_CODE_SIGN_NAME" ]]; then CODE_SIGN_NAME="${CFD_CODE_SIGN_NAME}" else if [[ -n "$(security find-certificate -c "Developer ID Application" | cut -d'"' -f 4 -s | grep "Developer ID Application:" | head -1)" ]]; then @@ -126,7 +124,7 @@ else fi # get the package signing certificate name -if [[ -n "${CFD_INSTALLER_NAME:-}" ]]; then +if [[ ! -z "$CFD_INSTALLER_NAME" ]]; then PKG_SIGN_NAME="${CFD_INSTALLER_NAME}" else if [[ -n "$(security find-certificate -c "Developer ID Installer" | cut -d'"' -f 4 -s | grep "Developer ID Installer:" | head -1)" ]]; then @@ -137,11 +135,11 @@ else fi # sign the cloudflared binary -if [[ -n "${CODE_SIGN_NAME:-}" ]]; then +if [[ ! -z "$CODE_SIGN_NAME" ]]; then codesign -s "${CODE_SIGN_NAME}" -f -v --timestamp --options runtime ${BINARY_NAME} # notarize the binary - if [[ -n "${CFD_NOTE_PASSWORD:-}" ]]; then + if [[ ! -z "$CFD_NOTE_PASSWORD" ]]; then zip "${BINARY_NAME}.zip" ${BINARY_NAME} xcrun altool --notarize-app -f "${BINARY_NAME}.zip" -t osx -u ${CFD_NOTE_USERNAME} -p ${CFD_NOTE_PASSWORD} --primary-bundle-id ${BUNDLE_ID} fi @@ -161,7 +159,7 @@ cp ${BINARY_NAME} "${TARGET_DIRECTORY}/contents/${PRODUCT}" tar czf "$FILENAME" "${BINARY_NAME}" # build the installer package -if [[ -n "${PKG_SIGN_NAME:-}" ]]; then +if [[ ! -z "$PKG_SIGN_NAME" ]]; then pkgbuild --identifier com.cloudflare.${PRODUCT} \ --version ${VERSION} \ --scripts ${TARGET_DIRECTORY}/scripts \ @@ -171,7 +169,7 @@ if [[ -n "${PKG_SIGN_NAME:-}" ]]; then ${PKGNAME} # notarize the package - if [[ -n "${CFD_NOTE_PASSWORD:-}" ]]; then + if [[ ! -z "$CFD_NOTE_PASSWORD" ]]; then xcrun altool --notarize-app -f ${PKGNAME} -t osx -u ${CFD_NOTE_USERNAME} -p ${CFD_NOTE_PASSWORD} --primary-bundle-id ${BUNDLE_ID} xcrun stapler staple ${PKGNAME} fi diff --git a/Makefile b/Makefile index 65664329..639658a2 100644 --- a/Makefile +++ b/Makefile @@ -148,8 +148,8 @@ github-message: .PHONY: github-mac-upload github-mac-upload: - python3 github_release.py --path .artifacts/cloudflared-darwin-amd64.tgz --release-version $(VERSION) --name cloudflared-darwin-amd64.tgz - python3 github_release.py --path .artifacts/cloudflared-amd64.pkg --release-version $(VERSION) --name cloudflared-amd64.pkg + python3 github_release.py --path artifacts/cloudflared-darwin-amd64.tgz --release-version $(VERSION) --name cloudflared-darwin-amd64.tgz + python3 github_release.py --path artifacts/cloudflared-amd64.pkg --release-version $(VERSION) --name cloudflared-amd64.pkg bin/equinox: mkdir -p bin diff --git a/github_message.py b/github_message.py index f420ac52..9fadd635 100644 --- a/github_message.py +++ b/github_message.py @@ -107,7 +107,7 @@ def main(): return # update the release body text - release.update_release(args.release_version, args.release_version, msg) + release.update_release(args.release_version, msg) except Exception as e: logging.exception(e)