Skip to content

Commit

Permalink
chore: support running Make tasks while on Zscaler on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreatma committed Feb 22, 2024
1 parent ee44ce7 commit d0cc40f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ equinix-metal.swagger.json.orig
git_push.sh
services/*/api/
pkg
.certs
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ USER_AGENT=${GIT_REPO}/${PACKAGE_VERSION}
OPENAPI_IMAGE_TAG=v7.3.0
OPENAPI_IMAGE=openapitools/openapi-generator-cli:${OPENAPI_IMAGE_TAG}
CRI=docker # nerdctl
OPENAPI_GENERATOR=${CRI} run --rm -u ${CURRENT_UID}:${CURRENT_GID} -v $(CURDIR):/local ${OPENAPI_IMAGE}
SPEC_FETCHER=${CRI} run --rm -u ${CURRENT_UID}:${CURRENT_GID} -v $(CURDIR):/workdir --entrypoint sh mikefarah/yq:4.30.8 script/download_spec.sh
OPENAPI_GENERATOR=${CRI} run --rm -u ${CURRENT_UID}:${CURRENT_GID} $(CUSTOM_CERT_VOLUME) -v $(CURDIR):/local ${OPENAPI_IMAGE}
SPEC_FETCHER=${CRI} run --rm -u ${CURRENT_UID}:${CURRENT_GID} $(CUSTOM_CERT_VOLUME) -v $(CURDIR):/workdir --entrypoint sh mikefarah/yq:4.30.8 script/download_spec.sh
MIN_GO_VERSION=1.19
GO_CMD=${CRI} run --rm -u ${CURRENT_UID}:${CURRENT_GID} -v $(CURDIR):/workdir -w /workdir -e GOCACHE=/tmp/.cache golang:${MIN_GO_VERSION}
GO_CMD=${CRI} run --rm -u ${CURRENT_UID}:${CURRENT_GID} $(CUSTOM_CERT_VOLUME) -v $(CURDIR):/workdir -w /workdir -e GOCACHE=/tmp/.cache golang:${MIN_GO_VERSION}
GOLANGCI_LINT=golangci-lint

SPEC_BASE_DIR=spec/services
Expand Down
14 changes: 14 additions & 0 deletions script/setup_local_certs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# TODO what about non-Mac on Zscaler?
mkdir -p .certs

# Eject the usual CA certificates for the local host
security export -t certs -f pemseq -k /System/Library/Keychains/SystemRootCertificates.keychain -o .certs/ca-certificates.crt

# Append the Zscaler CA certificate to the bundle
security find-certificate -p -c "Zscaler" /Library/Keychains/System.keychain >> .certs/ca-certificates.crt

# Set the magic env var so that Make tasks that run Docker commands
# will overwrite the image's built-in CA cert bundle with our own
export CUSTOM_CERT_VOLUME="-v `pwd`/.certs:/etc/ssl/certs"

0 comments on commit d0cc40f

Please sign in to comment.