From 48869c4c7cd04b402b90905d134e8954ebf8a8f3 Mon Sep 17 00:00:00 2001 From: Nicolas Belouin Date: Thu, 12 Oct 2023 16:58:49 +0200 Subject: [PATCH 1/8] chore: Revamp build system to overcome Cross issues This commit completely refactor the build system for akri: - Rust components are now built within docker using XX for cross-compilation - Made samples clear in a separate Makefile to ease with them getting out of the main repo soon - Remove cross intermediate image - Use buildx to build for multiple architectures - Merge largely similar Dockerfiles - Upgrade opcua-monitoring-broker to .NET 6 - Upgrade opencv intermediate image to .NET 6 (the onvif broker still needs migration) Signed-off-by: Nicolas Belouin --- .dockerignore | 89 +-------- Makefile | 53 +++-- build/akri-containers.mk | 95 +-------- build/akri-dotnet-containers.mk | 51 +---- build/akri-python-containers.mk | 48 ----- build/akri-rust-containers.mk | 49 ----- build/containers/Dockerfile.agent | 33 ---- build/containers/Dockerfile.agent-full | 32 --- .../Dockerfile.anomaly-detection-app | 19 -- build/containers/Dockerfile.controller | 15 -- .../Dockerfile.debug-echo-discovery | 15 -- build/containers/Dockerfile.onvif-discovery | 15 -- build/containers/Dockerfile.opcua-discovery | 15 -- .../Dockerfile.opcua-monitoring-broker | 19 +- build/containers/Dockerfile.python-app | 23 +++ build/containers/Dockerfile.rust | 40 ++++ build/containers/Dockerfile.udev-discovery | 15 -- build/containers/Dockerfile.udev-video-broker | 20 -- .../containers/Dockerfile.video-streaming-app | 19 -- .../Dockerfile.webhook-configuration | 21 -- .../intermediate/Dockerfile.opencvsharp-build | 183 +++++++++--------- .../Dockerfile.rust-crossbuild-amd64 | 20 -- .../Dockerfile.rust-crossbuild-arm32v7 | 25 --- .../Dockerfile.rust-crossbuild-arm64v8 | 25 --- build/intermediate-containers.mk | 77 +------- build/samples.mk | 36 ++++ .../helm/templates/webhook-configuration.yaml | 4 +- samples/apps/anomaly-detection-app/README.md | 2 +- .../{anomaly_detection.py => app.py} | 0 samples/apps/video-streaming-app/README.md | 4 +- .../{streaming.py => app.py} | 0 .../opcua-monitoring-broker.csproj | 2 +- test/e2e/test_udev.py | 4 +- 33 files changed, 258 insertions(+), 810 deletions(-) delete mode 100644 build/akri-python-containers.mk delete mode 100644 build/akri-rust-containers.mk delete mode 100644 build/containers/Dockerfile.agent delete mode 100644 build/containers/Dockerfile.agent-full delete mode 100644 build/containers/Dockerfile.anomaly-detection-app delete mode 100644 build/containers/Dockerfile.controller delete mode 100644 build/containers/Dockerfile.debug-echo-discovery delete mode 100644 build/containers/Dockerfile.onvif-discovery delete mode 100644 build/containers/Dockerfile.opcua-discovery create mode 100644 build/containers/Dockerfile.python-app create mode 100644 build/containers/Dockerfile.rust delete mode 100644 build/containers/Dockerfile.udev-discovery delete mode 100644 build/containers/Dockerfile.udev-video-broker delete mode 100644 build/containers/Dockerfile.video-streaming-app delete mode 100644 build/containers/Dockerfile.webhook-configuration delete mode 100644 build/containers/intermediate/Dockerfile.rust-crossbuild-amd64 delete mode 100644 build/containers/intermediate/Dockerfile.rust-crossbuild-arm32v7 delete mode 100644 build/containers/intermediate/Dockerfile.rust-crossbuild-arm64v8 create mode 100644 build/samples.mk rename samples/apps/anomaly-detection-app/{anomaly_detection.py => app.py} (100%) rename samples/apps/video-streaming-app/{streaming.py => app.py} (100%) diff --git a/.dockerignore b/.dockerignore index 4a01fc05c..21936581d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,80 +1,11 @@ - -# Ignore everything ** - -# The anomaly detection app is built using a `docker build` command, -# so the source code needs to be available to the container -# build -!samples/apps/anomaly-detection-app - -# ONVIF broker is built using a `docker build` command, so -# the source code needs to be available to the DotNet container -# build -!samples/brokers/onvif-video-broker - -# OPC UA broker is built using a `docker build` command, so -# the source code needs to be available to the DotNet container -# build -!samples/brokers/opcua-monitoring-broker - -# The streaming app is built using a `docker build` command, so -# the source code needs to be available to the container -# build -!samples/apps/video-streaming-app - -# The Rust binaries are not built with a `docker build` -# command (they are built using Cargo Cross, which I think -# uses a docker run). Because of this, the Rust src and -# Cargo.toml files can be ignored by docker. - - -# Cross-build binaries need to be available -# It is not clear to me why !target/*/*/controller -# does not work here, but it doesn't seem to. So -# for now, explicitly specifying each cross-build -# target and configuration path. -!target/x86_64-unknown-linux-gnu/debug/controller -!target/x86_64-unknown-linux-gnu/release/controller -!target/x86_64-unknown-linux-gnu/debug/agent -!target/x86_64-unknown-linux-gnu/release/agent -!target/x86_64-unknown-linux-gnu/debug/agent-full -!target/x86_64-unknown-linux-gnu/release/agent-full -!target/x86_64-unknown-linux-gnu/debug/udev-video-broker -!target/x86_64-unknown-linux-gnu/release/udev-video-broker -!target/x86_64-unknown-linux-gnu/debug/webhook-configuration -!target/x86_64-unknown-linux-gnu/release/webhook-configuration -!target/x86_64-unknown-linux-gnu/release/udev-discovery-handler -!target/x86_64-unknown-linux-gnu/release/debug-echo-discovery-handler -!target/x86_64-unknown-linux-gnu/release/onvif-discovery-handler -!target/x86_64-unknown-linux-gnu/release/opcua-discovery-handler -!target/aarch64-unknown-linux-gnu/debug/controller -!target/aarch64-unknown-linux-gnu/release/controller -!target/aarch64-unknown-linux-gnu/debug/agent -!target/aarch64-unknown-linux-gnu/release/agent -!target/aarch64-unknown-linux-gnu/debug/agent-full -!target/aarch64-unknown-linux-gnu/release/agent-full -!target/aarch64-unknown-linux-gnu/debug/udev-video-broker -!target/aarch64-unknown-linux-gnu/release/udev-video-broker -!target/aarch64-unknown-linux-gnu/debug/webhook-configuration -!target/aarch64-unknown-linux-gnu/release/webhook-configuration -!target/aarch64-unknown-linux-gnu/release/udev-discovery-handler -!target/aarch64-unknown-linux-gnu/release/debug-echo-discovery-handler -!target/aarch64-unknown-linux-gnu/release/onvif-discovery-handler -!target/aarch64-unknown-linux-gnu/release/opcua-discovery-handler -!target/armv7-unknown-linux-gnueabihf/debug/controller -!target/armv7-unknown-linux-gnueabihf/release/controller -!target/armv7-unknown-linux-gnueabihf/debug/agent -!target/armv7-unknown-linux-gnueabihf/release/agent -!target/armv7-unknown-linux-gnueabihf/debug/agent-full -!target/armv7-unknown-linux-gnueabihf/release/agent-full -!target/armv7-unknown-linux-gnueabihf/debug/udev-video-broker -!target/armv7-unknown-linux-gnueabihf/release/udev-video-broker -!target/armv7-unknown-linux-gnueabihf/debug/webhook-configuration -!target/armv7-unknown-linux-gnueabihf/release/webhook-configuration -!target/armv7-unknown-linux-gnueabihf/release/udev-discovery-handler -!target/armv7-unknown-linux-gnueabihf/release/debug-echo-discovery-handler -!target/armv7-unknown-linux-gnueabihf/release/onvif-discovery-handler -!target/armv7-unknown-linux-gnueabihf/release/opcua-discovery-handler - -# Cross toml file needs to be available for making the cross build containers -!Cross.toml \ No newline at end of file +!Cargo.toml +!Cargo.lock +!agent +!controller +!discovery-handler-modules +!discovery-handlers +!discovery-utils +!samples +!shared +!webhooks \ No newline at end of file diff --git a/Makefile b/Makefile index 56ebc34d2..66f98260f 100644 --- a/Makefile +++ b/Makefile @@ -1,26 +1,28 @@ -BUILD_AMD64 ?= 1 -BUILD_ARM32 ?= 1 -BUILD_ARM64 ?= 1 +BUILDX_ARGS = +EXTRA_CARGO_ARGS = + +PUSH ?= +LOAD ?= +LOCAL_ARCH = $(shell uname -m) +ifeq ($(LOAD), 1) +PLATFORMS ?= LOCAL_ARCH +$(intcmp 1,$(words $(PLATFORMS)), $(error Cannot load for more than one platform)) +else +PLATFORMS ?= amd64 arm64 arm/v7 +endif + +null := +space := $(null) # +comma := , + +DOCKER_PLATFORMS = $(subst $(space),$(comma),$(strip $(addprefix linux/, $(PLATFORMS)))) # Specify flag to build optimized release version of rust components. # Set to be empty to use debug builds. BUILD_RELEASE_FLAG ?= 1 -# Space separated list of rust packages to not build such as the following to not build -# the udev discovery handler library or module: "akri-udev udev-discovery-handler" -PACKAGES_TO_EXCLUDE ?= - -# Incremental compilation causes rustc to save additional information to disk which will be -# reused when recompiling the crate, improving re-compile times. -# The additional information is stored in the target directory. -# By default for cargo builds, it is enabled in debug mode and disabled in release mode. -CARGO_INCREMENTAL ?= 0 - -BUILD_SLIM_AGENT ?= 1 -FULL_AGENT_EXECUTABLE_NAME ?= agent-full # Specify which features of the Agent to build, namely which Discovery Handlers -# should be embedded if any. The "agent-full" feature must be enabled to use the embedded -# Discovery Handlers. IE: AGENT_FEATURES="agent-full onvif-feat opcua-feat udev-feat" +# should be embedded if any. IE: AGENT_FEATURES="onvif-feat opcua-feat udev-feat" AGENT_FEATURES ?= REGISTRY ?= devcaptest.azurecr.io @@ -47,12 +49,21 @@ AMD64_SUFFIX = amd64 ARM32V7_SUFFIX = arm32v7 ARM64V8_SUFFIX = arm64v8 -AMD64_TARGET = x86_64-unknown-linux-gnu -ARM32V7_TARGET = armv7-unknown-linux-gnueabihf -ARM64V8_TARGET = aarch64-unknown-linux-gnu - +COMMON_DOCKER_BUILD_ARGS = $(if $(LOAD), --load) $(if $(PUSH), --push) --platform=$(DOCKER_PLATFORMS) # Intermediate container defines include build/intermediate-containers.mk # Akri container defines include build/akri-containers.mk +include build/samples.mk + +.PHONY: all +all: akri samples opencv-base + +.PHONY: push +push: PUSH = 1 +push: all + +.PHONY: load +load: LOAD = 1 +load: all \ No newline at end of file diff --git a/build/akri-containers.mk b/build/akri-containers.mk index 93a751570..bd51ae79e 100644 --- a/build/akri-containers.mk +++ b/build/akri-containers.mk @@ -1,38 +1,3 @@ -USE_OPENCV_BASE_VERSION = 0.0.11 - -# Akri container defines -include build/akri-rust-containers.mk -include build/akri-dotnet-containers.mk -include build/akri-python-containers.mk - -# -# Functions for building Agent with or without Discovery Handlers -# -# Build the Agent without any Discovery Handlers embedded -define agent_build_slim - CARGO_INCREMENTAL=$(CARGO_INCREMENTAL) PKG_CONFIG_ALLOW_CROSS=1 cross build $(if $(BUILD_RELEASE_FLAG), --release) --target=$(1) --manifest-path agent/Cargo.toml -endef - -# Build the Agent with features that embed Discovery Handlers and rename the executable in case subsequently -# building a slim Agent -define agent_build_with_features - CARGO_INCREMENTAL=$(CARGO_INCREMENTAL) PKG_CONFIG_ALLOW_CROSS=1 cross build $(if $(BUILD_RELEASE_FLAG), --release) --target=$(1) --manifest-path agent/Cargo.toml \ - --features "${AGENT_FEATURES}" - mv target/$(1)/$(if $(BUILD_RELEASE_FLAG),release,debug)/agent target/$(1)/$(if $(BUILD_RELEASE_FLAG),release,debug)/${FULL_AGENT_EXECUTABLE_NAME} -endef - -# -# -# INSTALL-CROSS: install cargo cross building tool: -# -# `make install-cross` -# -# -.PHONY: install-cross -install-cross: - cargo install cross - - # # # AKRI: make and push the images for akri: @@ -46,58 +11,14 @@ install-cross: # To make a slim and full Agent, with full agent executable renamed agent-full: `AGENT_FEATURES="agent-full onvif-feat opcua-feat udev-feat" BUILD_SLIM_AGENT=1 make akri-agent` # .PHONY: akri -akri: akri-build akri-docker-all -akri-build: install-cross akri-cross-build -akri-docker-all: akri-docker-controller akri-docker-agent akri-docker-udev akri-docker-onvif akri-docker-streaming akri-docker-opcua-monitoring akri-docker-anomaly-detection akri-docker-webhook-configuration akri-docker-debug-echo-discovery akri-docker-onvif-discovery akri-docker-opcua-discovery akri-docker-udev-discovery +akri: akri-agent akri-agent-full akri-controller akri-webhook-configuration akri-debug-echo-discovery-handler akri-onvif-discovery-handler akri-opcua-discovery-handler akri-udev-discovery-handler -akri-cross-build: akri-cross-build-amd64 akri-cross-build-arm32 akri-cross-build-arm64 -akri-cross-build-amd64: -ifeq (1, $(BUILD_AMD64)) - CARGO_INCREMENTAL=$(CARGO_INCREMENTAL) PKG_CONFIG_ALLOW_CROSS=1 cross build $(if $(BUILD_RELEASE_FLAG), --release) --target=$(AMD64_TARGET) --workspace --exclude agent $(foreach package,$(wordlist 1, 100, $(PACKAGES_TO_EXCLUDE)),--exclude $(package)) -ifneq ($(AGENT_FEATURES),) - $(call agent_build_with_features,$(AMD64_TARGET)) -endif -ifeq (1, $(BUILD_SLIM_AGENT)) - $(call agent_build_slim,$(AMD64_TARGET)) -endif -endif -akri-cross-build-arm32: -ifeq (1, $(BUILD_ARM32)) - CARGO_INCREMENTAL=$(CARGO_INCREMENTAL) PKG_CONFIG_ALLOW_CROSS=1 cross build $(if $(BUILD_RELEASE_FLAG), --release) --target=$(ARM32V7_TARGET) --workspace --exclude agent $(foreach package,$(wordlist 1, 100, $(PACKAGES_TO_EXCLUDE)),--exclude $(package)) -ifneq ($(AGENT_FEATURES),) - $(call agent_build_with_features,$(ARM32V7_TARGET)) -endif -ifeq (1, $(BUILD_SLIM_AGENT)) - $(call agent_build_slim,$(ARM32V7_TARGET)) -endif -endif -akri-cross-build-arm64: -ifeq (1, ${BUILD_ARM64}) - CARGO_INCREMENTAL=$(CARGO_INCREMENTAL) PKG_CONFIG_ALLOW_CROSS=1 cross build $(if $(BUILD_RELEASE_FLAG), --release) --target=$(ARM64V8_TARGET) --workspace --exclude agent $(foreach package,$(wordlist 1, 100, $(PACKAGES_TO_EXCLUDE)),--exclude $(package)) -ifneq ($(AGENT_FEATURES),) - $(call agent_build_with_features,$(ARM64V8_TARGET)) -endif -ifeq (1, $(BUILD_SLIM_AGENT)) - $(call agent_build_slim,$(ARM64V8_TARGET)) -endif -endif +akri-%: + docker buildx build $(COMMON_DOCKER_BUILD_ARGS) --build-arg AKRI_COMPONENT=$* --tag "$(PREFIX)/$(subst -handler,,$*):$(LABEL_PREFIX)" --build-arg EXTRA_CARGO_ARGS="$(if $(BUILD_RELEASE_FLAG), --release)" --file $(DOCKERFILE_DIR)/Dockerfile.rust . -# Rust targets -$(eval $(call add_rust_targets,controller,controller)) -$(eval $(call add_rust_targets,agent,agent)) -$(eval $(call add_rust_targets,agent-full,agent-full)) -$(eval $(call add_rust_targets,udev,udev-video-broker)) -$(eval $(call add_rust_targets,webhook-configuration,webhook-configuration)) -$(eval $(call add_rust_targets,debug-echo-discovery,debug-echo-discovery)) -$(eval $(call add_rust_targets,onvif-discovery,onvif-discovery)) -$(eval $(call add_rust_targets,opcua-discovery,opcua-discovery)) -$(eval $(call add_rust_targets,udev-discovery,udev-discovery)) - -# .NET targets -$(eval $(call add_onvif_target,onvif,onvif-video-broker)) -$(eval $(call add_opcua_target,opcua-monitoring,opcua-monitoring-broker)) - -# Python targets -$(eval $(call add_python_target,anomaly-detection,anomaly-detection-app)) -$(eval $(call add_python_target,streaming,video-streaming-app)) +.PHONY: akri-agent-full +akri-agent-full: +ifneq (,$(strip $(AGENT_FEATURES))) + docker buildx build $(COMMON_DOCKER_BUILD_ARGS) --build-arg AKRI_COMPONENT=agent --build-arg EXTRA_CARGO_ARGS="$(if $(BUILD_RELEASE_FLAG), --release) -F agent-full,$(subst $(space),$(comma),$(AGENT_FEATURES))" --tag "$(PREFIX)/agent-full:$(LABEL_PREFIX)" --file $(DOCKERFILE_DIR).rust . +endif diff --git a/build/akri-dotnet-containers.mk b/build/akri-dotnet-containers.mk index 7cf8cf50c..3def3f1a5 100644 --- a/build/akri-dotnet-containers.mk +++ b/build/akri-dotnet-containers.mk @@ -44,53 +44,4 @@ define add_onvif_target $(1)-docker-multi-arch-push: $(ENABLE_DOCKER_MANIFEST) docker manifest push $(PREFIX)/$(2):$(LABEL_PREFIX) -endef - -define add_opcua_target - akri-$(1): akri-build akri-docker-$(1) - akri-docker-$(1): $(1)-build $(1)-docker-per-arch $(1)-docker-multi-arch-create $(1)-docker-multi-arch-push - $(1)-build: $(1)-build-amd64 $(1)-build-arm32 $(1)-build-arm64 - $(1)-docker-per-arch: $(1)-docker-per-arch-amd64 $(1)-docker-per-arch-arm32 $(1)-docker-per-arch-arm64 - - $(1)-build-amd64: - ifeq (1, ${BUILD_AMD64}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) --build-arg OUTPUT_PLATFORM_TAG=3.1-bullseye-slim --build-arg DOTNET_PUBLISH_RUNTIME=linux-x64 - endif - $(1)-build-arm32: - ifeq (1, ${BUILD_ARM32}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) --build-arg OUTPUT_PLATFORM_TAG=3.1-bullseye-slim-$(ARM32V7_SUFFIX) --build-arg DOTNET_PUBLISH_RUNTIME=linux-arm - endif - $(1)-build-arm64: - ifeq (1, ${BUILD_ARM64}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) --build-arg OUTPUT_PLATFORM_TAG=3.1-bullseye-slim-$(ARM64V8_SUFFIX) --build-arg DOTNET_PUBLISH_RUNTIME=linux-arm64 - endif - - $(1)-docker-per-arch-amd64: - ifeq (1, ${BUILD_AMD64}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) - endif - $(1)-docker-per-arch-arm32: - ifeq (1, ${BUILD_ARM32}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) - endif - $(1)-docker-per-arch-arm64: - ifeq (1, ${BUILD_ARM64}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) - endif - - $(1)-docker-multi-arch-create: - ifeq (1, ${BUILD_AMD64}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) - endif - ifeq (1, ${BUILD_ARM32}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) - endif - ifeq (1, ${BUILD_ARM64}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) - endif - - $(1)-docker-multi-arch-push: - $(ENABLE_DOCKER_MANIFEST) docker manifest push $(PREFIX)/$(2):$(LABEL_PREFIX) - -endef - +endef \ No newline at end of file diff --git a/build/akri-python-containers.mk b/build/akri-python-containers.mk deleted file mode 100644 index 17d75d1e9..000000000 --- a/build/akri-python-containers.mk +++ /dev/null @@ -1,48 +0,0 @@ - -define add_python_target - akri-$(1): akri-build akri-docker-$(1) - akri-docker-$(1): $(1)-build $(1)-docker-per-arch $(1)-docker-multi-arch-create $(1)-docker-multi-arch-push - $(1)-build: $(1)-build-amd64 $(1)-build-arm32 $(1)-build-arm64 - $(1)-docker-per-arch: $(1)-docker-per-arch-amd64 $(1)-docker-per-arch-arm32 $(1)-docker-per-arch-arm64 - - $(1)-build-amd64: - ifeq (1, ${BUILD_AMD64}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) --build-arg PLATFORM=$(AMD64_SUFFIX) - endif - $(1)-build-arm32: - ifeq (1, ${BUILD_ARM32}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) --build-arg PLATFORM=$(ARM32V7_SUFFIX) - endif - $(1)-build-arm64: - ifeq (1, ${BUILD_ARM64}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) --build-arg PLATFORM=$(ARM64V8_SUFFIX) - endif - - $(1)-docker-per-arch-amd64: - ifeq (1, ${BUILD_AMD64}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) - endif - $(1)-docker-per-arch-arm32: - ifeq (1, ${BUILD_ARM32}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) - endif - $(1)-docker-per-arch-arm64: - ifeq (1, ${BUILD_ARM64}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) - endif - - $(1)-docker-multi-arch-create: - ifeq (1, ${BUILD_AMD64}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) - endif - ifeq (1, ${BUILD_ARM32}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) - endif - ifeq (1, ${BUILD_ARM64}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) - endif - - $(1)-docker-multi-arch-push: - $(ENABLE_DOCKER_MANIFEST) docker manifest push $(PREFIX)/$(2):$(LABEL_PREFIX) - -endef diff --git a/build/akri-rust-containers.mk b/build/akri-rust-containers.mk deleted file mode 100644 index ef6b8bc37..000000000 --- a/build/akri-rust-containers.mk +++ /dev/null @@ -1,49 +0,0 @@ - -# Create set of targets for rust builds -define add_rust_targets - akri-$(1): akri-build akri-docker-$(1) - akri-docker-$(1): $(1)-build $(1)-docker-per-arch $(1)-docker-multi-arch-create $(1)-docker-multi-arch-push - $(1)-build: $(1)-build-amd64 $(1)-build-arm32 $(1)-build-arm64 - $(1)-docker-per-arch: $(1)-docker-per-arch-amd64 $(1)-docker-per-arch-arm32 $(1)-docker-per-arch-arm64 - - $(1)-build-amd64: - ifeq (1, ${BUILD_AMD64}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) --build-arg PLATFORM=$(AMD64_SUFFIX) --build-arg CROSS_BUILD_TARGET=$(AMD64_TARGET) --build-arg BUILD_TYPE=$(if $(BUILD_RELEASE_FLAG),release,debug) - endif - $(1)-build-arm32: - ifeq (1, ${BUILD_ARM32}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) --build-arg PLATFORM=$(ARM32V7_SUFFIX) --build-arg CROSS_BUILD_TARGET=$(ARM32V7_TARGET) --build-arg BUILD_TYPE=$(if $(BUILD_RELEASE_FLAG),release,debug) - endif - $(1)-build-arm64: - ifeq (1, ${BUILD_ARM64}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) --build-arg PLATFORM=$(ARM64V8_SUFFIX) --build-arg CROSS_BUILD_TARGET=$(ARM64V8_TARGET) --build-arg BUILD_TYPE=$(if $(BUILD_RELEASE_FLAG),release,debug) - endif - - $(1)-docker-per-arch-amd64: - ifeq (1, ${BUILD_AMD64}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) - endif - $(1)-docker-per-arch-arm32: - ifeq (1, ${BUILD_ARM32}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) - endif - $(1)-docker-per-arch-arm64: - ifeq (1, ${BUILD_ARM64}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) - endif - - $(1)-docker-multi-arch-create: - ifeq (1, ${BUILD_AMD64}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) - endif - ifeq (1, ${BUILD_ARM32}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) - endif - ifeq (1, ${BUILD_ARM64}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) - endif - - $(1)-docker-multi-arch-push: - $(ENABLE_DOCKER_MANIFEST) docker manifest push $(PREFIX)/$(2):$(LABEL_PREFIX) - -endef diff --git a/build/containers/Dockerfile.agent b/build/containers/Dockerfile.agent deleted file mode 100644 index f2515197a..000000000 --- a/build/containers/Dockerfile.agent +++ /dev/null @@ -1,33 +0,0 @@ -ARG PLATFORM=amd64 -ARG CROSS_BUILD_TARGET=x86_64-unknown-linux-gnu -FROM ${PLATFORM}/debian:bullseye-slim -ARG CROSS_BUILD_TARGET -ARG PLATFORM -ARG BUILD_TYPE=release -RUN echo "Creating container based on ${PLATFORM}/debian:bullseye-slim" -RUN echo "Using Rust binaries from ${CROSS_BUILD_TARGET}/${BUILD_TYPE}" - -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri - -# Install crictl and openssl dependencies -RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev openssl wget ca-certificates && \ - echo "Container platform target is ${PLATFORM}" && \ - if [ "$PLATFORM" = "arm32v7" ] ; \ - then export CRICTL_PLATFORM="arm" ; \ - elif [ "$PLATFORM" = "arm64v8" ] ; \ - then export CRICTL_PLATFORM="arm64" ; \ - elif [ "$PLATFORM" = "amd64" ] ; \ - then export CRICTL_PLATFORM="amd64" ; \ - else echo "no PLATFORM provided. Using amd64 for crictl" && export CRICTL_PLATFORM="amd64" ; \ - fi && \ - echo "CRICTL platform target is ${CRICTL_PLATFORM}" && \ - VERSION="v1.17.0" && \ - wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-$CRICTL_PLATFORM.tar.gz -O crictl.tar.gz && \ - tar zxvf crictl.tar.gz -C /usr/local/bin && \ - rm -f crictl.tar.gz && \ - apt-get remove -y wget ca-certificates && apt-get clean - -COPY ./target/${CROSS_BUILD_TARGET}/${BUILD_TYPE}/agent /agent -ENV RUST_LOG agent,akri_shared -ENTRYPOINT ["./agent"] diff --git a/build/containers/Dockerfile.agent-full b/build/containers/Dockerfile.agent-full deleted file mode 100644 index cd4988c24..000000000 --- a/build/containers/Dockerfile.agent-full +++ /dev/null @@ -1,32 +0,0 @@ -ARG PLATFORM=amd64 -ARG CROSS_BUILD_TARGET=x86_64-unknown-linux-gnu -FROM ${PLATFORM}/debian:bullseye-slim -ARG PLATFORM -ARG CROSS_BUILD_TARGET -ARG BUILD_TYPE=release -RUN echo "Creating container based on ${PLATFORM}/debian:bullseye-slim" -RUN echo "Using Rust binaries from ${CROSS_BUILD_TARGET}/${BUILD_TYPE}" - -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri - -RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev openssl wget ca-certificates && \ - echo "Container platform target is ${PLATFORM}" && \ - if [ "$PLATFORM" = "arm32v7" ] ; \ - then export CRICTL_PLATFORM="arm" ; \ - elif [ "$PLATFORM" = "arm64v8" ] ; \ - then export CRICTL_PLATFORM="arm64" ; \ - elif [ "$PLATFORM" = "amd64" ] ; \ - then export CRICTL_PLATFORM="amd64" ; \ - else echo "no PLATFORM provided. Using amd64 for crictl" && export CRICTL_PLATFORM="amd64" ; \ - fi && \ - echo "CRICTL platform target is ${CRICTL_PLATFORM}" && \ - VERSION="v1.17.0" && \ - wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-$CRICTL_PLATFORM.tar.gz -O crictl.tar.gz && \ - tar zxvf crictl.tar.gz -C /usr/local/bin && \ - rm -f crictl.tar.gz && \ - apt-get remove -y wget ca-certificates && apt-get clean - -COPY ./target/${CROSS_BUILD_TARGET}/${BUILD_TYPE}/agent-full /agent -ENV RUST_LOG agent,akri_shared,akri_debug_echo -ENTRYPOINT ["./agent"] diff --git a/build/containers/Dockerfile.anomaly-detection-app b/build/containers/Dockerfile.anomaly-detection-app deleted file mode 100644 index 0f6e953ff..000000000 --- a/build/containers/Dockerfile.anomaly-detection-app +++ /dev/null @@ -1,19 +0,0 @@ -ARG PLATFORM=amd64 -FROM ${PLATFORM}/debian:bullseye-slim - -# Avoid tzdata prompt -ARG DEBIAN_FRONTEND=noninteractive - -WORKDIR /app -COPY ./samples/apps/anomaly-detection-app . - -RUN echo "Creating container based on ${PLATFORM}/debian:bullseye-slim" && \ - apt-get update && \ - apt-get install -y protobuf-compiler libprotoc-dev python3-pip python3-sklearn && \ - apt-get clean && \ - pip3 install -r ./requirements.txt - -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri - -CMD python3 ./anomaly_detection.py \ No newline at end of file diff --git a/build/containers/Dockerfile.controller b/build/containers/Dockerfile.controller deleted file mode 100644 index 40ac5d2cc..000000000 --- a/build/containers/Dockerfile.controller +++ /dev/null @@ -1,15 +0,0 @@ -ARG PLATFORM=amd64 -ARG CROSS_BUILD_TARGET=x86_64-unknown-linux-gnu -FROM ${PLATFORM}/debian:bullseye-slim -ARG CROSS_BUILD_TARGET -ARG BUILD_TYPE=release -RUN echo "Creating container based on ${PLATFORM}/debian:bullseye-slim" -RUN echo "Using Rust binaries from ${CROSS_BUILD_TARGET}/${BUILD_TYPE}" - -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri - -RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev openssl && apt-get clean -COPY ./target/${CROSS_BUILD_TARGET}/${BUILD_TYPE}/controller /controller -ENV RUST_LOG controller,akri_shared -ENTRYPOINT ["./controller"] diff --git a/build/containers/Dockerfile.debug-echo-discovery b/build/containers/Dockerfile.debug-echo-discovery deleted file mode 100644 index 8b894204d..000000000 --- a/build/containers/Dockerfile.debug-echo-discovery +++ /dev/null @@ -1,15 +0,0 @@ -ARG PLATFORM=amd64 -ARG CROSS_BUILD_TARGET=x86_64-unknown-linux-gnu -FROM ${PLATFORM}/debian:bullseye-slim -ARG CROSS_BUILD_TARGET -ARG BUILD_TYPE=release -RUN echo "Creating container based on ${PLATFORM}/debian:bullseye-slim" -RUN echo "Using Rust binaries from ${CROSS_BUILD_TARGET}/${BUILD_TYPE}" - -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri - -RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev openssl && apt-get clean -COPY ./target/${CROSS_BUILD_TARGET}/${BUILD_TYPE}/debug-echo-discovery-handler /debug-echo-discovery-handler -ENV RUST_LOG debug_echo_discovery_handler,akri_shared,akri_discovery_utils,akri_debug_echo -ENTRYPOINT ["./debug-echo-discovery-handler"] diff --git a/build/containers/Dockerfile.onvif-discovery b/build/containers/Dockerfile.onvif-discovery deleted file mode 100644 index 687dba9ea..000000000 --- a/build/containers/Dockerfile.onvif-discovery +++ /dev/null @@ -1,15 +0,0 @@ -ARG PLATFORM=amd64 -ARG CROSS_BUILD_TARGET=x86_64-unknown-linux-gnu -FROM ${PLATFORM}/debian:bullseye-slim -ARG CROSS_BUILD_TARGET -ARG BUILD_TYPE=release -RUN echo "Creating container based on ${PLATFORM}/debian:bullseye-slim" -RUN echo "Using Rust binaries from ${CROSS_BUILD_TARGET}/${BUILD_TYPE}" - -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri - -RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev openssl && apt-get clean -COPY ./target/${CROSS_BUILD_TARGET}/${BUILD_TYPE}/onvif-discovery-handler /onvif-discovery-handler -ENV RUST_LOG onvif_discovery_handler,akri_shared,akri_discovery_utils,akri_onvif -ENTRYPOINT ["./onvif-discovery-handler"] diff --git a/build/containers/Dockerfile.opcua-discovery b/build/containers/Dockerfile.opcua-discovery deleted file mode 100644 index 3fa59de49..000000000 --- a/build/containers/Dockerfile.opcua-discovery +++ /dev/null @@ -1,15 +0,0 @@ -ARG PLATFORM=amd64 -ARG CROSS_BUILD_TARGET=x86_64-unknown-linux-gnu -FROM ${PLATFORM}/debian:bullseye-slim -ARG CROSS_BUILD_TARGET -ARG BUILD_TYPE=release -RUN echo "Creating container based on ${PLATFORM}/debian:bullseye-slim" -RUN echo "Using Rust binaries from ${CROSS_BUILD_TARGET}/${BUILD_TYPE}" - -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri - -RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev openssl && apt-get clean -COPY ./target/${CROSS_BUILD_TARGET}/${BUILD_TYPE}/opcua-discovery-handler /opcua-discovery-handler -ENV RUST_LOG opcua_discovery_handler,akri_shared,akri_discovery_utils,akri_opcua -ENTRYPOINT ["./opcua-discovery-handler"] diff --git a/build/containers/Dockerfile.opcua-monitoring-broker b/build/containers/Dockerfile.opcua-monitoring-broker index 1e3c97885..40a2e2e08 100644 --- a/build/containers/Dockerfile.opcua-monitoring-broker +++ b/build/containers/Dockerfile.opcua-monitoring-broker @@ -1,23 +1,16 @@ -ARG BUILD_PLATFORM_TAG=3.1-bullseye -ARG OUTPUT_PLATFORM_TAG=3.1-bullseye-slim -ARG DOTNET_PUBLISH_RUNTIME=linux-x64 - -FROM mcr.microsoft.com/dotnet/sdk:${BUILD_PLATFORM_TAG} AS build -ARG BUILD_PLATFORM_TAG -RUN echo "Build base image: mcr.microsoft.com/dotnet/sdk:${BUILD_PLATFORM_TAG}" +FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:6.0-bookworm-slim AS build WORKDIR /src COPY ["samples/brokers/opcua-monitoring-broker/opcua-monitoring-broker.csproj", "."] RUN dotnet restore "opcua-monitoring-broker.csproj" COPY ["samples/brokers/opcua-monitoring-broker", "."] -ARG DOTNET_PUBLISH_RUNTIME -RUN echo "Publishing to: ${DOTNET_PUBLISH_RUNTIME}" -RUN dotnet publish -r ${DOTNET_PUBLISH_RUNTIME} "opcua-monitoring-broker.csproj" -c Release -o /app/publish +ARG TARGETARCH +RUN DOTNET_PUBLISH_RUNTIME="linux-$(echo ${TARGETARCH} | sed 's/amd/x/')"; \ + echo "Publishing to: ${DOTNET_PUBLISH_RUNTIME}" && \ + dotnet publish -r ${DOTNET_PUBLISH_RUNTIME} "opcua-monitoring-broker.csproj" -c Release -o /app/publish -FROM mcr.microsoft.com/dotnet/aspnet:${OUTPUT_PLATFORM_TAG} AS final -ARG OUTPUT_PLATFORM_TAG -RUN echo "Output base image: mcr.microsoft.com/dotnet/aspnet:${OUTPUT_PLATFORM_TAG}" +FROM mcr.microsoft.com/dotnet/aspnet:6.0-bookworm-slim AS final WORKDIR /app COPY --from=build /app/publish . diff --git a/build/containers/Dockerfile.python-app b/build/containers/Dockerfile.python-app new file mode 100644 index 000000000..00e53d8ad --- /dev/null +++ b/build/containers/Dockerfile.python-app @@ -0,0 +1,23 @@ +ARG PYTHON_VERSION=3.9 +FROM python:${PYTHON_VERSION}-bookworm + +# Avoid tzdata prompt +ARG DEBIAN_FRONTEND=noninteractive +RUN echo "Creating container based on debian:bullseye-slim for ${TARGETPLATFORM}" && \ + apt-get update && \ + apt-get install -y protobuf-compiler libprotoc-dev && \ + apt-get clean + +WORKDIR /app + +ARG APPLICATION +COPY ./samples/apps/${APPLICATION}/requirements.txt . + +RUN pip3 install --no-cache-dir -r ./requirements.txt + +COPY ./samples/apps/${APPLICATION} . + +# Link the container to the Akri repository +LABEL org.opencontainers.image.source https://github.com/project-akri/akri + +CMD [ "python3", "./app.py" ] \ No newline at end of file diff --git a/build/containers/Dockerfile.rust b/build/containers/Dockerfile.rust new file mode 100644 index 000000000..8068e93a8 --- /dev/null +++ b/build/containers/Dockerfile.rust @@ -0,0 +1,40 @@ +FROM --platform=$BUILDPLATFORM tonistiigi/xx:master AS xx + +FROM --platform=$BUILDPLATFORM rust:1.72-slim-bookworm AS build +RUN rustup component add rustfmt +RUN apt-get update && apt-get install -y clang lld protobuf-compiler pkg-config mmdebstrap wget +COPY --from=xx / / +ARG TARGETPLATFORM + +# See https://github.com/tonistiigi/xx/issues/108 +RUN sed -i -E 's/xx-clang --setup-target-triple/XX_VENDOR=\$vendor ARM_TARGET_ARCH="" xx-clang --setup-target-triple/' $(which xx-cargo) && \ + sed -i -E 's/\$\(xx-info\)-/\$\(XX_VENDOR=\$vendor ARM_TARGET_ARCH="" xx-info\)-/g' $(which xx-cargo) + +# Generate minimal runtime environment +RUN mmdebstrap --architectures=$(xx-info debian-arch) --include=libc6,libssl3,libudev1,libv4l-0,busybox --variant=extract bookworm /installroot +RUN mkdir -p /installroot/usr/local/bin /build/bin && for tool in sh uniq tail sort grep cut; do ln -s /bin/busybox /installroot/bin/$tool; done + + +RUN xx-apt-get install -y xx-c-essentials libssl-dev libudev-dev libv4l-dev pkg-config +COPY . /app +WORKDIR /app +ARG EXTRA_CARGO_ARGS +RUN XX_DEBUG_CARGO=1 xx-cargo build ${EXTRA_CARGO_ARGS} +ARG AKRI_COMPONENT +RUN PROFILE=$(echo "${EXTRA_CARGO_ARGS}" | grep -q -- --release && echo "release" || echo "debug"); \ + xx-verify ./target/$(xx-cargo --print-target-triple)/${PROFILE}/${AKRI_COMPONENT}\ + && cp ./target/$(xx-cargo --print-target-triple)/${PROFILE}/${AKRI_COMPONENT} /build/bin/akri +# Prepare crictl for agent +RUN VERSION=v1.25.0; if [ "x${AKRI_COMPONENT}" = "xagent" ]; then wget \ + "https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-$(xx-info arch).tar.gz" -O crictl.tar.gz\ + && tar zxvf crictl.tar.gz -C /build/bin; fi + + +FROM scratch +COPY --from=build /installroot / +COPY --from=build /build/bin /usr/local/bin +ENV RUST_LOG agent,akri_debug_echo,akri_discovery_utils,akri_onvif,akri_opcua,akri_shared,akri_udev\ +,controller,debug_echo_discovery_handler,onvif_discovery_handler,opcua_discovery_handler,udev_discovery_handler +# Using a fixed value here as we can't use any variable in entrypoint +ENTRYPOINT [ "/usr/local/bin/akri" ] + diff --git a/build/containers/Dockerfile.udev-discovery b/build/containers/Dockerfile.udev-discovery deleted file mode 100644 index 9f472d0de..000000000 --- a/build/containers/Dockerfile.udev-discovery +++ /dev/null @@ -1,15 +0,0 @@ -ARG PLATFORM=amd64 -ARG CROSS_BUILD_TARGET=x86_64-unknown-linux-gnu -FROM ${PLATFORM}/debian:bullseye-slim -ARG CROSS_BUILD_TARGET -ARG BUILD_TYPE=release -RUN echo "Creating container based on ${PLATFORM}/debian:bullseye-slim" -RUN echo "Using Rust binaries from ${CROSS_BUILD_TARGET}/${BUILD_TYPE}" - -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri - -RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev openssl && apt-get clean -COPY ./target/${CROSS_BUILD_TARGET}/${BUILD_TYPE}/udev-discovery-handler /udev-discovery-handler -ENV RUST_LOG udev-discovery-handler,akri_shared,akri_discovery_utils,akri_udev -ENTRYPOINT ["./udev-discovery-handler"] diff --git a/build/containers/Dockerfile.udev-video-broker b/build/containers/Dockerfile.udev-video-broker deleted file mode 100644 index 5866dbd4b..000000000 --- a/build/containers/Dockerfile.udev-video-broker +++ /dev/null @@ -1,20 +0,0 @@ -ARG PLATFORM=amd64 -ARG CROSS_BUILD_TARGET=x86_64-unknown-linux-gnu -FROM ${PLATFORM}/debian:bullseye-slim -ARG CROSS_BUILD_TARGET -RUN echo "Creating container based on ${PLATFORM}/debian:bullseye-slim" -RUN echo "Using Rust binaries from ${CROSS_BUILD_TARGET}" - -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri - -RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev openssl \ - libv4l-dev && \ - apt-get clean -COPY ./target/${CROSS_BUILD_TARGET}/release/udev-video-broker /udev-video-broker - -# Expose port used by broker service -EXPOSE 8083 - -ENV RUST_LOG udev_video_broker -ENTRYPOINT ["./udev-video-broker"] diff --git a/build/containers/Dockerfile.video-streaming-app b/build/containers/Dockerfile.video-streaming-app deleted file mode 100644 index c97a438c4..000000000 --- a/build/containers/Dockerfile.video-streaming-app +++ /dev/null @@ -1,19 +0,0 @@ -ARG PLATFORM=amd64 -FROM ${PLATFORM}/debian:bullseye-slim - -# Avoid tzdata prompt -ARG DEBIAN_FRONTEND=noninteractive - -WORKDIR /app -COPY ./samples/apps/video-streaming-app . - -RUN echo "Creating container based on ${PLATFORM}/debian:bullseye-slim" && \ - apt-get update && \ - apt-get install -y protobuf-compiler libprotoc-dev python3-pip && \ - apt-get clean && \ - pip3 install -r ./requirements.txt - -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri - -CMD python3 ./streaming.py \ No newline at end of file diff --git a/build/containers/Dockerfile.webhook-configuration b/build/containers/Dockerfile.webhook-configuration deleted file mode 100644 index 58e518469..000000000 --- a/build/containers/Dockerfile.webhook-configuration +++ /dev/null @@ -1,21 +0,0 @@ -ARG PLATFORM=amd64 -ARG CROSS_BUILD_TARGET=x86_64-unknown-linux-gnu - -FROM ${PLATFORM}/debian:bullseye-slim - -ARG CROSS_BUILD_TARGET -ARG BUILD_TYPE=release -RUN echo "Creating container based on ${PLATFORM}/debian:bullseye-slim" -RUN echo "Using Rust binaries from ${CROSS_BUILD_TARGET}/${BUILD_TYPE}" - -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri - -RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev openssl && apt-get clean - -COPY ./target/${CROSS_BUILD_TARGET}/${BUILD_TYPE}/webhook-configuration /server - -ENV RUST_LOG agent,akri_shared - -ENTRYPOINT ["/server"] -# ENTRYPOINT ["/server", "--tls-crt-file=/path/to/crt", "--tls-key-file=/path/to/key", "--port=8443"] diff --git a/build/containers/intermediate/Dockerfile.opencvsharp-build b/build/containers/intermediate/Dockerfile.opencvsharp-build index 433c4bcda..d8a909a79 100644 --- a/build/containers/intermediate/Dockerfile.opencvsharp-build +++ b/build/containers/intermediate/Dockerfile.opencvsharp-build @@ -8,65 +8,74 @@ # A second Pull Request should subsequently be made to update # Makefile's USE_OPENCV_BASE_VERSION. # +# This Dockerfile is a port (with cross-compilation addition) of the +# official upstream Dockerfile: +# https://github.com/shimat/opencvsharp/blob/main/docker/ubuntu22-dotnet6-opencv4.8.0/Dockerfile -ARG PLATFORM= -FROM mcr.microsoft.com/dotnet/aspnet:3.1-bullseye-slim${PLATFORM} AS base -WORKDIR /app +ARG OPENCV_SHARP_VERSION="4.8.0.20230711" -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri +FROM --platform=$BUILDPLATFORM tonistiigi/xx:master AS xx -# based on https://xaviergeerinck.com/opencv-in-dotnet-core -ENV OPENCV_VERSION="4.5.4" -ENV OPENCV_INSTALLATION_DIR="/opt/opencv/" -ENV OPENCV_SHARP_VERSION="4.5.3.20210821" +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0-bookworm-slim as builder + +ENV DEBIAN_FRONTEND=noninteractive +#ENV OPENCV_VERSION=${OPENCV_SHARP_VERSION%.*} + +WORKDIR / +COPY --from=xx / / -# Install opencv dependencies RUN apt-get update && apt-get -y install --no-install-recommends \ - apt-transport-https \ - software-properties-common \ - wget \ - unzip \ - ca-certificates \ - build-essential \ - cmake \ - git \ - libtbb-dev \ - libatlas-base-dev \ - libgtk2.0-dev \ - libavcodec-dev \ - libavformat-dev \ - libswscale-dev \ - libdc1394-22-dev \ - libxine2-dev \ - libv4l-dev \ - libtheora-dev \ - libvorbis-dev \ - libxvidcore-dev \ - libopencore-amrnb-dev \ - libopencore-amrwb-dev \ - libavresample-dev \ - x264 \ - libtesseract-dev \ - libgdiplus \ - && apt-get -y clean \ - && rm -rf /var/lib/apt/lists/* + apt-transport-https \ + software-properties-common \ + wget \ + unzip \ + ca-certificates \ + build-essential \ + cmake \ + git \ + clang + +ARG TARGETPLATFORM + +# Install opencv dependencies +RUN xx-apt install -y xx-c-essentials xx-cxx-essentials \ + libtbb-dev \ + libatlas-base-dev \ + libgtk2.0-dev \ + libx11-dev \ + liblerc-dev \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + libdc1394-dev \ + libxine2-dev \ + libv4l-dev \ + libtheora-dev \ + libvorbis-dev \ + libxvidcore-dev \ + libopencore-amrnb-dev \ + libopencore-amrwb-dev \ + x264 \ + libtesseract-dev \ + libgdiplus + +ARG OPENCV_SHARP_VERSION +# Setup opencv and opencv-contrib source +RUN OPENCV_VERSION=${OPENCV_SHARP_VERSION%.*}; \ + wget -q https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \ + unzip -q ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv-${OPENCV_VERSION} opencv && \ + wget -q https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \ + unzip -q ${OPENCV_VERSION}.zip && \ + rm ${OPENCV_VERSION}.zip && \ + mv opencv_contrib-${OPENCV_VERSION} opencv_contrib -RUN mkdir ${OPENCV_INSTALLATION_DIR} && \ - cd ${OPENCV_INSTALLATION_DIR} && \ - wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip -Oopencv-${OPENCV_VERSION}.zip && \ - unzip opencv-${OPENCV_VERSION}.zip && \ - wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip -Oopencv_contrib-${OPENCV_VERSION}.zip && \ - unzip opencv_contrib-${OPENCV_VERSION}.zip && \ - rm ${OPENCV_INSTALLATION_DIR}/*.zip && \ - cd ${OPENCV_INSTALLATION_DIR}/opencv-${OPENCV_VERSION} - - -RUN cd ${OPENCV_INSTALLATION_DIR}/opencv-${OPENCV_VERSION} && \ - mkdir build && cd build && \ - cmake \ +# Build OpenCV +RUN cd opencv && mkdir build && cd build && \ + cmake $(xx-clang --print-cmake-defines) \ + -D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \ -D CMAKE_BUILD_TYPE=RELEASE \ - -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-${OPENCV_VERSION}/modules \ -D BUILD_SHARED_LIBS=OFF \ -D ENABLE_CXX11=ON \ -D BUILD_EXAMPLES=OFF \ @@ -74,7 +83,7 @@ RUN cd ${OPENCV_INSTALLATION_DIR}/opencv-${OPENCV_VERSION} && \ -D BUILD_PERF_TESTS=OFF \ -D BUILD_TESTS=OFF \ -D BUILD_JAVA=OFF \ - -D BUILD_opencv_app=OFF \ + -D BUILD_opencv_apps=OFF \ -D BUILD_opencv_barcode=OFF \ -D BUILD_opencv_java_bindings_generator=OFF \ -D BUILD_opencv_js_bindings_generator=OFF \ @@ -98,62 +107,52 @@ RUN cd ${OPENCV_INSTALLATION_DIR}/opencv-${OPENCV_VERSION} && \ -D BUILD_opencv_structured_light=OFF \ -D BUILD_opencv_surface_matching=OFF \ -D BUILD_opencv_videostab=OFF \ - -D BUILD_opencv_wechat_qrcode=OFF \ + -D BUILD_opencv_wechat_qrcode=ON \ -D WITH_GSTREAMER=OFF \ -D WITH_ADE=OFF \ + -D WITH_IPP=OFF \ -D OPENCV_ENABLE_NONFREE=ON \ - .. && make -j$(nproc) && \ - make install -j8 && \ - ldconfig + .. && make -j$(nproc) && make install && ldconfig -RUN cd ${OPENCV_INSTALLATION_DIR} && \ - git clone --depth=1 --branch=${OPENCV_SHARP_VERSION} https://github.com/shimat/opencvsharp.git opencvsharp && \ - cd opencvsharp/src && \ - mkdir build && \ - cd build && \ - cmake -D CMAKE_INSTALL_PREFIX=${OPENCV_INSTALLATION_DIR} .. && \ - make -j$(nproc) && \ - make install && \ - ldconfig && \ - cp OpenCvSharpExtern/libOpenCvSharpExtern.so /usr/lib +# Download OpenCvSharp +RUN git clone --depth=1 --branch=${OPENCV_SHARP_VERSION} https://github.com/shimat/opencvsharp.git opencvsharp -# Don't force architecture here as it won't be working as expected -FROM mcr.microsoft.com/dotnet/sdk:3.1-bullseye AS build-dotnet-env +# Install the Extern lib. +RUN mkdir /opencvsharp/make && cd /opencvsharp/make && \ + cmake $(xx-clang --print-cmake-defines) -D CMAKE_INSTALL_PREFIX=/opencvsharp/make /opencvsharp/src && \ + make -j$(nproc) && make install && \ + rm -rf /opencv && \ + rm -rf /opencv_contrib && \ + cp /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so /usr/lib/ -ARG PLATFORM - -ENV OPENCV_SHARP_VERSION="4.5.3.20210821" -ENV ARCH=${PLATFORM:--x64} - -WORKDIR / -COPY --from=base /usr/lib/libOpenCvSharpExtern.so ./ -RUN git clone --depth=1 --branch=${OPENCV_SHARP_VERSION} https://github.com/shimat/opencvsharp.git +RUN xx-verify /opencvsharp/make/OpenCvSharpExtern/libOpenCvSharpExtern.so +ARG BUILDPLATFORM # Install Build the C# part of OpenCvSharp -RUN cd /opencvsharp/src/OpenCvSharp && \ - dotnet build -r linux${ARCH%32} -c Release -f netstandard2.0 +RUN DOTNET_PUBLISH_RUNTIME="linux-$(echo ${TARGETARCH} | sed 's/amd/x/')"; \ + cd /opencvsharp/src/OpenCvSharp && \ + dotnet build --no-self-contained -r ${DOTNET_PUBLISH_RUNTIME} -c Release -f net6.0 && \ + cd /opencvsharp/src/OpenCvSharp.Extensions && \ + dotnet build --no-self-contained -r ${DOTNET_PUBLISH_RUNTIME} -c Release -f net6.0 + +RUN mkdir /artifacts && cd /artifacts && \ + cp /opencvsharp/src/OpenCvSharp/bin/Release/net6.0/*/* . && \ + cp /opencvsharp/src/OpenCvSharp.Extensions/bin/Release/net6.0/*/* . -RUN cd /opencvsharp/src/OpenCvSharp.Extensions && \ - dotnet build -r linux${ARCH%32} -c Release -f netstandard2.0 +########## Final image ########## -RUN mkdir /opencvsharp/build && \ - cd /opencvsharp/build && \ - cp /opencvsharp/src/OpenCvSharp/bin/$([ -n "$PLATFORM" ] && echo "*")/Release/netstandard2.0/*/* . && \ - cp /opencvsharp/src/OpenCvSharp.Extensions/bin/$([ -n "$PLATFORM" ] && echo "*")/Release/netstandard2.0/*/* . - -# Copy over OpenCvSharp binaries and OpenCvSharpExtern shared library -FROM mcr.microsoft.com/dotnet/aspnet:3.1-bullseye-slim${PLATFORM} +FROM mcr.microsoft.com/dotnet/aspnet:6.0-bookworm-slim as final WORKDIR /app -COPY --from=build-dotnet-env /opencvsharp/build ./ -COPY --from=build-dotnet-env /libOpenCvSharpExtern.so /usr/lib # Install OpenCVSharpExtern dependencies RUN apt-get update && apt-get -y install --no-install-recommends \ libgtk2.0-dev \ libavcodec-dev \ libavformat-dev \ libswscale-dev \ - libdc1394-22-dev \ - libavresample-dev \ + libdc1394-dev \ libtesseract-dev \ && apt-get -y clean \ && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /usr/lib/libOpenCvSharpExtern.so /usr/lib +COPY --from=builder /artifacts ./ diff --git a/build/containers/intermediate/Dockerfile.rust-crossbuild-amd64 b/build/containers/intermediate/Dockerfile.rust-crossbuild-amd64 deleted file mode 100644 index 1ee0df805..000000000 --- a/build/containers/intermediate/Dockerfile.rust-crossbuild-amd64 +++ /dev/null @@ -1,20 +0,0 @@ -# -# This Dockerfile is used to create intermediate containers used -# by the Akri build. -# -# Any changes to this file need to be made in its own Pull Request -# and need include a change to Makefile's BUILD_RUST_CROSSBUILD_VERSION. -# -# A second Pull Request should subsequently be made to update -# Cross.toml to point at the new versions. -# - -FROM rustembedded/cross:x86_64-unknown-linux-gnu-0.1.16 - -RUN apt-get update && \ - apt-get install -y --no-install-recommends pkg-config \ - g++ ca-certificates curl libssl-dev \ - libv4l-dev libudev-dev protobuf-compiler - -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri diff --git a/build/containers/intermediate/Dockerfile.rust-crossbuild-arm32v7 b/build/containers/intermediate/Dockerfile.rust-crossbuild-arm32v7 deleted file mode 100644 index 447430d53..000000000 --- a/build/containers/intermediate/Dockerfile.rust-crossbuild-arm32v7 +++ /dev/null @@ -1,25 +0,0 @@ -# -# This Dockerfile is used to create intermediate containers used -# by the Akri build. -# -# Any changes to this file need to be made in its own Pull Request -# and need include a change to Makefile's BUILD_RUST_CROSSBUILD_VERSION. -# -# A second Pull Request should subsequently be made to update -# Cross.toml to point at the new versions. -# - -FROM rustembedded/cross:armv7-unknown-linux-gnueabihf-0.1.16 - -RUN sed -i 's/^deb h'/'deb [arch=amd64,i386] h/' /etc/apt/sources.list && \ - dpkg --add-architecture armhf && \ - echo deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -c -s) main restricted universe multiverse >> /etc/apt/sources.list && \ - echo deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -c -s)-updates main restricted universe multiverse >> /etc/apt/sources.list && \ - echo deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -c -s)-backports main restricted universe multiverse >> /etc/apt/sources.list && \ - apt-get update && \ - apt-get install -y --no-install-recommends pkg-config:armhf \ - g++ ca-certificates curl libssl-dev:armhf \ - libv4l-dev:armhf libudev-dev:armhf protobuf-compiler:armhf - -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri diff --git a/build/containers/intermediate/Dockerfile.rust-crossbuild-arm64v8 b/build/containers/intermediate/Dockerfile.rust-crossbuild-arm64v8 deleted file mode 100644 index 1088ac0b4..000000000 --- a/build/containers/intermediate/Dockerfile.rust-crossbuild-arm64v8 +++ /dev/null @@ -1,25 +0,0 @@ -# -# This Dockerfile is used to create intermediate containers used -# by the Akri build. -# -# Any changes to this file need to be made in its own Pull Request -# and need include a change to Makefile's BUILD_RUST_CROSSBUILD_VERSION. -# -# A second Pull Request should subsequently be made to update -# Cross.toml to point at the new versions. -# - -FROM rustembedded/cross:aarch64-unknown-linux-gnu-0.1.16 - -RUN sed -i 's/^deb h'/'deb [arch=amd64,i386] h/' /etc/apt/sources.list && \ - dpkg --add-architecture arm64 && \ - echo deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -c -s) main restricted universe multiverse >> /etc/apt/sources.list && \ - echo deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -c -s)-updates main restricted universe multiverse >> /etc/apt/sources.list && \ - echo deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -c -s)-backports main restricted universe multiverse >> /etc/apt/sources.list && \ - apt-get update && \ - apt-get install -y --no-install-recommends pkg-config:arm64 \ - g++ ca-certificates curl libssl-dev:arm64 \ - libv4l-dev:arm64 libudev-dev:arm64 protobuf-compiler:arm64 - -# Link the container to the Akri repository -LABEL org.opencontainers.image.source https://github.com/project-akri/akri diff --git a/build/intermediate-containers.mk b/build/intermediate-containers.mk index efdae79c0..2ae108093 100644 --- a/build/intermediate-containers.mk +++ b/build/intermediate-containers.mk @@ -1,82 +1,13 @@ - -BUILD_RUST_CROSSBUILD_VERSION = 0.0.8 - -BUILD_OPENCV_BASE_VERSION = 0.0.11 - -CROSS_VERSION = 0.1.16 +BUILD_OPENCV_BASE_VERSION = 0.1.0 # # # OPENCV: make and push the open cv intermediate images: # # To make all platforms: `make opencv-base` -# To make specific platforms: `BUILD_AMD64=1 BUILD_ARM32=0 BUILD_ARM64=1 make opencv-base` +# To make specific platforms: `PLATFORMS="amd64 arm/v7" make opencv-base` # # .PHONY: opencv-base -opencv-base: opencv-base-build opencv-base-docker-per-arch -opencv-base-build: opencv-base-build-amd64 opencv-base-build-arm32 opencv-base-build-arm64 -opencv-base-build-amd64: -ifeq (1, ${BUILD_AMD64}) -# No PLATFORM build arg for amd64 as the aspnet images for amd64 are not suffixed - docker build $(CACHE_OPTION) -f $(INTERMEDIATE_DOCKERFILE_DIR)/Dockerfile.opencvsharp-build . -t $(PREFIX)/opencvsharp-build:$(BUILD_OPENCV_BASE_VERSION)-$(AMD64_SUFFIX) -endif -opencv-base-build-arm32: -ifeq (1, ${BUILD_ARM32}) - docker build $(CACHE_OPTION) -f $(INTERMEDIATE_DOCKERFILE_DIR)/Dockerfile.opencvsharp-build . -t $(PREFIX)/opencvsharp-build:$(BUILD_OPENCV_BASE_VERSION)-$(ARM32V7_SUFFIX) --build-arg PLATFORM=-$(ARM32V7_SUFFIX) -endif -opencv-base-build-arm64: -ifeq (1, ${BUILD_ARM64}) - docker build $(CACHE_OPTION) -f $(INTERMEDIATE_DOCKERFILE_DIR)/Dockerfile.opencvsharp-build . -t $(PREFIX)/opencvsharp-build:$(BUILD_OPENCV_BASE_VERSION)-$(ARM64V8_SUFFIX) --build-arg PLATFORM=-$(ARM64V8_SUFFIX) -endif -opencv-base-docker-per-arch: opencv-base-docker-per-arch-amd64 opencv-base-docker-per-arch-arm32 opencv-base-docker-per-arch-arm64 -opencv-base-docker-per-arch-amd64: -ifeq (1, ${BUILD_AMD64}) - docker push $(PREFIX)/opencvsharp-build:$(BUILD_OPENCV_BASE_VERSION)-$(AMD64_SUFFIX) -endif -opencv-base-docker-per-arch-arm32: -ifeq (1, ${BUILD_ARM32}) - docker push $(PREFIX)/opencvsharp-build:$(BUILD_OPENCV_BASE_VERSION)-$(ARM32V7_SUFFIX) -endif -opencv-base-docker-per-arch-arm64: -ifeq (1, ${BUILD_ARM64}) - docker push $(PREFIX)/opencvsharp-build:$(BUILD_OPENCV_BASE_VERSION)-$(ARM64V8_SUFFIX) -endif - -# -# -# CROSS: make and push the intermediate images for the cross building Rust: -# -# To make all platforms: `make rust-crossbuild` -# To make specific platforms: `BUILD_AMD64=1 BUILD_ARM32=0 BUILD_ARM64=1 make rust-crossbuild` -# -# -.PHONY: rust-crossbuild -rust-crossbuild: rust-crossbuild-build rust-crossbuild-docker-per-arch -rust-crossbuild-build: rust-crossbuild-build-amd64 rust-crossbuild-build-arm32 rust-crossbuild-build-arm64 -rust-crossbuild-build-amd64: -ifeq (1, $(BUILD_AMD64)) - docker build $(CACHE_OPTION) -f $(INTERMEDIATE_DOCKERFILE_DIR)/Dockerfile.rust-crossbuild-$(AMD64_SUFFIX) . -t $(PREFIX)/rust-crossbuild:$(AMD64_TARGET)-$(CROSS_VERSION)-$(BUILD_RUST_CROSSBUILD_VERSION) -endif -rust-crossbuild-build-arm32: -ifeq (1, ${BUILD_ARM32}) - docker build $(CACHE_OPTION) -f $(INTERMEDIATE_DOCKERFILE_DIR)/Dockerfile.rust-crossbuild-$(ARM32V7_SUFFIX) . -t $(PREFIX)/rust-crossbuild:$(ARM32V7_TARGET)-$(CROSS_VERSION)-$(BUILD_RUST_CROSSBUILD_VERSION) -endif -rust-crossbuild-build-arm64: -ifeq (1, ${BUILD_ARM64}) - docker build $(CACHE_OPTION) -f $(INTERMEDIATE_DOCKERFILE_DIR)/Dockerfile.rust-crossbuild-$(ARM64V8_SUFFIX) . -t $(PREFIX)/rust-crossbuild:$(ARM64V8_TARGET)-$(CROSS_VERSION)-$(BUILD_RUST_CROSSBUILD_VERSION) -endif - -rust-crossbuild-docker-per-arch: rust-crossbuild-docker-per-arch-amd64 rust-crossbuild-docker-per-arch-arm32 rust-crossbuild-docker-per-arch-arm64 -rust-crossbuild-docker-per-arch-amd64: -ifeq (1, $(BUILD_AMD64)) - docker push $(PREFIX)/rust-crossbuild:$(AMD64_TARGET)-$(CROSS_VERSION)-$(BUILD_RUST_CROSSBUILD_VERSION) -endif -rust-crossbuild-docker-per-arch-arm32: -ifeq (1, ${BUILD_ARM32}) - docker push $(PREFIX)/rust-crossbuild:$(ARM32V7_TARGET)-$(CROSS_VERSION)-$(BUILD_RUST_CROSSBUILD_VERSION) -endif -rust-crossbuild-docker-per-arch-arm64: -ifeq (1, ${BUILD_ARM64}) - docker push $(PREFIX)/rust-crossbuild:$(ARM64V8_TARGET)-$(CROSS_VERSION)-$(BUILD_RUST_CROSSBUILD_VERSION) -endif +opencv-base: + docker buildx build $(COMMON_DOCKER_BUILD_ARGS) --tag "$(PREFIX)/opencvsharp-build:$(BUILD_OPENCV_BASE_VERSION)" --file $(DOCKERFILE_DIR)/Dockerfile.opencvsharp-build . \ No newline at end of file diff --git a/build/samples.mk b/build/samples.mk new file mode 100644 index 000000000..ee98add4a --- /dev/null +++ b/build/samples.mk @@ -0,0 +1,36 @@ +USE_OPENCV_BASE_VERSION = 0.0.11 + +.PHONY: samples +samples: opcua-monitoring-broker onvif-video-broker anomaly-detection-app video-streaming-app akri-udev-video-broker + +%-app: + docker buildx build $(COMMON_DOCKER_BUILD_ARGS) --build-arg APPLICATION=$@ --tag "$(PREFIX)/$@:$(LABEL_PREFIX)" --file $(DOCKERFILE_DIR)/Dockerfile.python-app . + +opcua-monitoring-broker: + docker buildx build $(COMMON_DOCKER_BUILD_ARGS) --tag "$(PREFIX)/opcua-monitoring-broker:$(LABEL_PREFIX)" --file $(DOCKERFILE_DIR)/Dockerfile.opcua-monitoring-broker . + +# Still use old-ish style for onvif-video-broker as app uses .NET 3.1 that doesn't have multi-arch manifest +onvif-video-broker: onvif-video-broker-multiarch + +onvif-video-broker-multiarch: onvif-video-broker-amd64 onvif-video-broker-arm64 onvif-video-broker-arm32 +ifeq (1, $(PUSH)) + docker buildx imagetool create --tag "$(PREFIX)/onvif-video-broker:$(LABEL_PREFIX)" +endif + +ONVIF_BUILDX_PUSH_OUTPUT = type=image,name=$(PREFIX)/onvif-video-broker,push-by-digest=true,name-canonical=true,push=true +ONVIF_BUILDX_ARGS = $(if $(LOAD), --load --tag $(PREFIX)/onvif-video-broker:$(LABEL_PREFIX)) $(if $(PUSH), --output $(ONVIF_BUILDX_PUSH_OUTPUT)) -f $(DOCKERFILE_DIR)/Dockerfile.onvif-video-broker + +onvif-video-broker-amd64: +ifneq (,or(findstring(amd64,$(PLATFORMS)), findstring(x86_64,$(PLATFORMS)))) + docker buildx build $(ONVIF_BUILDX_ARGS) $(if $(PUSH), --iidfile onvif-video-broker.sha-amd64) --build-arg OUTPUT_PLATFORM_TAG=$(USE_OPENCV_BASE_VERSION)-$(AMD64_SUFFIX) --build-arg DOTNET_PUBLISH_RUNTIME=linux-x64 . +endif + +onvif-video-broker-arm32: +ifneq (,findstring(arm/v7,$(PLATFORMS))) + docker buildx build $(ONVIF_BUILDX_ARGS) $(if $(PUSH), --iidfile onvif-video-broker.sha-arm32) --build-arg OUTPUT_PLATFORM_TAG=$(USE_OPENCV_BASE_VERSION)-$(ARM32V7_SUFFIX) --build-arg DOTNET_PUBLISH_RUNTIME=linux-arm . +endif + +onvif-video-broker-arm64: +ifneq (,or(findstring(aarch64,$(PLATFORMS)),findstring(arm64,$(PLATFORMS)))) + docker buildx build $(ONVIF_BUILDX_ARGS) $(if $(PUSH), --iidfile onvif-video-broker.sha-arm32) --build-arg OUTPUT_PLATFORM_TAG=$(USE_OPENCV_BASE_VERSION)-$(ARM64V8_SUFFIX) --build-arg DOTNET_PUBLISH_RUNTIME=linux-arm64 . +endif \ No newline at end of file diff --git a/deployment/helm/templates/webhook-configuration.yaml b/deployment/helm/templates/webhook-configuration.yaml index c8303d6d3..ea1d78d81 100644 --- a/deployment/helm/templates/webhook-configuration.yaml +++ b/deployment/helm/templates/webhook-configuration.yaml @@ -85,8 +85,6 @@ items: limits: memory: {{ .Values.webhookConfiguration.resources.memoryLimit }} cpu: {{ .Values.webhookConfiguration.resources.cpuLimit }} - command: - - /server args: - --tls-crt-file=/secrets/tls.crt - --tls-key-file=/secrets/tls.key @@ -164,4 +162,4 @@ items: - v1 - v1beta1 sideEffects: None -{{- end }} \ No newline at end of file +{{- end }} diff --git a/samples/apps/anomaly-detection-app/README.md b/samples/apps/anomaly-detection-app/README.md index f0a42e72e..e00bdea90 100644 --- a/samples/apps/anomaly-detection-app/README.md +++ b/samples/apps/anomaly-detection-app/README.md @@ -36,5 +36,5 @@ where the gRPC servers should be running. For example, if the servers are running at `localhost:80`, run the following: ```sh -CONFIGURATION_NAME="akri-opcua" AKRI_OPCUA_SVC_SERVICE_HOST=localhost AKRI_OPCUA_SVC_SERVICE_PORT_GRPC=80 python3 ./anomaly_detection.py +CONFIGURATION_NAME="akri-opcua" AKRI_OPCUA_SVC_SERVICE_HOST=localhost AKRI_OPCUA_SVC_SERVICE_PORT_GRPC=80 python3 ./app.py ``` \ No newline at end of file diff --git a/samples/apps/anomaly-detection-app/anomaly_detection.py b/samples/apps/anomaly-detection-app/app.py similarity index 100% rename from samples/apps/anomaly-detection-app/anomaly_detection.py rename to samples/apps/anomaly-detection-app/app.py diff --git a/samples/apps/video-streaming-app/README.md b/samples/apps/video-streaming-app/README.md index 849005958..1dbefcd1d 100644 --- a/samples/apps/video-streaming-app/README.md +++ b/samples/apps/video-streaming-app/README.md @@ -36,10 +36,10 @@ The streaming application works in two modes. 1. Explicitly target a set of cameras by setting `CAMERA_COUNT`, a service to target all cameras (`CAMERAS_SOURCE_SVC`), and services for each individual camera (`CAMERA1_SOURCE_SVC` to `CAMERA${CAMERA_COUNT}_SOURCE_SVC`) ```sh -CAMERA_COUNT="2" CAMERAS_SOURCE_SVC=10.2.2.2 CAMERA1_SOURCE_SVC=10.1.2.3 CAMERA2_SOURCE_SVC=10.2.3.4 python3 ./streaming.py +CAMERA_COUNT="2" CAMERAS_SOURCE_SVC=10.2.2.2 CAMERA1_SOURCE_SVC=10.1.2.3 CAMERA2_SOURCE_SVC=10.2.3.4 python3 ./app.py ``` 2. Target all services of an Akri Configuration. The application will query for services prefixed with the Configuration name. ```sh -CONFIGURATION_NAME="akri-udev" python3 ./streaming.py +CONFIGURATION_NAME="akri-udev" python3 ./app.py ``` \ No newline at end of file diff --git a/samples/apps/video-streaming-app/streaming.py b/samples/apps/video-streaming-app/app.py similarity index 100% rename from samples/apps/video-streaming-app/streaming.py rename to samples/apps/video-streaming-app/app.py diff --git a/samples/brokers/opcua-monitoring-broker/opcua-monitoring-broker.csproj b/samples/brokers/opcua-monitoring-broker/opcua-monitoring-broker.csproj index 6e2963b40..3e51b6c15 100644 --- a/samples/brokers/opcua-monitoring-broker/opcua-monitoring-broker.csproj +++ b/samples/brokers/opcua-monitoring-broker/opcua-monitoring-broker.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net6.0 diff --git a/test/e2e/test_udev.py b/test/e2e/test_udev.py index 2d80c3e03..1e9a900a0 100644 --- a/test/e2e/test_udev.py +++ b/test/e2e/test_udev.py @@ -42,7 +42,7 @@ def grouped_config(akri_version): ).items base_command = ["/bin/sh", "-c"] # This command will get the ID_PATH to use to get a device with many "subdevices" - command = "grep -hr ID_PATH= /run/udev/data | sort | uniq -cd | sort -h | tail -1 | cut -d '=' -f 2" + command = "grep -hr ID_PATH= /run/udev/data | sort | uniq -cd | sort -n | tail -1 | cut -d '=' -f 2" paths = set() # Get the ID_PATH we can use for pod in pods: @@ -60,7 +60,7 @@ def grouped_config(akri_version): try: paths.add(resp.readline_stdout(timeout=3).strip()) except: - pytest.skip("No udev ?") + pytest.skip(f"No udev ?") if len(paths) == 0: pytest.skip("No groupable devices found") path = paths.pop() From 393950ceafff722df61924d8fa1aa0f200ea9d82 Mon Sep 17 00:00:00 2001 From: Nicolas Belouin Date: Fri, 13 Oct 2023 14:09:16 +0200 Subject: [PATCH 2/8] Fix some GH workflows Signed-off-by: Nicolas Belouin --- .github/workflows/build-agent-container.yml | 105 ----------- .../build-anomaly-detection-app-container.yml | 107 ----------- .../workflows/build-controller-container.yml | 100 ----------- .../workflows/build-discovery-handlers.yml | 109 ------------ .../build-onvif-video-broker-container.yml | 82 ++------- ...uild-opcua-monitoring-broker-container.yml | 104 ++++------- .../workflows/build-opencv-base-container.yml | 130 ++++---------- .../workflows/build-python-app-containers.yml | 81 +++++++++ .github/workflows/build-rust-code.yml | 168 +++++++++++------- .../build-rust-crossbuild-container.yml | 143 --------------- .../build-udev-video-broker-container.yml | 101 ----------- .../build-video-streaming-app-container.yml | 109 ------------ .../build-webhook-configuration-container.yml | 98 ---------- .../cancel-previous-pr-workflows.yml | 14 +- .github/workflows/run-test-cases.yml | 43 ++--- .github/workflows/update-versions.yml | 26 ++- Makefile | 6 +- build/akri-dotnet-containers.mk | 47 ----- test/e2e/conftest.py | 6 +- 19 files changed, 336 insertions(+), 1243 deletions(-) delete mode 100644 .github/workflows/build-agent-container.yml delete mode 100644 .github/workflows/build-anomaly-detection-app-container.yml delete mode 100644 .github/workflows/build-controller-container.yml delete mode 100644 .github/workflows/build-discovery-handlers.yml create mode 100644 .github/workflows/build-python-app-containers.yml delete mode 100644 .github/workflows/build-rust-crossbuild-container.yml delete mode 100644 .github/workflows/build-udev-video-broker-container.yml delete mode 100644 .github/workflows/build-video-streaming-app-container.yml delete mode 100644 .github/workflows/build-webhook-configuration-container.yml delete mode 100644 build/akri-dotnet-containers.mk diff --git a/.github/workflows/build-agent-container.yml b/.github/workflows/build-agent-container.yml deleted file mode 100644 index c12b2555d..000000000 --- a/.github/workflows/build-agent-container.yml +++ /dev/null @@ -1,105 +0,0 @@ -name: Build Agents - -on: - workflow_run: - workflows: ["Build Production Rust Code"] - branches: - - main - - 'v[0-9]+.[0-9]+.[0-9]+*' - types: - - completed - -jobs: - - per-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - akri-component: - - agent - - agent-full - - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Download rust build artifacts - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - workflow_conclusion: success - commit: ${{ github.event.workflow_run.head_sha }} - name: rust-${{ matrix.arch }}-binaries - path: /tmp - - - name: Unpack Rust binaries - run: | - tar -xvf /tmp/rust-${{ matrix.arch }}-binaries.tar - - - name: Run Per-Arch component build for ${{ matrix.akri-component }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - github_ref: ${{ github.ref }} - container_name: ${{ matrix.akri-component }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ matrix.akri-component }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} && ((github.event.workflow_run.event == 'release') || (github.event.workflow_run.event == 'push' && github.ref == 'refs/heads/main')) - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 - strategy: - matrix: - akri-component: - - agent - - agent-full - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Multi-Arch component build for ${{ matrix.akri-component }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - container_name: ${{ matrix.akri-component }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ matrix.akri-component }} diff --git a/.github/workflows/build-anomaly-detection-app-container.yml b/.github/workflows/build-anomaly-detection-app-container.yml deleted file mode 100644 index c523bda52..000000000 --- a/.github/workflows/build-anomaly-detection-app-container.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: Build Anomaly Detection App Container - -on: - push: - branches: [ main ] - paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - - .github/workflows/build-anomaly-detection-app-container.yml - - build/containers/Dockerfile.anomaly-detection-app - - samples/apps/anomaly-detection-app/** - - version.txt - - build/akri-containers.mk - - build/akri-python-containers.mk - - Makefile - pull_request: - branches: [ main ] - paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - - .github/workflows/build-anomaly-detection-app-container.yml - - build/containers/Dockerfile.anomaly-detection-app - - samples/apps/anomaly-detection-app/** - - version.txt - - build/akri-containers.mk - - build/akri-python-containers.mk - - Makefile - release: - types: - - published - -env: - AKRI_COMPONENT: anomaly-detection-app - MAKEFILE_COMPONENT: anomaly-detection - -jobs: - - per-arch: - runs-on: ubuntu-latest - timeout-minutes: 20 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event_name }} - github_ref: ${{ github.ref }} - github_event_action: ${{ github.event.action }} - github_merged: ${{ github.event.pull_request.merged }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: (github.event_name == 'release') || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (startsWith(github.event_name, 'pull_request') && github.event.action == 'closed' && github.event.pull_request.merged == true && github.ref != 'refs/heads/main') - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Multi-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event_name }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} \ No newline at end of file diff --git a/.github/workflows/build-controller-container.yml b/.github/workflows/build-controller-container.yml deleted file mode 100644 index ecbc8d0ad..000000000 --- a/.github/workflows/build-controller-container.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Build Controller - -on: - workflow_run: - workflows: ["Build Production Rust Code"] - branches: - - main - - 'v[0-9]+.[0-9]+.[0-9]+*' - types: - - completed - -env: - AKRI_COMPONENT: controller - MAKEFILE_COMPONENT: controller - -jobs: - - per-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Download rust build artifacts - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - workflow_conclusion: success - commit: ${{ github.event.workflow_run.head_sha }} - name: rust-${{ matrix.arch }}-binaries - path: /tmp - - - name: Unpack Rust binaries - run: | - tar -xvf /tmp/rust-${{ matrix.arch }}-binaries.tar - - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - github_ref: ${{ github.ref }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} && ((github.event.workflow_run.event == 'release') || (github.event.workflow_run.event == 'push' && github.ref == 'refs/heads/main')) - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Multi-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} diff --git a/.github/workflows/build-discovery-handlers.yml b/.github/workflows/build-discovery-handlers.yml deleted file mode 100644 index fe6b8c639..000000000 --- a/.github/workflows/build-discovery-handlers.yml +++ /dev/null @@ -1,109 +0,0 @@ -name: Build Discovery Handlers - -on: - workflow_run: - workflows: ["Build Production Rust Code"] - branches: - - main - - 'v[0-9]+.[0-9]+.[0-9]+*' - types: - - completed - -jobs: - - per-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - akri-component: - - debug-echo-discovery - - udev-discovery - - onvif-discovery - - opcua-discovery - - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Download rust build artifacts - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - workflow_conclusion: success - commit: ${{ github.event.workflow_run.head_sha }} - name: rust-${{ matrix.arch }}-binaries - path: /tmp - - - name: Unpack Rust binaries - run: | - tar -xvf /tmp/rust-${{ matrix.arch }}-binaries.tar - - - name: Run Per-Arch component build for ${{ matrix.akri-component }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - github_ref: ${{ github.ref }} - container_name: ${{ matrix.akri-component }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ matrix.akri-component }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} && ((github.event.workflow_run.event == 'release') || (github.event.workflow_run.event == 'push' && github.ref == 'refs/heads/main')) - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 - strategy: - matrix: - akri-component: - - debug-echo-discovery - - udev-discovery - - onvif-discovery - - opcua-discovery - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Multi-Arch component build for ${{ matrix.akri-component }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - container_name: ${{ matrix.akri-component }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ matrix.akri-component }} diff --git a/.github/workflows/build-onvif-video-broker-container.yml b/.github/workflows/build-onvif-video-broker-container.yml index 5c8bdabee..524636e26 100644 --- a/.github/workflows/build-onvif-video-broker-container.yml +++ b/.github/workflows/build-onvif-video-broker-container.yml @@ -4,26 +4,20 @@ on: push: branches: [ main ] paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - .github/workflows/build-onvif-video-broker-container.yml - build/containers/Dockerfile.onvif-video-broker - samples/brokers/onvif-video-broker/** - version.txt - - build/akri-containers.mk - - build/akri-dotnet-containers.mk + - build/samples.mk - Makefile pull_request: branches: [ main ] paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - .github/workflows/build-onvif-video-broker-container.yml - build/containers/Dockerfile.onvif-video-broker - samples/brokers/onvif-video-broker/** - version.txt - - build/akri-containers.mk - - build/akri-dotnet-containers.mk + - build/samples.mk - Makefile release: types: @@ -34,16 +28,9 @@ env: MAKEFILE_COMPONENT: onvif jobs: - - per-arch: + build-broker: runs-on: ubuntu-latest timeout-minutes: 20 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 steps: - name: Checkout the head commit of the branch @@ -51,59 +38,24 @@ jobs: with: persist-credentials: false - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps + - name: Get version.txt + id: version-string run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs + echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event_name }} - github_ref: ${{ github.ref }} - github_event_action: ${{ github.event.action }} - github_merged: ${{ github.event.pull_request.merged }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: (github.event_name == 'release') || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (startsWith(github.event_name, 'pull_request') && github.event.action == 'closed' && github.event.pull_request.merged == true && github.ref != 'refs/heads/main') - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - steps: - - name: Checkout repo - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 with: - persist-credentials: false + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps + - name: Build and push run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs + make onvif-video-broker $(${{ github.event_name != 'pull_request' }} && echo "PUSH=1") - - name: Run Multi-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event_name }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} diff --git a/.github/workflows/build-opcua-monitoring-broker-container.yml b/.github/workflows/build-opcua-monitoring-broker-container.yml index 5def023f0..0e43e6320 100644 --- a/.github/workflows/build-opcua-monitoring-broker-container.yml +++ b/.github/workflows/build-opcua-monitoring-broker-container.yml @@ -4,46 +4,26 @@ on: push: branches: [ main ] paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - .github/workflows/build-opcua-monitoring-broker-container.yml - build/containers/Dockerfile.opcua-monitoring-broker - samples/brokers/opcua-monitoring-broker/** - version.txt - - build/akri-containers.mk - - build/akri-dotnet-containers.mk - - Makefile pull_request: branches: [ main ] paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - .github/workflows/build-opcua-monitoring-broker-container.yml - build/containers/Dockerfile.opcua-monitoring-broker - samples/brokers/opcua-monitoring-broker/** - version.txt - - build/akri-containers.mk - - build/akri-dotnet-containers.mk - - Makefile release: types: - published -env: - AKRI_COMPONENT: opcua-monitoring-broker - MAKEFILE_COMPONENT: opcua-monitoring - jobs: - per-arch: + build-broker: runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 + timeout-minutes: 20 steps: - name: Checkout the head commit of the branch @@ -51,57 +31,43 @@ jobs: with: persist-credentials: false - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps + - name: Get version.txt + id: version-string run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs + echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event_name }} - github_ref: ${{ github.ref }} - github_event_action: ${{ github.event.action }} - github_merged: ${{ github.event.pull_request.merged }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: (github.event_name == 'release') || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (startsWith(github.event_name, 'pull_request') && github.event.action == 'closed' && github.event.pull_request.merged == true && github.ref != 'refs/heads/main') - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - steps: - - name: Checkout repo - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Prepare To Install - uses: actions/setup-node@v3 + - name: Docker meta + uses: docker/metadata-action@v5 + id: meta with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs + images: ghcr.io/project-akri/akri/opcua-monitoring-broker + labels: | + org.opencontainers.image.title=akri-opcua-monitoring-broker + org.opencontainers.image.description=Akri sample opcua monitoring broker + tags: | + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=${{steps.version-string.outputs.version}},enable=${{github.event_name != 'release'}} - - name: Run Multi-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-multi-arch + - name: Build and push + uses: docker/build-push-action@v5 with: - github_event_name: ${{ github.event_name }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} \ No newline at end of file + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + file: build/containers/Dockerfile.opcua-monitoring-broker + platforms: linux/amd64,linux/arm64,linux/arm/v7 diff --git a/.github/workflows/build-opencv-base-container.yml b/.github/workflows/build-opencv-base-container.yml index c4c8c64c0..2da22edb0 100644 --- a/.github/workflows/build-opencv-base-container.yml +++ b/.github/workflows/build-opencv-base-container.yml @@ -20,7 +20,6 @@ on: - Makefile issue_comment: types: [created, edited] - branches: [ main ] env: AKRI_COMPONENT: opencvsharp-build @@ -28,81 +27,10 @@ env: jobs: - add-same-version-label-to-pr: - runs-on: ubuntu-latest - if: github.event_name == 'issue_comment' && contains(github.event.comment.body, '/add-same-version-label') - steps: - - uses: actions/checkout@v3 - - name: Add same version label - uses: actions/github-script@v6 - if: success() - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['same version'] - }) - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: '👋 Added [same version] label :)!' - }) - add-build-label-to-pr: - runs-on: ubuntu-latest - if: github.event_name == 'issue_comment' && contains(github.event.comment.body, '/add-build-dependency-containers-label') - steps: - - uses: actions/checkout@v3 - - name: Add build dependency containers label - uses: actions/github-script@v6 - if: success() - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['build dependency containers'] - }) - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: '👋 Added [build dependency containers] label :)!' - }) - - add-label-missing-comment: - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && (github.event.action == 'opened') && !contains(github.event.pull_request.labels.*.name, 'build dependency containers') - steps: - - uses: actions/checkout@v3 - - name: Add comment about missing build dependency containers label - uses: actions/github-script@v6 - if: success() - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.rest.issues.createComment({ - issue_number: context.payload.pull_request.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Hi there, this change should run build dependency containers, but running it will take hours. Do you want to run it? If so, please add label "build dependency containers" by commenting "/add-build-dependency-containers-label".' - }) - per-arch: - if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'build dependency containers') + build-container: runs-on: ubuntu-latest - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 steps: - name: Checkout the head commit of the branch uses: actions/checkout@v3 @@ -118,26 +46,42 @@ jobs: git fetch origin main git diff origin/main -- ./build/intermediate-containers.mk | grep "BUILD_OPENCV_BASE_VERSION = " | wc -l | grep -v 0 - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps + - name: Get version.txt + id: version-string run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs + grep "BUILD_OPENCV_BASE_VERSION =" build/intermediate-containers.mk | tr -d ' ' >> $GITHUB_OUTPUT - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-intermediate + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 with: - github_event_name: ${{ github.event_name }} - github_ref: ${{ github.ref }} - github_event_action: ${{ github.event.action }} - github_merged: ${{ github.event.pull_request.merged }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + uses: docker/metadata-action@v5 + id: meta + with: + images: ghcr.io/project-akri/akri/opencvsharp-build + labels: | + org.opencontainers.image.title=akri-opencvsharp + org.opencontainers.image.description=Akri opencvsharp base image for samples build + tags: | + type=ref,event=pr + type=raw,value=${{steps.version-string.outputs.version}} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + file: build/containers/intermediate/Dockerfile.opencvsharp-build + platforms: linux/amd64,linux/arm64,linux/arm/v7 + diff --git a/.github/workflows/build-python-app-containers.yml b/.github/workflows/build-python-app-containers.yml new file mode 100644 index 000000000..b67b5cf94 --- /dev/null +++ b/.github/workflows/build-python-app-containers.yml @@ -0,0 +1,81 @@ +name: Build Sample Apps Containers + +on: + push: + branches: [ main ] + paths: + - .github/workflows/build-python-app-container.yml + - build/containers/Dockerfile.python-app + - samples/apps/** + - version.txt + pull_request: + branches: [ main ] + paths: + - .github/workflows/build-python-app-container.yml + - build/containers/Dockerfile.python-app + - samples/apps/** + - version.txt + release: + types: + - published + +jobs: + + build-apps: + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + component: + - anomaly-detection-app + - video-streaming-app + + steps: + - name: Checkout the head commit of the branch + uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Get version.txt + id: version-string + run: | + echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + uses: docker/metadata-action@v5 + id: meta + with: + images: ghcr.io/project-akri/akri/${{ matrix.component }} + labels: | + org.opencontainers.image.title=akri-${{matrix.component}} + org.opencontainers.image.description=Akri Sample App + tags: | + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=${{steps.version-string.outputs.version}},enable=${{github.event_name != 'release'}} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + build-args: | + APPLICATION=${{matrix.component}} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + file: build/containers/Dockerfile.python-app + # Don't build python sample apps for arm/v7 as many modules don't provide armv7 wheels. + platforms: linux/amd64,linux/arm64 \ No newline at end of file diff --git a/.github/workflows/build-rust-code.yml b/.github/workflows/build-rust-code.yml index 84c5f71f7..3ab169add 100644 --- a/.github/workflows/build-rust-code.yml +++ b/.github/workflows/build-rust-code.yml @@ -1,69 +1,41 @@ -name: Build Production Rust Code +name: Build Production Rust Containers on: push: branches: [ main ] paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - .github/workflows/build-rust-code.yml - - .github/workflows/build-agent-container.yml - - .github/workflows/build-controller-container.yml - - .github/workflows/build-udev-video-broker-container.yml - - .github/workflows/build-webhook-configuration-container.yml - - build/containers/Dockerfile.agent - - build/containers/Dockerfile.controller - - build/containers/Dockerfile.udev-video-broker - - build/containers/Dockerfile.webhook-configuration + - build/containers/Dockerfile.rust - '**.rs' - '**/Cargo.toml' - '**/Cargo.lock' - version.txt - - build/akri-containers.mk - - build/akri-rust-containers.mk - - Makefile pull_request: branches: [ main ] paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - .github/workflows/build-rust-code.yml - - .github/workflows/build-agent-container.yml - - .github/workflows/build-controller-container.yml - - .github/workflows/build-udev-video-broker-container.yml - - .github/workflows/build-webhook-configuration-container.yml - - build/containers/Dockerfile.agent - - build/containers/Dockerfile.controller - - build/containers/Dockerfile.udev-video-broker - - build/containers/Dockerfile.webhook-configuration + - build/containers/Dockerfile.rust - '**.rs' - '**/Cargo.toml' - '**/Cargo.lock' - version.txt - - build/akri-containers.mk - - build/akri-rust-containers.mk - - Makefile release: types: - published jobs: - build-rust: + build-agents: + # Run separately to heat the cache for every architecture runs-on: ubuntu-latest - timeout-minutes: 50 + timeout-minutes: 80 strategy: matrix: - arch: - - label: arm64v8 - make-target: arm64 - rust-target-path: aarch64-unknown-linux-gnu - - label: arm32v7 - make-target: arm32 - rust-target-path: armv7-unknown-linux-gnueabihf - - label: amd64 - make-target: amd64 - rust-target-path: x86_64-unknown-linux-gnu + component: + - label: agent + cargo-build-args: --release + - label: agent-full + cargo-build-args: --release -F agent-full,onvif-feat,opcua-feat,udev-feat steps: - name: Checkout the head commit of the branch @@ -71,32 +43,106 @@ jobs: with: persist-credentials: false - - name: Rust install - uses: dtolnay/rust-toolchain@master + - name: Get version.txt + id: version-string + run: | + echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 with: - toolchain: 1.68.1 - components: clippy, rustfmt + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Build production rust for ${{ matrix.arch.label }} - env: - AGENT_FEATURES: "agent-full onvif-feat opcua-feat udev-feat" - run: | - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - make install-cross - cross --version - make akri-cross-build-${{ matrix.arch.make-target }} + - name: Docker meta + uses: docker/metadata-action@v5 + id: meta + with: + images: ghcr.io/project-akri/akri/${{ matrix.component.label }} + labels: | + org.opencontainers.image.title=akri-${{matrix.component.label}} + tags: | + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=${{steps.version-string.outputs.version}},enable=${{github.event_name != 'release'}} - - name: Package build binaries + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + build-args: | + AKRI_COMPONENT=agent + EXTRA_CARGO_ARGS=${{matrix.component.cargo-build-args}} + cache-from: type=gha,scope=${{github.ref_name}}-${{matrix.component.label}} + cache-to: type=gha,mode=max,scope=${{github.ref_name}}-${{matrix.component.label}} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + file: build/containers/Dockerfile.rust + platforms: linux/amd64,linux/arm64,linux/arm/v7 + + build-others: + runs-on: ubuntu-latest + needs: build-agents + timeout-minutes: 50 + strategy: + matrix: + component: + - label: controller + - label: webhook-configuration + - label: debug-echo-discovery-handler + - label: udev-discovery-handler + - label: opcua-discovery-handler + - label: onvif-discovery-handler + - label: udev-video-broker + + steps: + - name: Checkout the head commit of the branch + uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Get version.txt + id: version-string run: | - tar_manifest='/tmp/tar-contents.txt' - > $tar_manifest - for f in target/${{ matrix.arch.rust-target-path }}/release/*; do filetype=$( file "$f" ); case "$filetype" in *ELF*) echo "$f" >> $tar_manifest ;; esac; done - tar -cvf /tmp/rust-${{ matrix.arch.label }}-binaries.tar `cat $tar_manifest` + echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT - - name: Upload target binaries as artifact - uses: actions/upload-artifact@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + uses: docker/metadata-action@v5 + id: meta with: - name: rust-${{ matrix.arch.label }}-binaries - path: /tmp/rust-${{ matrix.arch.label }}-binaries.tar - retention-days: 1 + images: ghcr.io/project-akri/akri/${{ matrix.component.label }} + labels: | + org.opencontainers.image.title=akri-${{matrix.component.label}} + tags: | + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=${{steps.version-string.outputs.version}},enable=${{github.event_name != 'release'}} + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + build-args: | + AKRI_COMPONENT=agent + EXTRA_CARGO_ARGS=--release + cache-from: type=gha,scope=${{github.ref_name}}-agent + # No cache-to here as we want to use the one from agent + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + file: build/containers/Dockerfile.rust + platforms: linux/amd64,linux/arm64,linux/arm/v7 \ No newline at end of file diff --git a/.github/workflows/build-rust-crossbuild-container.yml b/.github/workflows/build-rust-crossbuild-container.yml deleted file mode 100644 index f311b81ac..000000000 --- a/.github/workflows/build-rust-crossbuild-container.yml +++ /dev/null @@ -1,143 +0,0 @@ -name: Build Rust CrossBuild - -on: - push: - branches: [ main ] - paths: - - .github/actions/build-intermediate/** - - .github/workflows/build-rust-crossbuild-container.yml - - build/containers/intermediate/Dockerfile.rust-crossbuild-* - - build/intermediate-containers.mk - - Makefile - pull_request: - types: [opened, synchronize, reopened, labeled] - branches: [ main ] - paths: - - .github/actions/build-intermediate/** - - .github/workflows/build-rust-crossbuild-container.yml - - build/containers/intermediate/Dockerfile.rust-crossbuild-* - - build/intermediate-containers.mk - - Makefile - issue_comment: - types: [created, edited] - branches: [ main ] - -env: - AKRI_COMPONENT: rust-crossbuild - MAKEFILE_COMPONENT: rust-crossbuild - -jobs: - - add-same-version-label-to-pr: - runs-on: ubuntu-latest - if: github.event_name == 'issue_comment' && contains(github.event.comment.body, '/add-same-version-label') - steps: - - uses: actions/checkout@v3 - - name: Add same version label - uses: actions/github-script@v6 - if: success() - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['same version'] - }) - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: '👋 Added [same version] label :)!' - }) - - add-build-label-to-pr: - runs-on: ubuntu-latest - if: github.event_name == 'issue_comment' && contains(github.event.comment.body, '/add-build-dependency-containers-label') - steps: - - uses: actions/checkout@v3 - - name: Add build dependency containers label - uses: actions/github-script@v6 - if: success() - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['build dependency containers'] - }) - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: '👋 Added [build dependency containers] label :)!' - }) - - add-label-missing-comment: - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && (github.event.action == 'opened') && !contains(github.event.pull_request.labels.*.name, 'build dependency containers') - steps: - - uses: actions/checkout@v3 - - name: Add comment about missing build dependency containers label - uses: actions/github-script@v6 - if: success() - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.rest.issues.createComment({ - issue_number: context.payload.pull_request.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Hi there, this change should run build dependency containers, but running it will take hours. Do you want to run it? If so, please add label "build dependency containers" by commenting "/add-build-dependency-containers-label".' - }) - - per-arch: - if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'build dependency containers') - runs-on: ubuntu-latest - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - # Only run build version change check if PR does not have "same version" label - - if: >- - startsWith(github.event_name, 'pull_request') && - !contains(github.event.pull_request.labels.*.name, 'same version') - name: Ensure that ${{ env.AKRI_COMPONENT }} version has changed - run: | - git fetch origin main - git diff origin/main -- ./build/intermediate-containers.mk | grep "BUILD_RUST_CROSSBUILD_VERSION = " | wc -l | grep -v 0 - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-intermediate - with: - github_event_name: ${{ github.event_name }} - github_ref: ${{ github.ref }} - github_event_action: ${{ github.event.action }} - github_merged: ${{ github.event.pull_request.merged }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} diff --git a/.github/workflows/build-udev-video-broker-container.yml b/.github/workflows/build-udev-video-broker-container.yml deleted file mode 100644 index 2dfd0b5c4..000000000 --- a/.github/workflows/build-udev-video-broker-container.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Build UDEV Broker - -on: - workflow_run: - workflows: ["Build Production Rust Code"] - branches: - - main - - 'v[0-9]+.[0-9]+.[0-9]+*' - types: - - completed - -env: - AKRI_COMPONENT: udev-video-broker - MAKEFILE_COMPONENT: udev - -jobs: - - per-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Download rust build artifacts - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - workflow_conclusion: success - commit: ${{ github.event.workflow_run.head_sha }} - name: rust-${{ matrix.arch }}-binaries - path: /tmp - - - name: Unpack Rust binaries - run: | - tar -xvf /tmp/rust-${{ matrix.arch }}-binaries.tar - - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - github_ref: ${{ github.ref }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} && ((github.event.workflow_run.event == 'release') || (github.event.workflow_run.event == 'push' && github.ref == 'refs/heads/main')) - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Multi-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} diff --git a/.github/workflows/build-video-streaming-app-container.yml b/.github/workflows/build-video-streaming-app-container.yml deleted file mode 100644 index 011a05522..000000000 --- a/.github/workflows/build-video-streaming-app-container.yml +++ /dev/null @@ -1,109 +0,0 @@ -name: Build Video Streaming App Container - -on: - push: - branches: [ main ] - paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - - .github/workflows/build-video-streaming-app-container.yml - - build/containers/Dockerfile.video-streaming-app - - samples/apps/video-streaming-app/** - - version.txt - - build/akri-containers.mk - - build/akri-python-containers.mk - - Makefile - pull_request: - branches: [ main ] - paths: - - .github/actions/build-component-per-arch/** - - .github/actions/build-component-multi-arch/** - - .github/workflows/build-video-streaming-app-container.yml - - build/containers/Dockerfile.video-streaming-app - - samples/apps/video-streaming-app/** - - version.txt - - build/akri-containers.mk - - build/akri-python-containers.mk - - Makefile - release: - types: - - published - -env: - AKRI_COMPONENT: video-streaming-app - MAKEFILE_COMPONENT: streaming - -jobs: - - per-arch: - runs-on: ubuntu-latest - timeout-minutes: 20 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event_name }} - github_ref: ${{ github.ref }} - github_event_action: ${{ github.event.action }} - github_merged: ${{ github.event.pull_request.merged }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: (github.event_name == 'release') || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (startsWith(github.event_name, 'pull_request') && github.event.action == 'closed' && github.event.pull_request.merged == true && github.ref != 'refs/heads/main') - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 5 - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Multi-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event_name }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} diff --git a/.github/workflows/build-webhook-configuration-container.yml b/.github/workflows/build-webhook-configuration-container.yml deleted file mode 100644 index dcc95414c..000000000 --- a/.github/workflows/build-webhook-configuration-container.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: Build Webhook Configuration - -on: - workflow_run: - workflows: ["Build Production Rust Code"] - branches: - - main - - 'v[0-9]+.[0-9]+.[0-9]+*' - types: - - completed - -env: - AKRI_COMPONENT: webhook-configuration - MAKEFILE_COMPONENT: webhook-configuration - -jobs: - per-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - timeout-minutes: 60 - strategy: - matrix: - arch: - - arm64v8 - - arm32v7 - - amd64 - - steps: - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Download rust build artifacts - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - workflow_conclusion: success - commit: ${{ github.event.workflow_run.head_sha }} - name: rust-${{ matrix.arch }}-binaries - path: /tmp - - - name: Unpack Rust binaries - run: | - tar -xvf /tmp/rust-${{ matrix.arch }}-binaries.tar - - - name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-per-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - github_ref: ${{ github.ref }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} - platform: ${{ matrix.arch }} - build_rust: "0" - - multi-arch: - if: ${{ github.event.workflow_run.conclusion == 'success' }} && ((github.event.workflow_run.event == 'release') || (github.event.workflow_run.event == 'push' && github.ref == 'refs/heads/main')) - needs: per-arch - runs-on: ubuntu-latest - timeout-minutes: 60 - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - - name: Prepare To Install - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Install Deps - run: | - yarn install - yarn add @actions/core @actions/github @actions/exec fs - - - name: Run Multi-Arch component build for ${{ env.AKRI_COMPONENT }} - uses: ./.github/actions/build-component-multi-arch - with: - github_event_name: ${{ github.event.workflow_run.event }} - container_name: ${{ env.AKRI_COMPONENT }} - container_prefix: ghcr.io/project-akri/akri - container_registry_base_url: ghcr.io - container_registry_username: ${{ secrets.crUsername }} - container_registry_password: ${{ secrets.crPassword }} - makefile_component_name: ${{ env.MAKEFILE_COMPONENT }} diff --git a/.github/workflows/cancel-previous-pr-workflows.yml b/.github/workflows/cancel-previous-pr-workflows.yml index f73f4e48e..a64ef6de9 100644 --- a/.github/workflows/cancel-previous-pr-workflows.yml +++ b/.github/workflows/cancel-previous-pr-workflows.yml @@ -1,7 +1,19 @@ name: Cancel Previous PR Workflows on: workflow_run: - workflows: ["Dependencies autoupdate", "Build Agents", "Build Anomaly Detection App Container", "Build Controller", "Build ONVIF Broker (.NET)", "Build OPC UA Monitoring Broker", "Build OpenCV Base", "Build Production Rust Code", "Build Rust CrossBuild", "Build UDEV Broker", "Build Video Streaming App Container", "Build Webhook Configuration", "Check Rust", "Check versioning", "Helm", "Tarpaulin Code Coverage", "Test K3s, Kubernetes, and MicroK8s"] + workflows: + - "Dependencies autoupdate" + - "Build Sample Apps Containers" + - "Build ONVIF Broker (.NET)" + - "Build OPC UA Monitoring Broker" + - "Build OpenCV Base" + - "Build Production Rust Containers" + - "Build UDEV Broker" + - "Check Rust" + - "Check versioning" + - "Helm" + - "Tarpaulin Code Coverage" + - "Test K3s, Kubernetes, and MicroK8s" types: - requested jobs: diff --git a/.github/workflows/run-test-cases.yml b/.github/workflows/run-test-cases.yml index b6699f4c1..2e4b23294 100644 --- a/.github/workflows/run-test-cases.yml +++ b/.github/workflows/run-test-cases.yml @@ -6,8 +6,7 @@ on: paths: - test/e2e/** - .github/workflows/run-test-cases.yml - - build/containers/Dockerfile.agent - - build/containers/Dockerfile.controller + - build/containers/Dockerfile.rust - deployment/helm/** - agent/** - controller/** @@ -20,8 +19,7 @@ on: paths: - test/e2e/** - .github/workflows/run-test-cases.yml - - build/containers/Dockerfile.agent - - build/containers/Dockerfile.controller + - build/containers/Dockerfile.rust - deployment/helm/** - agent/** - controller/** @@ -44,38 +42,25 @@ jobs: with: persist-credentials: false - - name: Rust install - uses: dtolnay/rust-toolchain@master - with: - toolchain: 1.68.1 - components: clippy, rustfmt + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Build local containers for PR tests if: startsWith(github.event_name, 'pull_request') env: - BUILD_AMD64: 1 - BUILD_ARM32: 0 - BUILD_ARM64: 0 - BUILD_SLIM_AGENT: 1 PREFIX: ghcr.io/project-akri/akri LABEL_PREFIX: pr - CARGO_INCREMENTAL: 0 run: | - make akri-build - make controller-build-amd64 - make agent-build-amd64 - make webhook-configuration-build-amd64 - make debug-echo-discovery-build-amd64 - make udev-discovery-build-amd64 - make onvif-discovery-build-amd64 - make opcua-discovery-build-amd64 - docker save ${PREFIX}/agent:${LABEL_PREFIX}-amd64 > agent.tar - docker save ${PREFIX}/controller:${LABEL_PREFIX}-amd64 > controller.tar - docker save ${PREFIX}/webhook-configuration:${LABEL_PREFIX}-amd64 > webhook-configuration.tar - docker save ${PREFIX}/debug-echo-discovery:${LABEL_PREFIX}-amd64 > debug-echo-discovery.tar - docker save ${PREFIX}/udev-discovery:${LABEL_PREFIX}-amd64 > udev-discovery.tar - docker save ${PREFIX}/opcua-discovery:${LABEL_PREFIX}-amd64 > opcua-discovery.tar - docker save ${PREFIX}/onvif-discovery:${LABEL_PREFIX}-amd64 > onvif-discovery.tar + make akri LOAD=1 + docker save ${PREFIX}/agent:${LABEL_PREFIX} > agent.tar + docker save ${PREFIX}/controller:${LABEL_PREFIX} > controller.tar + docker save ${PREFIX}/webhook-configuration:${LABEL_PREFIX} > webhook-configuration.tar + docker save ${PREFIX}/debug-echo-discovery:${LABEL_PREFIX} > debug-echo-discovery.tar + docker save ${PREFIX}/udev-discovery:${LABEL_PREFIX} > udev-discovery.tar + docker save ${PREFIX}/opcua-discovery:${LABEL_PREFIX} > opcua-discovery.tar + docker save ${PREFIX}/onvif-discovery:${LABEL_PREFIX} > onvif-discovery.tar - name: Upload Agent container as artifact if: startsWith(github.event_name, 'pull_request') diff --git a/.github/workflows/update-versions.yml b/.github/workflows/update-versions.yml index edac442a9..368d1bc0c 100644 --- a/.github/workflows/update-versions.yml +++ b/.github/workflows/update-versions.yml @@ -5,8 +5,32 @@ on: types: [created, edited] jobs: + add-same-version-label-to-pr: + runs-on: ubuntu-latest + if: github.event.issue.pull_request && contains(github.event.comment.body, '/add-same-version-label') + steps: + - uses: actions/checkout@v3 + - name: Add same version label + uses: actions/github-script@v6 + if: success() + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['same version'] + }) + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '👋 Added [same version] label :)!' + }) + build: - if: ${{ github.event.issue.pull_request }} + if: ${{ github.event.issue.pull_request }} && contains(github.event.comment.body, '/version') runs-on: ubuntu-latest steps: diff --git a/Makefile b/Makefile index 66f98260f..a856d5013 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,10 @@ PUSH ?= LOAD ?= LOCAL_ARCH = $(shell uname -m) ifeq ($(LOAD), 1) -PLATFORMS ?= LOCAL_ARCH -$(intcmp 1,$(words $(PLATFORMS)), $(error Cannot load for more than one platform)) +PLATFORMS ?= $(LOCAL_ARCH) +ifneq (1, $(words $(PLATFORMS))) +$(error Cannot load for more than one platform: [$(PLATFORMS)]) +endif else PLATFORMS ?= amd64 arm64 arm/v7 endif diff --git a/build/akri-dotnet-containers.mk b/build/akri-dotnet-containers.mk deleted file mode 100644 index 3def3f1a5..000000000 --- a/build/akri-dotnet-containers.mk +++ /dev/null @@ -1,47 +0,0 @@ -define add_onvif_target - akri-$(1): akri-docker-$(1) - akri-docker-$(1): $(1)-build $(1)-docker-per-arch $(1)-docker-multi-arch-create $(1)-docker-multi-arch-push - $(1)-build: $(1)-build-amd64 $(1)-build-arm32 $(1)-build-arm64 - $(1)-docker-per-arch: $(1)-docker-per-arch-amd64 $(1)-docker-per-arch-arm32 $(1)-docker-per-arch-arm64 - - $(1)-build-amd64: - ifeq (1, ${BUILD_AMD64}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) --build-arg OUTPUT_PLATFORM_TAG=$(USE_OPENCV_BASE_VERSION)-$(AMD64_SUFFIX) --build-arg DOTNET_PUBLISH_RUNTIME=linux-x64 - endif - $(1)-build-arm32: - ifeq (1, ${BUILD_ARM32}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) --build-arg OUTPUT_PLATFORM_TAG=$(USE_OPENCV_BASE_VERSION)-$(ARM32V7_SUFFIX) --build-arg DOTNET_PUBLISH_RUNTIME=linux-arm - endif - $(1)-build-arm64: - ifeq (1, ${BUILD_ARM64}) - docker build $(CACHE_OPTION) -f $(DOCKERFILE_DIR)/Dockerfile.$(2) . -t $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) --build-arg OUTPUT_PLATFORM_TAG=$(USE_OPENCV_BASE_VERSION)-$(ARM64V8_SUFFIX) --build-arg DOTNET_PUBLISH_RUNTIME=linux-arm64 - endif - - $(1)-docker-per-arch-amd64: - ifeq (1, ${BUILD_AMD64}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) - endif - $(1)-docker-per-arch-arm32: - ifeq (1, ${BUILD_ARM32}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) - endif - $(1)-docker-per-arch-arm64: - ifeq (1, ${BUILD_ARM64}) - docker push $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) - endif - - $(1)-docker-multi-arch-create: - ifeq (1, ${BUILD_AMD64}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(AMD64_SUFFIX) - endif - ifeq (1, ${BUILD_ARM32}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM32V7_SUFFIX) - endif - ifeq (1, ${BUILD_ARM64}) - $(ENABLE_DOCKER_MANIFEST) docker manifest create --amend $(PREFIX)/$(2):$(LABEL_PREFIX) $(PREFIX)/$(2):$(LABEL_PREFIX)-$(ARM64V8_SUFFIX) - endif - - $(1)-docker-multi-arch-push: - $(ENABLE_DOCKER_MANIFEST) docker manifest push $(PREFIX)/$(2):$(LABEL_PREFIX) - -endef \ No newline at end of file diff --git a/test/e2e/conftest.py b/test/e2e/conftest.py index f34a159c6..4a4af0f45 100644 --- a/test/e2e/conftest.py +++ b/test/e2e/conftest.py @@ -13,7 +13,7 @@ def pytest_addoption(parser): ) parser.addoption("--test-version", action="store", help="version to test") parser.addoption( - "--local-tag", action="store", default="pr-amd64", help="tag for local images" + "--local-tag", action="store", default="pr", help="tag for local images" ) parser.addoption("--use-local", action="store_true", help="use local images if set") parser.addoption("--release", action="store_true", help="use released helm chart") @@ -69,7 +69,7 @@ def install_akri(request, distribution_config, pytestconfig, akri_version): helm_install_command = ["helm", "install", "akri"] if pytestconfig.getoption("--use-local"): - local_tag = pytestconfig.getoption("--local-tag", "pr-amd64") + local_tag = pytestconfig.getoption("--local-tag", "pr") helm_install_command.extend( [ Path(__file__).parent / "../../deployment/helm", @@ -101,7 +101,7 @@ def install_akri(request, distribution_config, pytestconfig, akri_version): ] ) if pytestconfig.getoption("--use-local"): - local_tag = pytestconfig.getoption("--local-tag", "pr-amd64") + local_tag = pytestconfig.getoption("--local-tag", "pr") helm_install_command.extend( [ "--set", From 491c78ad0b0e0e366b79467db6d3225f8e28061a Mon Sep 17 00:00:00 2001 From: Nicolas Belouin Date: Mon, 23 Oct 2023 09:35:01 +0200 Subject: [PATCH 3/8] Update .github/workflows/build-opcua-monitoring-broker-container.yml Co-authored-by: Kate Goldenring Signed-off-by: Nicolas Belouin --- .github/workflows/build-opcua-monitoring-broker-container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-opcua-monitoring-broker-container.yml b/.github/workflows/build-opcua-monitoring-broker-container.yml index 0e43e6320..f2c15cd1a 100644 --- a/.github/workflows/build-opcua-monitoring-broker-container.yml +++ b/.github/workflows/build-opcua-monitoring-broker-container.yml @@ -55,7 +55,7 @@ jobs: images: ghcr.io/project-akri/akri/opcua-monitoring-broker labels: | org.opencontainers.image.title=akri-opcua-monitoring-broker - org.opencontainers.image.description=Akri sample opcua monitoring broker + org.opencontainers.image.description="Akri sample OPC UA monitoring broker" tags: | type=ref,event=pr type=semver,pattern={{version}} From 0ee6a209f3f35aba43045d90efafa711cafaa4a6 Mon Sep 17 00:00:00 2001 From: Nicolas Belouin Date: Wed, 25 Oct 2023 16:39:27 +0200 Subject: [PATCH 4/8] Rename build-rust-code to build-rust-containers Also fix the built component always set to agent. Signed-off-by: Nicolas Belouin --- .../{build-rust-code.yml => build-rust-containers.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{build-rust-code.yml => build-rust-containers.yml} (97%) diff --git a/.github/workflows/build-rust-code.yml b/.github/workflows/build-rust-containers.yml similarity index 97% rename from .github/workflows/build-rust-code.yml rename to .github/workflows/build-rust-containers.yml index 3ab169add..4724f2d3e 100644 --- a/.github/workflows/build-rust-code.yml +++ b/.github/workflows/build-rust-containers.yml @@ -138,11 +138,11 @@ jobs: context: . push: ${{ github.event_name != 'pull_request' }} build-args: | - AKRI_COMPONENT=agent + AKRI_COMPONENT=${{matrix.component.label}} EXTRA_CARGO_ARGS=--release cache-from: type=gha,scope=${{github.ref_name}}-agent # No cache-to here as we want to use the one from agent tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} file: build/containers/Dockerfile.rust - platforms: linux/amd64,linux/arm64,linux/arm/v7 \ No newline at end of file + platforms: linux/amd64,linux/arm64,linux/arm/v7 From 019748e96a9d361ef96111deeabeadf5da27df66 Mon Sep 17 00:00:00 2001 From: Nicolas Belouin Date: Thu, 26 Oct 2023 11:47:22 +0200 Subject: [PATCH 5/8] Fix docker cache for container build Signed-off-by: Nicolas Belouin --- .github/workflows/build-rust-containers.yml | 25 ++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-rust-containers.yml b/.github/workflows/build-rust-containers.yml index 4724f2d3e..30cb77bdd 100644 --- a/.github/workflows/build-rust-containers.yml +++ b/.github/workflows/build-rust-containers.yml @@ -48,6 +48,12 @@ jobs: run: | echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.ref_name }}-${{ matrix.component.label }} + - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx @@ -81,13 +87,19 @@ jobs: build-args: | AKRI_COMPONENT=agent EXTRA_CARGO_ARGS=${{matrix.component.cargo-build-args}} - cache-from: type=gha,scope=${{github.ref_name}}-${{matrix.component.label}} - cache-to: type=gha,mode=max,scope=${{github.ref_name}}-${{matrix.component.label}} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} file: build/containers/Dockerfile.rust platforms: linux/amd64,linux/arm64,linux/arm/v7 + # This ensures we don't end-up with an ever-growing cache + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + build-others: runs-on: ubuntu-latest needs: build-agents @@ -114,6 +126,13 @@ jobs: run: | echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT + - name: Cache Docker layers + uses: actions/cache/restore@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.ref_name }}-agent + fail-on-cache-miss: true + - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx @@ -140,7 +159,7 @@ jobs: build-args: | AKRI_COMPONENT=${{matrix.component.label}} EXTRA_CARGO_ARGS=--release - cache-from: type=gha,scope=${{github.ref_name}}-agent + cache-from: type=local,src=/tmp/.buildx-cache # No cache-to here as we want to use the one from agent tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From cb21cff549253eca6299d38f86ad1cf86e1d4ade Mon Sep 17 00:00:00 2001 From: Nicolas Belouin Date: Fri, 27 Oct 2023 08:50:18 +0200 Subject: [PATCH 6/8] Update sleep time and remove now unneeded custom actions Signed-off-by: Nicolas Belouin --- .../build-component-multi-arch/action.yml | 27 ----- .../build-component-multi-arch/main.js | 62 ---------- .../build-component-multi-arch/package.json | 10 -- .../build-component-per-arch/action.yml | 42 ------- .../actions/build-component-per-arch/main.js | 114 ------------------ .../build-component-per-arch/package.json | 10 -- .github/actions/build-intermediate/action.yml | 39 ------ .github/actions/build-intermediate/main.js | 79 ------------ .../actions/build-intermediate/package.json | 10 -- .github/workflows/run-test-cases.yml | 6 +- 10 files changed, 3 insertions(+), 396 deletions(-) delete mode 100644 .github/actions/build-component-multi-arch/action.yml delete mode 100644 .github/actions/build-component-multi-arch/main.js delete mode 100644 .github/actions/build-component-multi-arch/package.json delete mode 100644 .github/actions/build-component-per-arch/action.yml delete mode 100644 .github/actions/build-component-per-arch/main.js delete mode 100644 .github/actions/build-component-per-arch/package.json delete mode 100644 .github/actions/build-intermediate/action.yml delete mode 100644 .github/actions/build-intermediate/main.js delete mode 100644 .github/actions/build-intermediate/package.json diff --git a/.github/actions/build-component-multi-arch/action.yml b/.github/actions/build-component-multi-arch/action.yml deleted file mode 100644 index 06b76bfd2..000000000 --- a/.github/actions/build-component-multi-arch/action.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: 'build-component-multi-arch' -description: 'Build Akri Component Container' -inputs: - container_registry_base_url: - description: Container Registry - required: true - container_registry_username: - description: Container Registry name - required: true - container_registry_password: - description: Container Registry password - required: true - container_name: - description: Component container name - required: true - container_prefix: - description: Container prefix (i.e. 'myacr.acr.io/foo' for myacr.acr.io/foo/container:label) - required: true - makefile_component_name: - description: Component prefix used by Makefile - required: true - github_event_name: - description: Specify the github event name (push, pull_request, release, etc) - required: true -runs: - using: 'node16' - main: 'main.js' diff --git a/.github/actions/build-component-multi-arch/main.js b/.github/actions/build-component-multi-arch/main.js deleted file mode 100644 index 7c600a5b3..000000000 --- a/.github/actions/build-component-multi-arch/main.js +++ /dev/null @@ -1,62 +0,0 @@ -const exec = require('@actions/exec'); -const core = require('@actions/core'); -const child_process = require('child_process'); -const fs = require("fs"); - -async function shell_cmd(cmd) { - return await new Promise((resolve, reject) => { - child_process.exec(cmd, function(error, stdout, stderr) { - if (error) { - console.log(`... error=${error}`) - reject(error) - } - - if (stderr) { - console.log(`... stderr=${stderr.trim()}`) - } - - console.log(`... stdout=${stdout.trim()}`) - resolve(stdout.trim()); - }); - }); -} - -(async () => { - try { - console.log(`Start main.js`) - - var dev_suffix = (core.getInput('github_event_name') == "release") ? "" : "-dev"; - const versioned_label = `v${fs.readFileSync('./version.txt').toString().trim()}${dev_suffix}`; - const latest_label = `latest${dev_suffix}`; - console.log(`Use labels: versioned=${versioned_label} latest=${latest_label}`); - - console.log(`Login into Container Registry user=${core.getInput('container_registry_username')} repo=${core.getInput('container_registry_base_url')}`); - await shell_cmd(`echo "${core.getInput('container_registry_password')}" | docker login -u ${core.getInput('container_registry_username')} --password-stdin ${core.getInput('container_registry_base_url')}`); - - process.env.DOCKER_CLI_EXPERIMENTAL = `enabled` - process.env.PREFIX = `${core.getInput('container_prefix')}` - process.env.LABEL_PREFIX = `${versioned_label}` - - console.log(`echo Create multi-arch versioned manifest`) - await exec.exec(`make ${core.getInput('makefile_component_name')}-docker-multi-arch-create`) - - console.log(`echo Inspect multi-arch versioned manifest`) - await exec.exec(`docker manifest inspect ${core.getInput('container_prefix')}/${core.getInput('container_name')}:${versioned_label}`) - - console.log(`echo Push multi-arch versioned manifest`) - await exec.exec(`make ${core.getInput('makefile_component_name')}-docker-multi-arch-push`) - - process.env.LABEL_PREFIX = `${latest_label}` - - console.log(`echo Create multi-arch latest manifest`) - await exec.exec(`make ${core.getInput('makefile_component_name')}-docker-multi-arch-create`) - - console.log(`echo Inspect multi-arch latest manifest`) - await exec.exec(`docker manifest inspect ${core.getInput('container_prefix')}/${core.getInput('container_name')}:${latest_label}`) - - console.log(`echo Push multi-arch latest manifest`) - await exec.exec(`make ${core.getInput('makefile_component_name')}-docker-multi-arch-push`) - } catch (error) { - core.setFailed(error); - } -})(); \ No newline at end of file diff --git a/.github/actions/build-component-multi-arch/package.json b/.github/actions/build-component-multi-arch/package.json deleted file mode 100644 index 40b329753..000000000 --- a/.github/actions/build-component-multi-arch/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "private": true, - "name": "build-component-multi-arch", - "dependencies": { - "@actions/core": "^1.2.2", - "@actions/exec": "1.0.2", - "child_process": "^1.0.2", - "fs": "^8.1.0" - } - } \ No newline at end of file diff --git a/.github/actions/build-component-per-arch/action.yml b/.github/actions/build-component-per-arch/action.yml deleted file mode 100644 index 5738139d0..000000000 --- a/.github/actions/build-component-per-arch/action.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: 'build-component-per-arch' -description: 'Build Akri Component Container' -inputs: - container_registry_base_url: - description: Container Registry - required: true - container_registry_username: - description: Container Registry name - required: true - container_registry_password: - description: Container Registry password - required: true - container_name: - description: Component container name - required: true - container_prefix: - description: Container prefix (i.e. 'myacr.acr.io/foo' for myacr.acr.io/foo/container:label) - required: true - makefile_component_name: - description: Component prefix used by Makefile - required: true - platform: - description: Platform to build (amd64|arm64|arm32) - required: true - build_rust: - description: Specify whether rust is being built - required: true - github_event_name: - description: Specify the github event name (push, pull_request, release, etc) - required: true - github_ref: - description: Specify the github ref - required: true - github_event_action: - description: Specify the github event action (i.e. closed) - required: true - github_merged: - description: Specify whether a PR has been merged - required: true -runs: - using: 'node16' - main: 'main.js' diff --git a/.github/actions/build-component-per-arch/main.js b/.github/actions/build-component-per-arch/main.js deleted file mode 100644 index 6dda65f39..000000000 --- a/.github/actions/build-component-per-arch/main.js +++ /dev/null @@ -1,114 +0,0 @@ -const exec = require('@actions/exec'); -const core = require('@actions/core'); -const child_process = require('child_process'); -const fs = require("fs"); - -async function shell_cmd(cmd) { - return await new Promise((resolve, reject) => { - child_process.exec(cmd, function(error, stdout, stderr) { - if (error) { - console.log(`... error=${error}`) - reject(error) - } - - if (stderr) { - console.log(`... stderr=${stderr.trim()}`) - } - - console.log(`... stdout=${stdout.trim()}`) - resolve(stdout.trim()); - }); - }); -} - -(async () => { - try { - console.log(`Start main.js`) - - console.log(`Use multiarch/qemu-user-static to configure cross-plat`); - await shell_cmd('docker run --rm --privileged multiarch/qemu-user-static --reset -p yes'); - - var dev_suffix = (core.getInput('github_event_name') == "release") ? "" : "-dev"; - const versioned_label = `v${fs.readFileSync('./version.txt').toString().trim()}${dev_suffix}`; - const latest_label = `latest${dev_suffix}`; - console.log(`Use labels: versioned=${versioned_label} latest=${latest_label}`); - - var push_containers = 0; - if (core.getInput('github_event_name') == 'release') push_containers = 1; - else if (core.getInput('github_event_name') == 'push' && - core.getInput('github_ref') == 'refs/heads/main') push_containers = 1; - else if (core.getInput('github_event_name').startsWith('pull_request') && - core.getInput('github_event_action') == 'closed' && - core.getInput('github_ref') == 'refs/heads/main' && - core.getInput('github_merged') == 'true') push_containers = 1; - else console.log(`Not pushing containers ... event: ${core.getInput('github_event_name')}, ref: ${core.getInput('github_ref')}, action: ${core.getInput('github_event_action')}, merged: ${core.getInput('github_merged')}`); - console.log(`Push containers: ${push_containers}`); - - var makefile_target_suffix = ""; - switch (core.getInput('platform')) { - case "amd64": - process.env.BUILD_AMD64 = 1 - makefile_target_suffix = "amd64"; - break; - case "arm32v7": - process.env.BUILD_ARM32 = 1 - makefile_target_suffix = "arm32"; - break; - case "arm64v8": - process.env.BUILD_ARM64 = 1 - makefile_target_suffix = "arm64"; - break; - default: - core.setFailed(`Failed with unknown platform: ${core.getInput('platform')}`) - return - } - - console.log(`Makefile build target suffix: ${makefile_target_suffix}`) - - if (core.getInput('build_rust') == '1') { - console.log(`Install Rust`) - child_process.execSync(`curl https://sh.rustup.rs | sh -s -- -y --default-toolchain=1.68.1`); - const bindir = `${process.env.HOME}/.cargo/bin`; - process.env.PATH = `${process.env.PATH}:${bindir}`; - - console.log(`Check cargo version`) - await shell_cmd('cargo --version') - console.log(`Install Cross`) - await shell_cmd('make install-cross') - await shell_cmd('cross --version') - console.log(`Cross compile: akri-cross-build-${makefile_target_suffix}`) - await exec.exec(`make akri-cross-build-${makefile_target_suffix}`) - } else { - console.log(`Not building Rust: ${core.getInput('build_rust')}`) - } - - process.env.PREFIX = `${core.getInput('container_prefix')}` - - console.log(`Build the versioned container: make ${core.getInput('makefile_component_name')}-build-${makefile_target_suffix}`) - process.env.LABEL_PREFIX = `${versioned_label}` - await exec.exec(`make ${core.getInput('makefile_component_name')}-build-${makefile_target_suffix}`) - - console.log(`Build the latest container: make ${core.getInput('makefile_component_name')}-build-${makefile_target_suffix}`) - process.env.LABEL_PREFIX = `${latest_label}` - await exec.exec(`make ${core.getInput('makefile_component_name')}-build-${makefile_target_suffix}`) - - const image_name = `${core.getInput('container_prefix')}/${core.getInput('container_name')}:${versioned_label}-${core.getInput('platform')}` - - if (push_containers == "1") { - console.log(`Login into Container Registry user=${core.getInput('container_registry_username')} repo=${core.getInput('container_registry_base_url')}`); - await shell_cmd(`echo "${core.getInput('container_registry_password')}" | docker login -u ${core.getInput('container_registry_username')} --password-stdin ${core.getInput('container_registry_base_url')}`); - - console.log(`Push the versioned container: make ${core.getInput('makefile_component_name')}-docker-per-arch-${makefile_target_suffix}`) - process.env.LABEL_PREFIX = `${versioned_label}` - await exec.exec(`make ${core.getInput('makefile_component_name')}-docker-per-arch-${makefile_target_suffix}`) - - console.log(`Push the latest container: make ${core.getInput('makefile_component_name')}-docker-per-arch-${makefile_target_suffix}`) - process.env.LABEL_PREFIX = `${latest_label}` - await exec.exec(`make ${core.getInput('makefile_component_name')}-docker-per-arch-${makefile_target_suffix}`) - } else { - console.log(`Not pushing containers: ${push_containers}`) - } - } catch (error) { - core.setFailed(error); - } -})(); \ No newline at end of file diff --git a/.github/actions/build-component-per-arch/package.json b/.github/actions/build-component-per-arch/package.json deleted file mode 100644 index d3f346b8a..000000000 --- a/.github/actions/build-component-per-arch/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "private": true, - "name": "build-component-per-arch", - "dependencies": { - "@actions/core": "^1.2.2", - "@actions/exec": "1.0.2", - "child_process": "^1.0.2", - "fs": "^8.1.0" - } - } \ No newline at end of file diff --git a/.github/actions/build-intermediate/action.yml b/.github/actions/build-intermediate/action.yml deleted file mode 100644 index 3e7fde3f1..000000000 --- a/.github/actions/build-intermediate/action.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: 'build-component-per-arch' -description: 'Build Akri Component Container' -inputs: - container_registry_base_url: - description: Container Registry - required: true - container_registry_username: - description: Container Registry name - required: true - container_registry_password: - description: Container Registry password - required: true - container_name: - description: Container name - required: true - container_prefix: - description: Container prefix (i.e. 'myacr.acr.io/foo' for myacr.acr.io/foo/container:label) - required: true - makefile_component_name: - description: Component prefix used by Makefile - required: true - platform: - description: Platform to build (amd64|arm64|arm32) - required: true - github_event_name: - description: Specify the github event name (push, pull_request, release, etc) - required: true - github_ref: - description: Specify the github ref - required: true - github_event_action: - description: Specify the github event action (i.e. closed) - required: true - github_merged: - description: Specify whether a PR has been merged - required: true -runs: - using: 'node16' - main: 'main.js' diff --git a/.github/actions/build-intermediate/main.js b/.github/actions/build-intermediate/main.js deleted file mode 100644 index 1973f86ec..000000000 --- a/.github/actions/build-intermediate/main.js +++ /dev/null @@ -1,79 +0,0 @@ -const exec = require('@actions/exec'); -const core = require('@actions/core'); -const child_process = require('child_process'); -const fs = require("fs"); - -async function shell_cmd(cmd) { - return await new Promise((resolve, reject) => { - child_process.exec(cmd, function(error, stdout, stderr) { - if (error) { - console.log(`... error=${error}`) - reject(error) - } - - if (stderr) { - console.log(`... stderr=${stderr.trim()}`) - } - - console.log(`... stdout=${stdout.trim()}`) - resolve(stdout.trim()); - }); - }); -} - -(async () => { - try { - console.log(`Start main.js`) - - console.log(`Use multiarch/qemu-user-static to configure cross-plat`); - child_process.execSync('docker run --rm --privileged multiarch/qemu-user-static --reset -p yes'); - - var push_containers = 0; - if (core.getInput('github_event_name') == 'release') push_containers = 1; - else if (core.getInput('github_event_name') == 'push' && - core.getInput('github_ref') == 'refs/heads/main') push_containers = 1; - else if (core.getInput('github_event_name').startsWith('pull_request') && - core.getInput('github_event_action') == 'closed' && - core.getInput('github_ref') == 'refs/heads/main' && - core.getInput('github_merged') == 'true') push_containers = 1; - else console.log(`Not pushing containers ... event: ${core.getInput('github_event_name')}, ref: ${core.getInput('github_ref')}, action: ${core.getInput('github_event_action')}, merged: ${core.getInput('github_merged')}`); - console.log(`Push containers: ${push_containers}`); - - var makefile_target_suffix = ""; - switch (core.getInput('platform')) { - case "amd64": - process.env.BUILD_AMD64 = 1 - makefile_target_suffix = "amd64"; - break; - case "arm32v7": - process.env.BUILD_ARM32 = 1 - makefile_target_suffix = "arm32"; - break; - case "arm64v8": - process.env.BUILD_ARM64 = 1 - makefile_target_suffix = "arm64"; - break; - default: - core.setFailed(`Failed with unknown platform: ${core.getInput('platform')}`) - return - } - console.log(`Makefile build target suffix: ${makefile_target_suffix}`) - - process.env.PREFIX = `${core.getInput('container_prefix')}` - - console.log(`Build the versioned container: make ${core.getInput('makefile_component_name')}-build-${makefile_target_suffix}`) - await exec.exec(`make ${core.getInput('makefile_component_name')}-build-${makefile_target_suffix}`) - - if (push_containers == "1") { - console.log(`Login into Container Registry user=${core.getInput('container_registry_username')} repo=${core.getInput('container_registry_base_url')}`); - await shell_cmd(`echo "${core.getInput('container_registry_password')}" | docker login -u ${core.getInput('container_registry_username')} --password-stdin ${core.getInput('container_registry_base_url')}`); - - console.log(`Push the versioned container: make ${core.getInput('makefile_component_name')}-docker-per-arch-${makefile_target_suffix}`) - await exec.exec(`make ${core.getInput('makefile_component_name')}-docker-per-arch-${makefile_target_suffix}`) - } else { - console.log(`Not pushing containers: ${push_containers}`) - } - } catch (error) { - core.setFailed(error); - } -})(); \ No newline at end of file diff --git a/.github/actions/build-intermediate/package.json b/.github/actions/build-intermediate/package.json deleted file mode 100644 index 3504049ff..000000000 --- a/.github/actions/build-intermediate/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "private": true, - "name": "build-intermediate", - "dependencies": { - "@actions/core": "^1.2.2", - "@actions/exec": "1.0.2", - "child_process": "^1.0.2", - "fs": "^8.1.0" - } - } \ No newline at end of file diff --git a/.github/workflows/run-test-cases.yml b/.github/workflows/run-test-cases.yml index 2e4b23294..b798d7f25 100644 --- a/.github/workflows/run-test-cases.yml +++ b/.github/workflows/run-test-cases.yml @@ -108,7 +108,7 @@ jobs: test-cases: needs: build-containers runs-on: ubuntu-latest - timeout-minutes: 90 + timeout-minutes: 95 strategy: fail-fast: false @@ -279,8 +279,8 @@ jobs: # For push and release, we need to wait for the Helm chart and # associated containers to build. - if: github.event_name == 'push' || github.event_name == 'release' - name: sleep before running script for 2700s - run: sleep 2700 + name: sleep before running script for 80 minutes + run: sleep 4800 - name: Execute test script working-directory: ./test/e2e From 70892618671799a3de16fcfba3ef4a06204ea0cb Mon Sep 17 00:00:00 2001 From: Nicolas Belouin Date: Fri, 27 Oct 2023 09:37:54 +0200 Subject: [PATCH 7/8] Use gpg --batch mode Signed-off-by: Nicolas Belouin --- .github/workflows/run-test-cases.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-test-cases.yml b/.github/workflows/run-test-cases.yml index b798d7f25..bfc2fd9c3 100644 --- a/.github/workflows/run-test-cases.yml +++ b/.github/workflows/run-test-cases.yml @@ -189,9 +189,9 @@ jobs: SHORTVERSION=$(cut -d '.' -f 1,2 <<< "${{ matrix.kube.version }}") sudo apt-get update -y sudo apt-get install -y apt-transport-https ca-certificates curl - curl -fsSL https://pkgs.k8s.io/core:/stable:/v${SHORTVERSION}/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg + curl -fsSL https://pkgs.k8s.io/core:/stable:/v${SHORTVERSION}/deb/Release.key | sudo gpg --yes --batch --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${SHORTVERSION}/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list - sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --yes --batch --dearmor -o /usr/share/keyrings/docker.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list sudo apt-get update sudo apt-get install -o Dpkg::Options::="--force-overwrite" -y --allow-downgrades kubelet=${{ matrix.kube.version }}-* kubeadm=${{ matrix.kube.version }}-* kubectl=${{ matrix.kube.version }}-* containerd.io From 93c1dc58fa3483af49462b77663f9a5c42b8dac1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 27 Oct 2023 11:49:03 +0000 Subject: [PATCH 8/8] Update patch version Signed-off-by: github-actions[bot] --- Cargo.lock | 28 +++++++++---------- agent/Cargo.toml | 2 +- controller/Cargo.toml | 2 +- deployment/helm/Chart.yaml | 4 +-- .../debug-echo-discovery-handler/Cargo.toml | 2 +- .../onvif-discovery-handler/Cargo.toml | 2 +- .../opcua-discovery-handler/Cargo.toml | 2 +- .../udev-discovery-handler/Cargo.toml | 2 +- discovery-handlers/debug-echo/Cargo.toml | 2 +- discovery-handlers/onvif/Cargo.toml | 2 +- discovery-handlers/opcua/Cargo.toml | 2 +- discovery-handlers/udev/Cargo.toml | 2 +- discovery-utils/Cargo.toml | 2 +- samples/brokers/udev-video-broker/Cargo.toml | 2 +- shared/Cargo.toml | 2 +- version.txt | 2 +- webhooks/validating/configuration/Cargo.toml | 2 +- 17 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a7381417b..39a0c136e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -298,7 +298,7 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "agent" -version = "0.12.14" +version = "0.12.15" dependencies = [ "akri-debug-echo", "akri-discovery-utils", @@ -358,7 +358,7 @@ dependencies = [ [[package]] name = "akri-debug-echo" -version = "0.12.14" +version = "0.12.15" dependencies = [ "akri-discovery-utils", "akri-shared", @@ -376,7 +376,7 @@ dependencies = [ [[package]] name = "akri-discovery-utils" -version = "0.12.14" +version = "0.12.15" dependencies = [ "akri-shared", "anyhow", @@ -398,7 +398,7 @@ dependencies = [ [[package]] name = "akri-onvif" -version = "0.12.14" +version = "0.12.15" dependencies = [ "akri-discovery-utils", "anyhow", @@ -427,7 +427,7 @@ dependencies = [ [[package]] name = "akri-opcua" -version = "0.12.14" +version = "0.12.15" dependencies = [ "akri-discovery-utils", "anyhow", @@ -446,7 +446,7 @@ dependencies = [ [[package]] name = "akri-shared" -version = "0.12.14" +version = "0.12.15" dependencies = [ "anyhow", "async-trait", @@ -471,7 +471,7 @@ dependencies = [ [[package]] name = "akri-udev" -version = "0.12.14" +version = "0.12.15" dependencies = [ "akri-discovery-utils", "anyhow", @@ -986,7 +986,7 @@ checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" [[package]] name = "controller" -version = "0.12.14" +version = "0.12.15" dependencies = [ "akri-shared", "anyhow", @@ -1178,7 +1178,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" [[package]] name = "debug-echo-discovery-handler" -version = "0.12.14" +version = "0.12.15" dependencies = [ "akri-debug-echo", "akri-discovery-utils", @@ -2479,7 +2479,7 @@ checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "onvif-discovery-handler" -version = "0.12.14" +version = "0.12.15" dependencies = [ "akri-discovery-utils", "akri-onvif", @@ -2529,7 +2529,7 @@ dependencies = [ [[package]] name = "opcua-discovery-handler" -version = "0.12.14" +version = "0.12.15" dependencies = [ "akri-discovery-utils", "akri-opcua", @@ -4134,7 +4134,7 @@ dependencies = [ [[package]] name = "udev-discovery-handler" -version = "0.12.14" +version = "0.12.15" dependencies = [ "akri-discovery-utils", "akri-udev", @@ -4145,7 +4145,7 @@ dependencies = [ [[package]] name = "udev-video-broker" -version = "0.12.14" +version = "0.12.15" dependencies = [ "akri-shared", "env_logger", @@ -4422,7 +4422,7 @@ dependencies = [ [[package]] name = "webhook-configuration" -version = "0.12.14" +version = "0.12.15" dependencies = [ "actix-rt 2.7.0", "actix-web", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 0b9e8f073..7a527d32c 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "agent" -version = "0.12.14" +version = "0.12.15" license = "Apache-2.0" authors = ["Kate Goldenring ", ""] edition = "2018" diff --git a/controller/Cargo.toml b/controller/Cargo.toml index b10368aad..9e357274a 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "controller" -version = "0.12.14" +version = "0.12.15" license = "Apache-2.0" authors = ["", ""] edition = "2018" diff --git a/deployment/helm/Chart.yaml b/deployment/helm/Chart.yaml index 5f89ee67d..97b55c151 100644 --- a/deployment/helm/Chart.yaml +++ b/deployment/helm/Chart.yaml @@ -16,9 +16,9 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.12.14 +version: 0.12.15 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: 0.12.14 +appVersion: 0.12.15 diff --git a/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml b/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml index 3f1148b9e..c0e8c552c 100644 --- a/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "debug-echo-discovery-handler" -version = "0.12.14" +version = "0.12.15" license = "Apache-2.0" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handler-modules/onvif-discovery-handler/Cargo.toml b/discovery-handler-modules/onvif-discovery-handler/Cargo.toml index 8a9cfa36a..36226b429 100644 --- a/discovery-handler-modules/onvif-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/onvif-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "onvif-discovery-handler" -version = "0.12.14" +version = "0.12.15" license = "Apache-2.0" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handler-modules/opcua-discovery-handler/Cargo.toml b/discovery-handler-modules/opcua-discovery-handler/Cargo.toml index 36517cca1..e75ecffcf 100644 --- a/discovery-handler-modules/opcua-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/opcua-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "opcua-discovery-handler" -version = "0.12.14" +version = "0.12.15" license = "Apache-2.0" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handler-modules/udev-discovery-handler/Cargo.toml b/discovery-handler-modules/udev-discovery-handler/Cargo.toml index 2ea176dee..5fd9eb391 100644 --- a/discovery-handler-modules/udev-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/udev-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "udev-discovery-handler" -version = "0.12.14" +version = "0.12.15" license = "Apache-2.0" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handlers/debug-echo/Cargo.toml b/discovery-handlers/debug-echo/Cargo.toml index 6e800435a..b2f00e0fb 100644 --- a/discovery-handlers/debug-echo/Cargo.toml +++ b/discovery-handlers/debug-echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-debug-echo" -version = "0.12.14" +version = "0.12.15" license = "Apache-2.0" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handlers/onvif/Cargo.toml b/discovery-handlers/onvif/Cargo.toml index e6f66e4e9..409a9bfe8 100644 --- a/discovery-handlers/onvif/Cargo.toml +++ b/discovery-handlers/onvif/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-onvif" -version = "0.12.14" +version = "0.12.15" license = "Apache-2.0" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handlers/opcua/Cargo.toml b/discovery-handlers/opcua/Cargo.toml index 1da1fdfc0..6240e23df 100644 --- a/discovery-handlers/opcua/Cargo.toml +++ b/discovery-handlers/opcua/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-opcua" -version = "0.12.14" +version = "0.12.15" license = "Apache-2.0" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handlers/udev/Cargo.toml b/discovery-handlers/udev/Cargo.toml index adda735de..113b3aa5c 100644 --- a/discovery-handlers/udev/Cargo.toml +++ b/discovery-handlers/udev/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-udev" -version = "0.12.14" +version = "0.12.15" license = "Apache-2.0" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-utils/Cargo.toml b/discovery-utils/Cargo.toml index 8e04ca81b..bb5da541c 100644 --- a/discovery-utils/Cargo.toml +++ b/discovery-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-discovery-utils" -version = "0.12.14" +version = "0.12.15" license = "Apache-2.0" authors = ["Kate Goldenring "] edition = "2018" diff --git a/samples/brokers/udev-video-broker/Cargo.toml b/samples/brokers/udev-video-broker/Cargo.toml index 6a5ee0a54..bc30aa4ed 100644 --- a/samples/brokers/udev-video-broker/Cargo.toml +++ b/samples/brokers/udev-video-broker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "udev-video-broker" -version = "0.12.14" +version = "0.12.15" license = "Apache-2.0" authors = ["Kate Goldenring ", ""] edition = "2018" diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 68cf109ed..bf82a22a9 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-shared" -version = "0.12.14" +version = "0.12.15" license = "Apache-2.0" authors = [""] edition = "2018" diff --git a/version.txt b/version.txt index d0834a7f5..79d099b8e 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.12.14 +0.12.15 diff --git a/webhooks/validating/configuration/Cargo.toml b/webhooks/validating/configuration/Cargo.toml index 8eff39d18..ae7fccf21 100644 --- a/webhooks/validating/configuration/Cargo.toml +++ b/webhooks/validating/configuration/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "webhook-configuration" -version = "0.12.14" +version = "0.12.15" license = "Apache-2.0" authors = ["DazWilkin "] edition = "2018"