From 696945bb35eb800aa4ac53bb2ca43bfd175821b8 Mon Sep 17 00:00:00 2001 From: Curt Bushko Date: Fri, 16 Jun 2023 13:59:30 -0400 Subject: [PATCH] try a different way --- Makefile | 16 ++++++++++++---- acceptance/ci-inputs/kind-inputs.yaml | 6 +++--- .../build-support/scripts/read-yaml-config.sh | 6 +++--- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 60a133e3ed..34497b1f07 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,9 @@ VERSION = $(shell ./control-plane/build-support/scripts/version.sh control-plane CONSUL_IMAGE_VERSION = $(shell ./control-plane/build-support/scripts/consul-version.sh charts/consul/values.yaml) CONSUL_ENTERPRISE_IMAGE_VERSION = $(shell ./control-plane/build-support/scripts/consul-enterprise-version.sh charts/consul/values.yaml) CONSUL_DATAPLANE_IMAGE_VERSION = $(shell ./control-plane/build-support/scripts/consul-dataplane-version.sh charts/consul/values.yaml) +KIND_VERSION= $(shell ./control-plane/build-support/scripts/read-yaml-config.sh acceptance/ci-inputs/kind-inputs.yaml .kindVersion) +KIND_NODE_IMAGE= $(shell ./control-plane/build-support/scripts/read-yaml-config.sh acceptance/ci-inputs/kind-inputs.yaml .kindNodeImage) +KUBECTL_VERSION= $(shell ./control-plane/build-support/scripts/read-yaml-config.sh acceptance/ci-inputs/kind-inputs.yaml .kubectlVersion) # ===========> Helm Targets @@ -105,7 +108,6 @@ terraform-fmt: # ===========> CLI Targets - cli-dev: @echo "==> Installing consul-k8s CLI tool for ${GOOS}/${GOARCH}" @cd cli; go build -o ./bin/consul-k8s; cp ./bin/consul-k8s ${GOPATH}/bin/ @@ -114,7 +116,6 @@ cli-fips-dev: @echo "==> Installing consul-k8s CLI tool for ${GOOS}/${GOARCH}" @cd cli; CGO_ENABLED=1 GOEXPERIMENT=boringcrypto go build -o ./bin/consul-k8s -tags "fips"; cp ./bin/consul-k8s ${GOPATH}/bin/ - cli-lint: ## Run linter in the control-plane directory. cd cli; golangci-lint run -c ../.golangci.yml @@ -187,8 +188,15 @@ consul-enterprise-version: consul-dataplane-version: @echo $(CONSUL_DATAPLANE_IMAGE_VERSION) -kind-config: - @./control-plane/build-support/scripts/read-yaml-config.sh acceptance/ci-inputs/kind-inputs.yaml +kind-version: + @echo $(KIND_VERSION) + +kind-node-image: + @echo $(KIND_NODE_IMAGE) + +kubectl-version: + @echo $(KUBECTL_VERSION) + # ===========> Release Targets diff --git a/acceptance/ci-inputs/kind-inputs.yaml b/acceptance/ci-inputs/kind-inputs.yaml index b9a46f23d6..615ff302ba 100644 --- a/acceptance/ci-inputs/kind-inputs.yaml +++ b/acceptance/ci-inputs/kind-inputs.yaml @@ -1,3 +1,3 @@ -kind-version: v0.19.0 -kind-node-image: kindest/node:v1.27.1 -kubectl-version: v1.27.1 \ No newline at end of file +kindVersion: v0.19.0 +kindNodeImage: kindest/node:v1.27.1 +kubectlVersion: v1.27.1 diff --git a/control-plane/build-support/scripts/read-yaml-config.sh b/control-plane/build-support/scripts/read-yaml-config.sh index 6b41caa5a1..37cfd0cc17 100755 --- a/control-plane/build-support/scripts/read-yaml-config.sh +++ b/control-plane/build-support/scripts/read-yaml-config.sh @@ -3,8 +3,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 INPUT_FILE=$1 +FIELD=$2 -# Convert YAML content to JSON as it is easier to deal with -JSON_CONTENTS=$(yq eval '. | tojson' "${INPUT_FILE}") +VALUE=$(yq $FIELD $INPUT_FILE) -echo "${JSON_CONTENTS}" +echo "${VALUE}"