Skip to content

Commit

Permalink
Adding embed support.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheftako committed May 10, 2024
1 parent e0d3d8c commit 7241f51
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ tmp/_test
.tmp

# build output
version.txt
third_party/github.com/hashicorp/terraform-provider-google-beta/google-beta/fwtransport/version.txt
bin/
operator/bin

Expand Down
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fmt:
./

.PHONY: lint
lint:
lint: third_party/github.com/hashicorp/terraform-provider-google-beta/google-beta/fwtransport/version.txt
docker run --rm -v $(shell pwd):/app \
-v ${GOLANGCI_LINT_CACHE}:/root/.cache/golangci-lint \
-w /app golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine \
Expand All @@ -108,7 +108,7 @@ vet:

# Generate code
.PHONY: generate
generate:
generate: third_party/github.com/hashicorp/terraform-provider-google-beta/google-beta/fwtransport/version.txt
# Don't run go generate on `pkg/clients/generated` in the normal development flow due to high latency.
# This path will be covered by `generate-go-client` target specifically.
go mod vendor -o temp-vendor # So we can load DCL resources
Expand Down Expand Up @@ -193,6 +193,14 @@ deploy-controller: docker-build docker-push
generate-go-client:
./scripts/generate-go-crd-clients/generate-clients.sh

# Generate the version.txt file
version.txt: operator/channels/stable
egrep version operator/channels/stable | head -1 | sed 's/[^0-9.]//g' > version.txt

# Generate the version.txt file
third_party/github.com/hashicorp/terraform-provider-google-beta/google-beta/fwtransport/version.txt: version.txt
cp version.txt third_party/github.com/hashicorp/terraform-provider-google-beta/google-beta/fwtransport

# Generate google3 docs
.PHONY: resource-docs
resource-docs:
Expand Down
1 change: 1 addition & 0 deletions build/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ COPY operator/ operator/
COPY third_party/ third_party/
COPY scripts/generate-third-party-licenses scripts/generate-third-party-licenses
COPY scripts/resource-autogen scripts/resource-autogen
COPY version.txt third_party/github.com/hashicorp/terraform-provider-google-beta/google-beta/fwtransport/version.txt
COPY go.mod go.mod
COPY go.sum go.sum

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package fwtransport

import (
"context"
_ "embed"
"fmt"
"os"
"strings"
Expand All @@ -19,7 +20,9 @@ import (
const uaEnvVar = "TF_APPEND_USER_AGENT"

func CompileUserAgentString(ctx context.Context, name, tfVersion, provVersion string) string {
ua := fmt.Sprintf("kcc/1.117.0 (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/%s", provVersion)
//go:embed version.txt
var kccVersion string
ua := fmt.Sprintf("kcc/%s (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/%s", kccVersion, provVersion)

if add := os.Getenv(uaEnvVar); add != "" {
add = strings.TrimSpace(add)
Expand Down

0 comments on commit 7241f51

Please sign in to comment.