Skip to content

Commit

Permalink
Fixed build error on macOS dist
Browse files Browse the repository at this point in the history
The error was due to an increased git security constraints

  ...
  go: downloading github.com/xanzy/ssh-agent v0.2.1
  go: downloading gopkg.in/warnings.v0 v0.1.2
  error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.
  Error: failed building for darwin/amd64: exit status 1
  failed building for darwin/amd64: exit status 1
  task: Failed to run task "dist:macOS_64bit": exit status 1

To fix this I followed the suggestion here elastic/golang-crossbuild#232
  • Loading branch information
cmaglie committed Mar 14, 2023
1 parent 3154ebb commit 27ac5fd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions DistTasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,12 @@ tasks:
desc: Builds Mac OS X 64 bit binaries
dir: "{{.DIST_DIR}}"
cmds:
# "git config safe.directory" is required until this is fixed https://github.com/elastic/golang-crossbuild/issues/232
- |
docker run -v `pwd`/..:/home/build -w /home/build \
-e CGO_ENABLED=1 \
{{.CONTAINER}}:{{.CONTAINER_TAG}} \
--build-cmd "{{.BUILD_COMMAND}}" \
--build-cmd "git config --global --add safe.directory /home/build && {{.BUILD_COMMAND}}" \
-p "{{.BUILD_PLATFORM}}"
tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}}
Expand Down Expand Up @@ -235,11 +236,12 @@ tasks:
desc: Builds Mac OS X ARM64 binaries
dir: "{{.DIST_DIR}}"
cmds:
# "git config safe.directory" is required until this is fixed https://github.com/elastic/golang-crossbuild/issues/232
- |
docker run -v `pwd`/..:/home/build -w /home/build \
-e CGO_ENABLED=1 \
{{.CONTAINER}}:{{.CONTAINER_TAG}} \
--build-cmd "{{.BUILD_COMMAND}}" \
--build-cmd "git config --global --add safe.directory /home/build && {{.BUILD_COMMAND}}" \
-p "{{.BUILD_PLATFORM}}"
tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}}
Expand Down

0 comments on commit 27ac5fd

Please sign in to comment.