Implement Rust Wasm Plugin Build & Publish Action (#1483)

This commit is contained in:
007gzs
2024-11-07 20:20:42 +08:00
committed by GitHub
parent 73cf32aadd
commit aee37c5e22
3 changed files with 95 additions and 7 deletions

View File

@@ -1,5 +1,10 @@
PLUGIN_NAME ?= say-hello
BUILDER_REGISTRY ?= higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/
REGISTRY ?= higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/
RUST_VERSION ?= 1.82
ORAS_VERSION ?= 1.0.0
HIGRESS_VERSION ?= 1.0.0-rc
BUILDER ?= ${BUILDER_REGISTRY}wasm-rust-builder:rust${RUST_VERSION}-oras${ORAS_VERSION}
BUILD_TIME := $(shell date "+%Y%m%d-%H%M%S")
COMMIT_ID := $(shell git rev-parse --short HEAD 2>/dev/null)
IMAGE_TAG = $(if $(strip $(PLUGIN_VERSION)),${PLUGIN_VERSION},${BUILD_TIME}-${COMMIT_ID})
@@ -21,3 +26,16 @@ lint-base:
lint:
cargo fmt --all --check --manifest-path extensions/${PLUGIN_NAME}/Cargo.toml
cargo clippy --workspace --all-features --all-targets --manifest-path extensions/${PLUGIN_NAME}/Cargo.toml
builder:
docker buildx build --no-cache \
--platform linux/amd64,linux/arm64 \
--build-arg RUST_VERSION=$(RUST_VERSION) \
--build-arg ORAS_VERSION=$(ORAS_VERSION) \
--build-arg HIGRESS_VERSION=$(HIGRESS_VERSION) \
-f DockerfileBuilder \
-t ${BUILDER} \
--push \
.
@echo ""
@echo "image: ${BUILDER}"