Skip to content

Commit 3018857

Browse files
Update CircleCI config to sign MacOS binaries (#137)
* Sign MacOS builds * Move build-and-deploy to separate steps * Don't run build when its not a release * Use v2.1 of circleci * Fix build args
1 parent 623b16b commit 3018857

File tree

3 files changed

+106
-16
lines changed

3 files changed

+106
-16
lines changed

.circleci/config.yml

Lines changed: 68 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
defaults: &defaults
2-
docker:
3-
- image: 087285199408.dkr.ecr.us-east-1.amazonaws.com/circle-ci-test-image-base:go1.18-tf1.4-tg39.1-pck1.8-ci50.7
4-
environment:
1+
env: &env
2+
environment:
53
TERRATEST_LOG_PARSER_VERSION: NONE
64
TERRAFORM_VERSION: NONE
75
TERRAGRUNT_VERSION: NONE
86
PACKER_VERSION: NONE
9-
GRUNTWORK_INSTALLER_VERSION: v0.0.35
10-
MODULE_CI_VERSION: v0.33.1
7+
GRUNTWORK_INSTALLER_VERSION: v0.0.39
8+
MODULE_CI_VERSION: v0.52.6
119
GOLANG_VERSION: 1.18
1210
GO111MODULE: auto
1311
CGO_ENABLED: 1
12+
defaults: &defaults
13+
docker:
14+
- image: 087285199408.dkr.ecr.us-east-1.amazonaws.com/circle-ci-test-image-base:go1.18-tf1.4-tg39.1-pck1.8-ci50.7
15+
<<: *env
1416
install_gruntwork_utils: &install_gruntwork_utils
1517
name: Install gruntwork utils
1618
command: |
@@ -20,8 +22,10 @@ install_gruntwork_utils: &install_gruntwork_utils
2022
--terraform-version ${TERRAFORM_VERSION} \
2123
--terragrunt-version ${TERRAGRUNT_VERSION} \
2224
--packer-version ${PACKER_VERSION} \
23-
--go-version ${GOLANG_VERSION}
24-
version: 2
25+
--go-version ${GOLANG_VERSION}
26+
orbs:
27+
go: circleci/[email protected]
28+
version: 2.1
2529
jobs:
2630
pre-commit:
2731
<<: *defaults
@@ -48,15 +52,51 @@ jobs:
4852
command: run-go-tests --timeout 5m
4953
no_output_timeout: 45m
5054
when: always
51-
build-and-deploy:
55+
build:
56+
resource_class: large
5257
<<: *defaults
5358
steps:
5459
- checkout
55-
- run:
56-
<<: *install_gruntwork_utils
57-
- run: build-go-binaries --app-name git-xargs --src-path ./ --dest-path bin --ld-flags "-X main.VERSION=$CIRCLE_TAG"
58-
- run: cd bin && sha256sum * > SHA256SUMS
59-
- run: upload-github-release-assets bin/*
60+
- run: build-go-binaries --app-name git-xargs --dest-path bin --ld-flags "-X main.VERSION=$CIRCLE_TAG"
61+
- persist_to_workspace:
62+
root: .
63+
paths: bin
64+
deploy:
65+
<<: *env
66+
macos:
67+
xcode: 14.2.0
68+
resource_class: macos.x86.medium.gen2
69+
steps:
70+
- checkout
71+
- attach_workspace:
72+
at: .
73+
- go/install:
74+
version: "1.20.5"
75+
- run:
76+
name: Install sign-binary-helpers
77+
command: |
78+
curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version "${GRUNTWORK_INSTALLER_VERSION}"
79+
gruntwork-install --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "${MODULE_CI_VERSION}"
80+
gruntwork-install --module-name "sign-binary-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "${MODULE_CI_VERSION}"
81+
- run:
82+
name: Compile and sign the binaries
83+
command: |
84+
sign-binary --install-macos-sign-dependencies --os mac .gon_amd64.hcl
85+
sign-binary --os mac .gon_arm64.hcl
86+
echo "Done signing the binary"
87+
88+
# Replace the files in bin. These are the same file names generated from .gon_amd64.hcl and .gon_arm64.hcl
89+
unzip git-xargs_darwin_amd64.zip
90+
mv git-xargs_darwin_amd64 bin/
91+
92+
unzip git-xargs_darwin_arm64.zip
93+
mv git-xargs_darwin_arm64 bin/
94+
- run:
95+
name: Run SHA256SUM
96+
command: |
97+
brew install coreutils
98+
cd bin && sha256sum * > SHA256SUMS
99+
- run: upload-github-release-assets bin/*
60100
workflows:
61101
version: 2
62102
build-and-test:
@@ -77,14 +117,26 @@ workflows:
77117
context:
78118
- AWS__PHXDEVOPS__circle-ci-test
79119
- GITHUB__PAT__gruntwork-ci
80-
- build-and-deploy:
120+
- build:
81121
requires:
82122
- test
83123
filters:
84124
tags:
85125
only: /^v.*/
86-
branches:
126+
branches:
127+
ignore: /.*/
128+
context:
129+
- AWS__PHXDEVOPS__circle-ci-test
130+
- GITHUB__PAT__gruntwork-ci
131+
- deploy:
132+
requires:
133+
- build
134+
filters:
135+
tags:
136+
only: /^v.*/
137+
branches:
87138
ignore: /.*/
88139
context:
89140
- AWS__PHXDEVOPS__circle-ci-test
90141
- GITHUB__PAT__gruntwork-ci
142+
- APPLE__OSX__code-signing

.gon_amd64.hcl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# See https://github.com/gruntwork-io/terraform-aws-ci/blob/main/modules/sign-binary-helpers/
2+
# for further instructions on how to sign the binary + submitting for notarization.
3+
4+
source = ["./bin/git-xargs_darwin_amd64"]
5+
6+
bundle_id = "io.gruntwork.app.terragrunt"
7+
8+
apple_id {
9+
username = "[email protected]"
10+
password = "@env:MACOS_AC_PASSWORD"
11+
}
12+
13+
sign {
14+
application_identity = "Developer ID Application: Gruntwork, Inc."
15+
}
16+
17+
zip {
18+
output_path = "git-xargs_darwin_amd64.zip"
19+
}

.gon_arm64.hcl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# See https://github.com/gruntwork-io/terraform-aws-ci/blob/main/modules/sign-binary-helpers/
2+
# for further instructions on how to sign the binary + submitting for notarization.
3+
4+
source = ["./bin/git-xargs_darwin_arm64"]
5+
6+
bundle_id = "io.gruntwork.app.terragrunt"
7+
8+
apple_id {
9+
username = "[email protected]"
10+
password = "@env:MACOS_AC_PASSWORD"
11+
}
12+
13+
sign {
14+
application_identity = "Developer ID Application: Gruntwork, Inc."
15+
}
16+
17+
zip {
18+
output_path = "git-xargs_darwin_arm64.zip"
19+
}

0 commit comments

Comments
 (0)