Skip to content

Commit

Permalink
fix: build node docker image if tag is not present in registry
Browse files Browse the repository at this point in the history
helpful when node release is on the way and provider needs
to run tests on the tag

Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Jun 17, 2023
1 parent 0bc6ebc commit 282123b
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 17 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:

env:
KUBE_SSH_NODE_NAME: kind
GO_MOD: vendor

jobs:
crd-e2e:
Expand All @@ -19,7 +20,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: "${{ env.GOLANG_VERSION }}"
- name: fetch kind version from go modules
- name: Fetch kind version from go modules
run: echo "KIND_VERSION=$(go list -mod=readonly -m -f '{{ .Version }}' sigs.k8s.io/kind)" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -32,8 +33,6 @@ jobs:
version: "${{ env.KIND_VERSION }}"
image: "kindest/node:${{ env.KINDEST_VERSION }}"
config: ./_run/kube/kind-config.yaml
- name: Docker Status
run: docker ps -a
- name: Setup Ingress K8S
run: KUSTOMIZE_INSTALLS=akash-operator-inventory make -s -C _run/kube kube-cluster-setup-e2e-ci
- name: k8s-ingress
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ RELEASE_TAG ?= $(shell git describe --tags --abbrev=0)
IS_PREREL := $(shell $(ROOT_DIR)/script/is_prerelease.sh "$(RELEASE_TAG)" && echo "true" || echo "false")

GO_LINKMODE ?= external
GO_MOD ?= readonly
BUILD_TAGS ?= osusergo,netgo,static_build
GORELEASER_STRIP_FLAGS ?=

Expand Down
24 changes: 16 additions & 8 deletions _run/common-kube.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,28 @@ KUBE_UPLOAD_AKASH_IMAGE ?= false
KUBE_CLUSTER_CREATE_TARGET ?= default
KUBE_ROLLOUT_TIMEOUT ?= 180

INGRESS_CONFIG_PATH ?= ../ingress-nginx.yaml
CALICO_MANIFEST ?= https://github.com/projectcalico/calico/blob/v3.25.0/manifests/calico.yaml
INGRESS_CONFIG_PATH ?= ../ingress-nginx.yaml
CALICO_MANIFEST ?= https://github.com/projectcalico/calico/blob/v3.25.0/manifests/calico.yaml

# when image is built locally, for example on M1 (arm64) and kubernetes cluster is running on amd64
# we need to specify what arch to deploy as docker manifests can't be transferred locally
KUBE_DOCKER_IMAGE_ARCH ?= amd64
#$(UNAME_ARCH)
KUBE_DOCKER_IMAGE_ARCH ?= $(shell uname -m | sed "s/x86_64/amd64/g")

AKASH_LOCAL_DOCKER_IMAGE ?= ghcr.io/akash-network/node:latest-$(KUBE_DOCKER_IMAGE_ARCH)

ifeq ($(AKASH_SRC_IS_LOCAL), true)
AKASH_DOCKER_IMAGE ?= ghcr.io/akash-network/node:latest-$(KUBE_DOCKER_IMAGE_ARCH)
AKASH_DOCKER_IMAGE ?= $(AKASH_LOCAL_DOCKER_IMAGE)
AKASH_BUILD_LOCAL_IMAGE := true
else
AKASH_DOCKER_IMAGE ?= ghcr.io/akash-network/node:$(AKASH_VERSION)-$(KUBE_DOCKER_IMAGE_ARCH)
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 := $(AKASH_LOCAL_DOCKER_IMAGE)
AKASH_BUILD_LOCAL_IMAGE := true
AKASH_LOCAL_PATH := $(AP_ROOT)/vendor/$(NODE_MODULE)
endif
endif

DOCKER_IMAGE ?= ghcr.io/akash-network/provider:latest-$(KUBE_DOCKER_IMAGE_ARCH)

PROVIDER_HOSTNAME ?= localhost
Expand All @@ -42,7 +51,7 @@ endif
kube-prepare-images:
ifneq ($(SKIP_BUILD), true)
make -C $(AP_ROOT) docker-image
ifeq ($(AKASH_SRC_IS_LOCAL), true)
ifeq ($(AKASH_BUILD_LOCAL_IMAGE), true)
make -C $(AKASH_LOCAL_PATH) docker-image
else
docker pull $(AKASH_DOCKER_IMAGE)
Expand Down Expand Up @@ -93,7 +102,6 @@ kube-cluster-setup-e2e: $(KUBE_CREATE) kube-cluster-setup-e2e-ci
.PHONY: kube-cluster-setup-e2e-ci
kube-cluster-setup-e2e-ci: \
kube-setup-ingress \
kube-prepare-images \
kube-upload-images \
kustomize-init \
kustomize-deploy-services \
Expand Down
1 change: 0 additions & 1 deletion _run/kube/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ KUBE_SETUP_PREREQUISITES ?= \

KUBE_CLUSTER_CREATE_TARGET := kind
KUBE_SSH_NODE_NAME ?= kind
KUBE_DOCKER_IMAGE_ARCH := $(shell uname -m | sed "s/x86_64/amd64/g")

KUSTOMIZE_INSTALLS ?= \
akash-operator-hostname \
Expand Down
9 changes: 5 additions & 4 deletions make/init.mk
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,17 @@ ifeq ($(GOWORK), on)
GO_MOD := readonly
endif

export GO := GO111MODULE=$(GO111MODULE) go
export GO := GO111MODULE=$(GO111MODULE) go
GO_BUILD := $(GO) build -mod=$(GO_MOD)
GO_TEST := $(GO) test -mod=$(GO_MOD)
GO_VET := $(GO) vet -mod=$(GO_MOD)

NODE_MODULE := github.com/akash-network/node
GO_MOD_NAME := $(shell go list -m 2>/dev/null)
REPLACED_MODULES := $(shell go list -mod=readonly -m -f '{{ .Replace }}' all 2>/dev/null | grep -v -x -F "<nil>" | grep "^/")
AKASH_SRC_IS_LOCAL := $(shell $(ROOT_DIR)/script/is_local_gomod.sh "github.com/akash-network/node")
AKASH_LOCAL_PATH := $(shell $(GO) list -mod=readonly -m -f '{{ .Replace }}' "github.com/akash-network/node")
AKASH_VERSION := $(shell $(GO) list -mod=readonly -m -f '{{ .Version }}' github.com/akash-network/node | cut -c2-)
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_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
GOLANG_VERSION ?= 1.16.1
Expand Down
4 changes: 4 additions & 0 deletions make/mod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ modsensure: deps-tidy deps-vendor

.PHONY: modvendor
modvendor: $(MODVENDOR) modsensure
ifeq ($(GO_MOD), vendor)
modvendor:
@echo "vendoring non-go files..."
chmod +x $(K8S_GENERATE_GROUPS)
$(MODVENDOR) -copy="**/Makefile **/*.sh **/*.mk" -include=github.com/akash-network/node
endif

0 comments on commit 282123b

Please sign in to comment.