Skip to content

Commit 11254bb

Browse files
authored
Notarize ddev for macOS Catalina (ddev#2015)
1 parent 93cb8f8 commit 11254bb

File tree

6 files changed

+61
-59
lines changed

6 files changed

+61
-59
lines changed

.circleci/config.yml

+26-28
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ jobs:
7373
at: ~/
7474
- restore_cache:
7575
keys:
76-
- homebrew-macos-v13
76+
- homebrew-macos-v14
7777
# Run the built-in ddev tests with the executables just built.
7878
- run:
7979
command: ./.circleci/macos_circle_vm_setup.sh
8080
name: macOS Circle VM setup - tools, docker, golang
8181
# Now build using the regular ddev-only technique - this results in a fully clean set of executables.
8282
- save_cache:
83-
key: homebrew-macos-v13
83+
key: homebrew-macos-v14
8484
paths:
8585
- /usr/local/Homebrew
8686
- /usr/local/Cellar
@@ -105,7 +105,7 @@ jobs:
105105
at: ~/
106106
- restore_cache:
107107
keys:
108-
- homebrew-macos-v13
108+
- homebrew-macos-v14
109109
# Run the built-in ddev tests with the executables just built.
110110
- run:
111111
command: ./.circleci/macos_circle_vm_setup.sh
@@ -118,15 +118,15 @@ jobs:
118118
- store_test_results:
119119
path: /tmp/testresults
120120
- save_cache:
121-
key: homebrew-macos-v13
121+
key: homebrew-macos-v14
122122
paths:
123123
- /usr/local/Homebrew
124124
- /usr/local/Cellar
125125
- ~/Library/Caches/Homebrew
126126

127127
mac_nfsmount_test:
128128
macos:
129-
xcode: "11.0.0"
129+
xcode: "11.3.0"
130130
working_directory: ~/ddev
131131
environment:
132132
DDEV_TEST_USE_NFSMOUNT: "true"
@@ -137,13 +137,13 @@ jobs:
137137
at: ~/
138138
- restore_cache:
139139
keys:
140-
- homebrew-macos-v13
140+
- homebrew-macos-v14
141141
# Run the built-in ddev tests with the executables just built.
142142
- run:
143143
command: ./.circleci/macos_circle_vm_setup.sh
144144
name: macOS Circle VM setup - tools, docker, golang
145145
- save_cache:
146-
key: homebrew-macos-v13
146+
key: homebrew-macos-v14
147147
paths:
148148
- /usr/local/Homebrew
149149
- /usr/local/Cellar
@@ -255,7 +255,6 @@ jobs:
255255
image: ubuntu-1604:201903-01
256256
working_directory: ~/ddev
257257
environment:
258-
ARTIFACTS: /artifacts
259258
steps:
260259
- checkout
261260
- run: sudo mkdir /home/linuxbrew && sudo chown $(id -u) /home/linuxbrew
@@ -305,18 +304,18 @@ jobs:
305304

306305
mac_container_test:
307306
macos:
308-
xcode: "11.0.0"
307+
xcode: "11.3.0"
309308
working_directory: ~/ddev
310309
steps:
311310
- checkout
312311
- restore_cache:
313312
keys:
314-
- homebrew-macos-v13
313+
- homebrew-macos-v14
315314
- run:
316315
command: ./.circleci/macos_circle_vm_setup.sh
317316
name: macOS Circle VM setup - tools, docker, golang
318317
- save_cache:
319-
key: homebrew-macos-v13
318+
key: homebrew-macos-v14
320319
paths:
321320
- /usr/local/Homebrew
322321
- /usr/local/Cellar
@@ -337,8 +336,6 @@ jobs:
337336
machine:
338337
image: ubuntu-1604:201903-01
339338
working_directory: ~/ddev
340-
environment:
341-
ARTIFACTS: /artifacts
342339
steps:
343340
- run: sudo mkdir /home/linuxbrew && sudo chown $(id -u) /home/linuxbrew
344341
- restore_cache:
@@ -347,15 +344,15 @@ jobs:
347344
- attach_workspace:
348345
at: ~/
349346
- run:
350-
command: ./.circleci/generate_artifacts.sh $ARTIFACTS ${BUILD_IMAGE_TARBALLS:false}
347+
command: ./.circleci/generate_artifacts.sh ~/artifacts ${BUILD_IMAGE_TARBALLS:false}
351348
name: tar/zip up artifacts and make hashes
352349
no_output_timeout: "40m"
353350
- save_cache:
354351
key: homebrew-linux-v9
355352
paths:
356353
- /home/linuxbrew
357354
- store_artifacts:
358-
path: /artifacts
355+
path: ~/artifacts
359356
name: Artifact storage
360357

361358
# 'tag_build' automatically builds a tag .
@@ -365,7 +362,6 @@ jobs:
365362
working_directory: ~/ddev
366363
environment:
367364
DDEV_DEBUG: "true"
368-
ARTIFACTS: /artifacts
369365
steps:
370366
- checkout
371367
- run: sudo mkdir /home/linuxbrew && sudo chown $(id -u) /home/linuxbrew
@@ -388,44 +384,46 @@ jobs:
388384
# We only build the xz version of the docker images on tag build.
389385
- run:
390386
# Do not build the docker tarballs at simple tag build time
391-
command: ./.circleci/generate_artifacts.sh $ARTIFACTS false false
387+
command: ./.circleci/generate_artifacts.sh ~/artifacts false false
392388
name: tar/zip up artifacts and make hashes
393389
no_output_timeout: "40m"
394390

395391
- store_artifacts:
396-
path: /artifacts
392+
path: ~/artifacts
397393
name: Artifact storage
398394

399395
# 'release_build' is used to push a full release; it's triggered by api call
400396
release_build:
401397
macos:
402-
xcode: "11.0.0"
398+
xcode: "11.3.0"
403399
working_directory: ~/ddev
404400
environment:
405401
DDEV_DEBUG: "true"
406-
ARTIFACTS: /artifacts
407402
steps:
408403
- checkout
409404
- restore_cache:
410405
keys:
411-
- homebrew-macos-v13
406+
- homebrew-macos-v14
412407
- run:
413408
command: ./.circleci/macos_circle_vm_setup.sh
414-
name: RELEASE BUILD Circle VM setup
409+
name: RELEASE BUILD (macOS) Circle VM setup
415410
- save_cache:
416-
key: homebrew-macos-v13
411+
key: homebrew-macos-v14
417412
paths:
418413
- /usr/local/Homebrew
419414
- /usr/local/Cellar
420415
- ~/Library/Caches/Homebrew
421416

422417
- run:
423-
command: make -s clean linux darwin_signed windows_install chocolatey
424-
name: Build the ddev executables
418+
command: make -s clean linux windows_install chocolatey
419+
420+
- run:
421+
command: make -s darwin_notarized
422+
no_output_timeout: 30m
425423

426424
# We only build the xz version of the docker images on tag build.
427425
- run:
428-
command: ./.circleci/generate_artifacts.sh $ARTIFACTS ${BUILD_IMAGE_TARBALLS:true}
426+
command: ./.circleci/generate_artifacts.sh ~/artifacts ${BUILD_IMAGE_TARBALLS:true}
429427
name: tar/zip up artifacts and make hashes
430428
no_output_timeout: "40m"
431429

@@ -441,13 +439,13 @@ jobs:
441439
-u $CIRCLE_PROJECT_USERNAME \
442440
-b "$(cat ./.github/RELEASE_NOTES_TEMPLATE.md)" \
443441
-t $GITHUB_TOKEN \
444-
"${version}" $ARTIFACTS
442+
"${version}" ~/artifacts
445443
else
446444
echo "GITHUB_TOKEN not provided, not pushing release $CIRCLE_TAG"
447445
fi
448446
name: Upload artifacts to GitHub release page
449447
- store_artifacts:
450-
path: /artifacts
448+
path: ~/artifacts
451449
name: Artifact storage
452450
# When fixed, this will have to be done after push to github, so it can use
453451
# the real github release artifact.

.circleci/linux_circle_vm_setup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ nvm use 10
2828
npm install --global markdownlint-cli
2929
markdownlint --version
3030
# readthedocs has ancient version of mkdocs in it.
31-
pip3 install mkdocs==0.17.5
31+
pip3 install yq mkdocs==0.17.5
3232

3333
# Get the Stubs and Plugins for makensis; the linux makensis build doesn't do this.
3434
wget https://sourceforge.net/projects/nsis/files/NSIS%203/3.04/nsis-3.04.zip/download && sudo unzip -o -d /usr/local/share download && sudo mv /usr/local/share/nsis-3.04 /usr/local/share/nsis

.circleci/macos_circle_vm_setup.sh

+7-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ DOCKER_URL=https://download.docker.com/mac/stable/31259/Docker.dmg
88
curl -O -sSL $DOCKER_URL
99
open -W Docker.dmg && cp -r /Volumes/Docker/Docker.app /Applications
1010

11-
# Basic tools
12-
brew update >/dev/null 2>/dev/null
11+
export HOMEBREW_NO_AUTO_UPDATE=1
1312

1413
# Get docker in first so we can install it and work on other things
1514
brew cask install ngrok
@@ -20,10 +19,12 @@ nohup /Applications/Docker.app/Contents/MacOS/Docker --unattended &
2019
brew tap drud/ddev
2120
brew unlink python@2 || true
2221

23-
brew install mysql-client zip makensis jq expect coreutils golang ddev mkcert osslsigncode ghr
24-
brew link mysql-client zip makensis jq expect coreutils golang ddev mkcert osslsigncode ghr
22+
brew install mysql-client zip makensis jq expect coreutils golang ddev mkcert osslsigncode ghr gnu-getopt
23+
brew link mysql-client zip makensis jq expect coreutils golang ddev mkcert osslsigncode ghr gnu-getopt
2524

2625
brew link --force mysql-client
26+
# These links are required for osslsigncode to work
27+
brew link libgsf glib pcre
2728

2829
# Get the Plugins for NSIS
2930
curl -fsSL -o /tmp/EnVar-Plugin.zip https://github.com/GsNSIS/EnVar/releases/latest/download/EnVar-Plugin.zip && sudo unzip -o -d /usr/local/share/nsis /tmp/EnVar-Plugin.zip
@@ -34,6 +35,8 @@ mkdir -p /usr/local/etc/my.cnf.d
3435

3536
mkcert -install
3637

38+
pip3 install yq
39+
3740
curl -fsSL -o /tmp/gotestsum.tgz https://github.com/gotestyourself/gotestsum/releases/download/v0.3.2/gotestsum_0.3.2_darwin_amd64.tar.gz && tar -C /usr/local/bin -zxf /tmp/gotestsum.tgz gotestsum
3841

3942
# gotestsum

.circleci/trigger_release.sh

+18-16
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22

3-
# trigger_release.sh --release-tag=v1.x.1 --circleci-token=token --github-token=githubPersonalToken --windows-signing-password=windowspass
3+
# .circleci/trigger_release.sh x --release-tag="v1.12.0-20" --circleci-token=circletoken --build-image-tarballs=false --windows-signing-password=winsignpasswd --macos-signing-password=macsigningpwd --macos-app-password="macapppwd"
44

5-
# .circleci/trigger_release.sh --release-tag=v1.7.1 --circleci-token=circleToken900908b3443ea58316baf928b --github-token=githubPersonalToken853ae6f72c40525cd21036f742904a --windows-signing-password=windowscodepassword | jq -r 'del(.circle_yml)' | jq -r 'del(.circle_yml)'
5+
# .circleci/trigger_release.sh --release-tag=v1.11.1 --circleci-token=circletoken --github-token=githubtoken --build-image-tarballs=true --windows-signing-password=winsignpwd —macos-signing-password=macsignpwd —macos_app_password=macapppwd | jq -r 'del(.circle_yml)'
66

77
# api docs: https://circleci.com/docs/api
88
# Trigger a new job: https://circleci.com/docs/api/v1-reference/#new-build
@@ -27,53 +27,55 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
2727
exit 1
2828
fi
2929

30+
LONGOPTS=circleci-token:,github-token:,release-tag:,github-project:,windows-signing-password:,macos-signing-password:,build-image-tarballs:,chocolatey-api-key:,github-org:,macos-app-password:
3031

31-
OPTIONS=c:g:r:p:s:b:h:o:m:
32-
LONGOPTS=circleci-token:,github-token:,release-tag:,github-project:,windows-signing-password:,macos-signing-password:,build-image-tarballs:,chocolatey-api-key:,github-org:
33-
34-
! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")
32+
! PARSED=$(getopt --longoptions=$LONGOPTS --name "$0" -- "$@")
3533
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
3634
# e.g. return value is 1
3735
# then getopt has complained about wrong arguments to stdout
3836
printf "\n\nFailed parsing options:\n"
39-
getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@"
37+
getopt --longoptions=$LONGOPTS --name "$0" -- "$@"
4038
exit 2
4139
fi
4240

4341
eval set -- "$PARSED"
4442

4543
while true; do
4644
case "$1" in
47-
-c|--circleci-token)
45+
--circleci-token)
4846
CIRCLE_TOKEN=$2
4947
shift 2
5048
;;
51-
-g|--github-token)
49+
--github-token)
5250
GITHUB_TOKEN=$2
5351
shift 2
5452
;;
55-
-t|--release-tag)
53+
--release-tag)
5654
RELEASE_TAG=$2
5755
shift 2
5856
;;
59-
-p|--github-project)
57+
--github-project)
6058
GITHUB_PROJECT=$2
6159
shift 2
6260
;;
63-
-s|--windows-signing-password)
61+
--windows-signing-password)
6462
DDEV_WINDOWS_SIGNING_PASSWORD=$2
6563
shift 2
6664
;;
67-
-h|--chocolatey-api-key)
65+
--chocolatey-api-key)
6866
CHOCOLATEY_API_KEY=$2
6967
shift 2
7068
;;
71-
-m|--macos-signing-password)
69+
--macos-signing-password)
7270
DDEV_MACOS_SIGNING_PASSWORD=$2
7371
shift 2
7472
;;
73+
--macos-app-password)
74+
DDEV_MACOS_APP_PASSWORD=$2
75+
shift 2
76+
;;
7577
# For debugging we can set BUILD_IMAGE_TARBALLS=false to avoid waiting for that.
76-
-b|--build-image-tarballs)
78+
--build-image-tarballs)
7779
BUILD_IMAGE_TARBALLS=$2
7880
shift 2
7981
;;
@@ -90,7 +92,7 @@ done
9092
trigger_build_url=https://circleci.com/api/v1.1/project/github/$GITHUB_PROJECT?circle-token=${CIRCLE_TOKEN}
9193

9294
set -x
93-
BUILD_PARAMS="\"CIRCLE_JOB\": \"release_build\", \"job_name\": \"release_build\", \"GITHUB_TOKEN\":\"${GITHUB_TOKEN:-}\", \"RELEASE_TAG\": \"${RELEASE_TAG}\",\"DDEV_WINDOWS_SIGNING_PASSWORD\":\"${DDEV_WINDOWS_SIGNING_PASSWORD:-}\",\"DDEV_MACOS_SIGNING_PASSWORD\":\"${DDEV_MACOS_SIGNING_PASSWORD:-}\",\"CHOCOLATEY_API_KEY\":\"${CHOCOLATEY_API_KEY:-}\",\"BUILD_IMAGE_TARBALLS\":\"${BUILD_IMAGE_TARBALLS:-true}\",\"GITHUB_ORG\":\"${GITHUB_ORG}\""
95+
BUILD_PARAMS="\"CIRCLE_JOB\": \"release_build\", \"job_name\": \"release_build\", \"GITHUB_TOKEN\":\"${GITHUB_TOKEN:-}\", \"RELEASE_TAG\": \"${RELEASE_TAG}\",\"DDEV_WINDOWS_SIGNING_PASSWORD\":\"${DDEV_WINDOWS_SIGNING_PASSWORD:-}\",\"DDEV_MACOS_SIGNING_PASSWORD\":\"${DDEV_MACOS_SIGNING_PASSWORD:-}\",\"DDEV_MACOS_APP_PASSWORD\":\"${DDEV_MACOS_APP_PASSWORD:-}\",\"CHOCOLATEY_API_KEY\":\"${CHOCOLATEY_API_KEY:-}\",\"BUILD_IMAGE_TARBALLS\":\"${BUILD_IMAGE_TARBALLS:-true}\",\"GITHUB_ORG\":\"${GITHUB_ORG}\""
9496
if [ "${RELEASE_TAG:-}" != "" ]; then
9597
DATA="\"tag\": \"$RELEASE_TAG\","
9698
fi

Makefile

+9-10
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ include build-tools/makefile_components/base_build_go.mak
7777
#include build-tools/makefile_components/base_test_go.mak
7878
#include build-tools/makefile_components/base_test_python.mak
7979

80-
.PHONY: test testcmd testpkg build setup staticrequired windows_install darwin_signed markdownlint mkdocs
80+
.PHONY: test testcmd testpkg build setup staticrequired windows_install darwin_signed darwin_notarized markdownlint mkdocs
8181

8282
TESTOS = $(shell uname -s | tr '[:upper:]' '[:lower:]')
8383

@@ -129,17 +129,16 @@ mkdocs:
129129

130130
darwin_signed: darwin
131131
@if [ -z "$(DDEV_MACOS_SIGNING_PASSWORD)" ] ; then echo "Skipping signing ddev for macOS, no DDEV_MACOS_SIGNING_PASSWORD provided"; else echo "Signing macOS ddev..."; \
132-
security create-keychain -p "$(DDEV_MACOS_SIGNING_PASSWORD)" buildagent; \
133-
security list-keychains -s buildagent; \
134-
security unlock-keychain -p "$(DDEV_MACOS_SIGNING_PASSWORD)" buildagent; \
135-
security default-keychain -s buildagent; \
136-
security import certfiles/macos_ddev_cert.p12 -k buildagent -P "$(DDEV_MACOS_SIGNING_PASSWORD)" -T /usr/bin/codesign >/dev/null ; \
137-
security set-key-partition-list -S apple-tool:,apple: -s -k "$(DDEV_MACOS_SIGNING_PASSWORD)" buildagent >/dev/null ; \
138-
codesign --keychain buildagent -s "Apple Distribution: DRUD Technology, LLC (3BAN66AG5M)" $(GOTMP)/bin/darwin_amd64/ddev ; \
139-
security delete-keychain buildagent ; \
140-
codesign -v $(GOTMP)/bin/darwin_amd64/ddev ; \
132+
set -o errexit pipefail; \
133+
curl -s https://raw.githubusercontent.com/drud/signing_tools/master/macos_sign.sh | bash -s - --signing-password="$(DDEV_MACOS_SIGNING_PASSWORD)" --cert-file=certfiles/ddev_developer_id_cert.p12 --cert-name="Developer ID Application: DRUD Technology, LLC (3BAN66AG5M)" --target-binary="$(GOTMP)/bin/darwin_amd64/ddev" ; \
141134
fi
142135

136+
darwin_notarized: darwin_signed
137+
@if [ -z "$(DDEV_MACOS_APP_PASSWORD)" ]; then echo "Skipping notarizing ddev for macOS, no DDEV_MACOS_APP_PASSWORD provided"; else \
138+
set -o errexit pipefail; \
139+
echo "Notarizing macOS ddev..." ; \
140+
curl -s https://raw.githubusercontent.com/drud/signing_tools/master/macos_notarize.sh | bash -s - --app-specific-password=${DDEV_MACOS_APP_PASSWORD} --apple-id=accounts@drud.com --primary-bundle-id=com.ddev.ddev --target-binary="$(PWD)/$(GOTMP)/bin/darwin_amd64/ddev" ; \
141+
fi
143142

144143
$(GOTMP)/bin/windows_amd64/ddev.exe: windows
145144

certfiles/ddev_developer_id_cert.p12

3.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)