From f90211b9a915128882226c570cb8d6e48d9f03bf Mon Sep 17 00:00:00 2001 From: Ronen Hilewicz Date: Tue, 21 Jan 2025 18:11:40 -0500 Subject: [PATCH] Install grpcurl in CI --- .github/workflows/ci.yaml | 5 +++++ charts/directory/test/tests.yaml | 8 ++++---- makefile | 13 ++++++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 11fda52..b1da613 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -52,6 +52,11 @@ jobs: uses: azure/setup-helm@v4 with: version: ${{ env.HELM_VERSION }} + - + name: Install tools + run: | + make install-grpcurl + echo "GRPCURL=$(realpath .ext/bin/grpcurl)" >> "$GITHUB_ENV" - name: Install topaz CLI run: | diff --git a/charts/directory/test/tests.yaml b/charts/directory/test/tests.yaml index ae318c4..bea23d3 100644 --- a/charts/directory/test/tests.yaml +++ b/charts/directory/test/tests.yaml @@ -29,7 +29,7 @@ tests: run: # Create a tenant. - | - grpcurl -plaintext -H "Authorization: basic apikey_writer" \ + ${GRPCURL:=grpcurl} -plaintext -H "Authorization: basic apikey_writer" \ -d '{"tenant": {"id": "3dbaa470-9c7e-11ef-bf36-00fcb2a75cb1", "name": "test-tenant"}}' \ localhost:8282 aserto.directory.store.v2.Store.CreateTenant @@ -49,7 +49,7 @@ tests: cleanup: # Delete tenant. - | - grpcurl -plaintext -H "Authorization: basic apikey_writer" \ + ${GRPCURL:=grpcurl} -plaintext -H "Authorization: basic apikey_writer" \ -d '{"id": "3dbaa470-9c7e-11ef-bf36-00fcb2a75cb1"}' \ localhost:8282 aserto.directory.store.v2.Store.DeleteTenant @@ -95,7 +95,7 @@ tests: run: # Create a tenant. - | - grpcurl -insecure -H "Authorization: basic apikey_writer" \ + ${GRPCURL:=grpcurl} -insecure -H "Authorization: basic apikey_writer" \ -d '{"tenant": {"id": "3dbaa470-9c7e-11ef-bf36-00fcb2a75cb1", "name": "test-tenant"}}' \ localhost:8282 aserto.directory.store.v2.Store.CreateTenant @@ -114,6 +114,6 @@ tests: - diff charts/directory/test/manifest.yaml $TMPDIR/manifest.yaml cleanup: - | - grpcurl -insecure -H "Authorization: basic apikey_writer" \ + docker run --network="host" fullstorydev/grpcurl -insecure -H "Authorization: basic apikey_writer" \ -d '{"id": "3dbaa470-9c7e-11ef-bf36-00fcb2a75cb1"}' \ localhost:8282 aserto.directory.store.v2.Store.DeleteTenant diff --git a/makefile b/makefile index d3178c8..84612f9 100644 --- a/makefile +++ b/makefile @@ -12,6 +12,7 @@ CHARTS := ${shell ls ${CHARTS_DIR}} BUMP_PART ?= patch CT_VERSION := 3.11.0 +GRPCURL_VERSION := 1.9.2 BIN_DIR := ./bin EXT_DIR := ./.ext @@ -25,7 +26,7 @@ CT_LINT_CMD := ${EXT_BIN_DIR}/ct lint --config ct.yaml \ .PHONY: deps -deps: install-ct install-bumpversion; +deps: install-ct install-bumpversion install-grpcurl; .PHONY: clean clean: ${addprefix clean-,${CHARTS}} @@ -122,6 +123,16 @@ install-bumpversion: ${EXT_TMP_DIR} ${EXT_BIN_DIR} @echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)" @pip install bump2version +.PHONY: install-grpcurl +install-grpcurl: ${EXT_TMP_DIR} ${EXT_BIN_DIR} + @echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)" + @gh release download v${GRPCURL_VERSION} --repo https://github.com/fullstorydev/grpcurl \ + --pattern "grpcurl_${GRPCURL_VERSION}_$$(uname -s | tr '[:upper:]' '[:lower:]' | sed s/darwin/osx/)_$$(uname -m).tar.gz" \ + --output "${EXT_TMP_DIR}/grpcurl.tar.gz" --clobber + @tar -xvf ${EXT_TMP_DIR}/grpcurl.tar.gz --directory ${EXT_BIN_DIR} grpcurl + @chmod +x ${EXT_BIN_DIR}/grpcurl + @${EXT_BIN_DIR}/grpcurl -version + ${BIN_DIR}: @echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)" @mkdir -p ${BIN_DIR}