Skip to content

Commit

Permalink
added docker support for protoc
Browse files Browse the repository at this point in the history
  • Loading branch information
g-awmalik committed Jul 28, 2023
1 parent b4d16ae commit 5f693db
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
go-version-file: cli/go.mod
cache-dependency-path: cli/go.sum
- run: |-
make test
go test ./... -v
17 changes: 12 additions & 5 deletions cli/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SHELL := /bin/bash

# Changing this value will trigger a new release
VERSION=v1.1.11
VERSION=v1.1.12
BINARY=bin/cft
GITHUB_REPO=github.com/GoogleCloudPlatform/cloud-foundation-toolkit
PLATFORMS := linux windows darwin
Expand All @@ -11,20 +11,27 @@ BUCKET=gs://cft-cli
INT_TEST_DIR=./bpmetadata/int-test
SCHEMA_DIR=./bpmetadata/schema
PROTO_DIR=./bpmetadata/proto
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.14
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
REGISTRY_URL := gcr.io/cloud-foundation-cicd

# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS=-ldflags "-X $(GITHUB_REPO)/cli/cmd.Version=$(VERSION)"

# need an extra build command to embed an most up to date schema in the binary
.PHONY: build
build: protoc
build: protoc build-go

.PHONY: build-go
build-go:
go run ./${SCHEMA_DIR} -output=${SCHEMA_DIR}
go build ${LDFLAGS} -o ${BUILD_DIR}/${NAME}

.PHONY: protoc
protoc:
protoc --go_out=${PROTO_DIR}/out --go_opt=paths=source_relative ${PROTO_DIR}/*.proto
go build ${PROTO_DIR}/out/...
docker run --rm -it \
-v "$(CURDIR)":/workspace \
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
mkdir -p ${PROTO_DIR}/out && protoc --go_out=${PROTO_DIR}/out --go_opt=paths=source_relative ${PROTO_DIR}/*.proto

.PHONY: publish
publish:
Expand Down

0 comments on commit 5f693db

Please sign in to comment.