Skip to content

Commit 3067bd1

Browse files
committed
scripts/common-envs.mk: add PLATFORM calculation with json parsing
Signed-off-by: nbykov0 <[email protected]>
1 parent fc5f272 commit 3067bd1

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎scripts/common-envs.mk‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ ifeq ($(COZYSTACK_VERSION),)
1515
COZYSTACK_VERSION = $(patsubst v%,%,$(shell git describe --tags))
1616
endif
1717

18-
# Get the name of the default docker buildx builder
19-
BUILDER ?= $(shell jq -r '.Name' ~/.docker/buildx/current)
18+
# Get the name of the selected docker buildx builder
19+
BUILDER ?= $(shell docker buildx inspect --bootstrap | head -n2 | awk '/^Name:/{print $$NF}')
2020
# Get platforms supported by the builder
21-
# TODO: figure out how to get runners status dynamically, in json
22-
# PLATFORM ?= $(shell jq -r '.Nodes[] | .Platforms | map(.os + "/" + .architecture) | join(",")' ~/.docker/buildx/instances/$(BUILDER))
23-
PLATFORM ?= $(shell docker buildx inspect --bootstrap $(BUILDER) | egrep '^Platforms:' | egrep -o 'linux/amd64|linux/arm64' | sort -u | xargs | sed 's/ /,/g')
21+
PLATFORM ?= $(shell docker buildx ls --format=json | jq -r 'select(.Name == "$(BUILDER)") | [.Nodes[].Platforms // []] | flatten | unique | map(select(test("^linux/amd64$$|^linux/arm64$$"))) | join(",")')
2422

0 commit comments

Comments
 (0)