From 1ee5fc53b7707a9afefb91dd5b94e99c27af2f66 Mon Sep 17 00:00:00 2001 From: Artur Troian Date: Wed, 21 Jun 2023 15:32:29 -0400 Subject: [PATCH] build(e2e): check node image exists in registry node release might be on the way and e2e test will fail as container is being built. to resolve the issue we check if image exists remotely, and if not build it locally Signed-off-by: Artur Troian --- .github/workflows/integration-tests.yaml | 8 ++++++++ _run/common-kube.mk | 7 +++++-- make/init.mk | 8 ++------ make/releasing.mk | 4 ++++ 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index b6ce4d9f..fd58662f 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -6,6 +6,10 @@ on: env: KUBE_SSH_NODE_NAME: kind +defaults: + run: + shell: bash + jobs: crd-e2e: env: @@ -25,6 +29,10 @@ jobs: uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Go mod tidy + run: go mod tidy + - name: Make node scripts executable + run: make chmod-node-scripts - name: Prepare images run: make -s -C _run/kube kube-prepare-images - uses: engineerd/setup-kind@v0.5.0 diff --git a/_run/common-kube.mk b/_run/common-kube.mk index 8883d2ca..d8446146 100644 --- a/_run/common-kube.mk +++ b/_run/common-kube.mk @@ -25,11 +25,13 @@ ifeq ($(AKASH_SRC_IS_LOCAL), true) else AKASH_BUILD_LOCAL_IMAGE := false AKASH_DOCKER_IMAGE ?= ghcr.io/akash-network/node:$(AKASH_VERSION)-$(KUBE_DOCKER_IMAGE_ARCH) - ifeq ($(docker inspect --type=image $(AKASH_DOCKER_IMAGE) >/dev/null 2>&1), 1) + AKASH_DOCKER_IMAGE_EXISTS := $(shell docker inspect --type=image $(AKASH_DOCKER_IMAGE) >/dev/null 2>&1 && echo true || echo false) + ifeq ($(shell $(AKASH_DOCKER_IMAGE_EXISTS)), false) AKASH_DOCKER_IMAGE := $(AKASH_LOCAL_DOCKER_IMAGE) AKASH_BUILD_LOCAL_IMAGE := true - AKASH_LOCAL_PATH := $(AP_ROOT)/vendor/$(NODE_MODULE) endif + + undefine AKASH_DOCKER_IMAGE_EXISTS endif DOCKER_IMAGE ?= ghcr.io/akash-network/provider:latest-$(KUBE_DOCKER_IMAGE_ARCH) @@ -101,6 +103,7 @@ kube-cluster-setup-e2e: $(KUBE_CREATE) kube-cluster-setup-e2e-ci # dedicated target to perform setup within Github Actions CI .PHONY: kube-cluster-setup-e2e-ci kube-cluster-setup-e2e-ci: \ + kube-prepare-images \ kube-setup-ingress \ kube-upload-images \ kustomize-init \ diff --git a/make/init.mk b/make/init.mk index f21fbc9a..d7755b22 100644 --- a/make/init.mk +++ b/make/init.mk @@ -55,11 +55,7 @@ endif BINS := $(PROVIDER_SERVICES) akash GOWORK ?= on - -GO_MOD ?= vendor -ifeq ($(GOWORK), on) -GO_MOD := readonly -endif +GO_MOD ?= readonly export GO := GO111MODULE=$(GO111MODULE) go GO_BUILD := $(GO) build -mod=$(GO_MOD) @@ -71,7 +67,7 @@ GO_MOD_NAME := $(shell go list -m 2>/dev/null) NODE_MODULE := github.com/akash-network/node REPLACED_MODULES := $(shell go list -mod=readonly -m -f '{{ .Replace }}' all 2>/dev/null | grep -v -x -F "" | grep "^/") AKASH_SRC_IS_LOCAL := $(shell $(ROOT_DIR)/script/is_local_gomod.sh "$(NODE_MODULE)") -AKASH_LOCAL_PATH := $(shell $(GO) list -mod=readonly -m -f '{{ .Replace }}' "$(NODE_MODULE)") +AKASH_LOCAL_PATH := $(shell $(GO) list -mod=readonly -m -f '{{ .Dir }}' "$(NODE_MODULE)") AKASH_VERSION := $(shell $(GO) list -mod=readonly -m -f '{{ .Version }}' $(NODE_MODULE) | cut -c2-) GRPC_GATEWAY_VERSION := $(shell $(GO) list -mod=readonly -m -f '{{ .Version }}' github.com/grpc-ecosystem/grpc-gateway) GOLANGCI_LINT_VERSION ?= v1.51.2 diff --git a/make/releasing.mk b/make/releasing.mk index d15312ab..ea66656a 100644 --- a/make/releasing.mk +++ b/make/releasing.mk @@ -45,6 +45,10 @@ docgen: $(PROVIRER_DEVCACHE) install: $(GO) install $(BUILD_FLAGS) ./cmd/provider-services +.PHONY: chmod-node-scripts +chmod-node-scripts: + find "$(AKASH_LOCAL_PATH)/script" -type f -name '*.sh' -exec echo "chmod +x {}" \; -exec chmod +x {} \; + .PHONY: docker-image docker-image: docker run \