mirror of
https://github.com/alibaba/higress.git
synced 2026-07-28 23:30:29 +08:00
feat(ci): allow custom wasm plugin image name via .buildrc (#4053)
Signed-off-by: CH3CHO <ch3cho@qq.com>
This commit is contained in:
@@ -104,11 +104,6 @@ jobs:
|
||||
push_command=${push_command#\"}
|
||||
push_command=${push_command%\"} # 删除PUSH_COMMAND中的双引号,确保oras push正常解析
|
||||
|
||||
target_image="${{ env.IMAGE_REGISTRY_SERVICE }}/${{ env.IMAGE_REPOSITORY}}/${{ env.PLUGIN_NAME }}:${{ env.VERSION }}"
|
||||
target_image_latest="${{ env.IMAGE_REGISTRY_SERVICE }}/${{ env.IMAGE_REPOSITORY}}/${{ env.PLUGIN_NAME }}:latest"
|
||||
echo "TargetImage=${target_image}"
|
||||
echo "TargetImageLatest=${target_image_latest}"
|
||||
|
||||
cd ${{ github.workspace }}/plugins/wasm-${PLUGIN_TYPE}/extensions/${PLUGIN_NAME}
|
||||
if [ -f ./.buildrc ]; then
|
||||
echo 'Found .buildrc file, sourcing it...'
|
||||
@@ -116,6 +111,21 @@ jobs:
|
||||
else
|
||||
echo '.buildrc file not found'
|
||||
fi
|
||||
|
||||
# Resolve custom image short name from .buildrc, fallback to plugin directory name.
|
||||
# .buildrc may define IMAGE_NAME=xxx to override the output image tag.
|
||||
IMAGE_NAME=${IMAGE_NAME:-$PLUGIN_NAME}
|
||||
if ! [[ "$IMAGE_NAME" =~ ^[a-z0-9._-]+$ ]]; then
|
||||
echo "::error::Invalid IMAGE_NAME '$IMAGE_NAME' in .buildrc — must match [a-z0-9._-]+"
|
||||
exit 1
|
||||
fi
|
||||
echo "IMAGE_NAME=${IMAGE_NAME}"
|
||||
|
||||
target_image="${{ env.IMAGE_REGISTRY_SERVICE }}/${{ env.IMAGE_REPOSITORY}}/${IMAGE_NAME}:${{ env.VERSION }}"
|
||||
target_image_latest="${{ env.IMAGE_REGISTRY_SERVICE }}/${{ env.IMAGE_REPOSITORY}}/${IMAGE_NAME}:latest"
|
||||
echo "TargetImage=${target_image}"
|
||||
echo "TargetImageLatest=${target_image_latest}"
|
||||
|
||||
echo "EXTRA_TAGS=${EXTRA_TAGS}"
|
||||
if [ "${PLUGIN_TYPE}" == "go" ]; then
|
||||
command="
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
```bash
|
||||
# NOTE: 如果你想在构建插件的时候设置额外的构建参数 EXTRA_TAGS
|
||||
# 请更新 extensions/${PLUGIN_NAME} 插件目录对应的 .buildrc 文件
|
||||
# NOTE: 如果你想自定义最终推送的镜像短名(覆盖默认的插件目录名),
|
||||
# 可以在 .buildrc 中添加 IMAGE_NAME=<your-image-name>。
|
||||
# 镜像短名只能包含小写字母、数字、`.`、`_`、`-`,否则构建会失败。
|
||||
# 本设置仅影响推送的镜像 tag,不影响源码路径。
|
||||
$ PLUGIN_NAME=request-block make build
|
||||
```
|
||||
|
||||
|
||||
@@ -9,6 +9,10 @@ The wasm-go plugin can be built quickly with the following command:
|
||||
```bash
|
||||
# NOTE: if you want to set EXTRA_TAGS for the wasm plugin
|
||||
# please set them in the .buildrc file under extensions/${PLUGIN_NAME} directory
|
||||
# NOTE: to override the output image short name (default: plugin directory name),
|
||||
# add `IMAGE_NAME=<your-image-name>` to .buildrc.
|
||||
# The image name must contain only [a-z0-9._-], or the build will fail.
|
||||
# This affects the pushed image tag only, not the source code path.
|
||||
$ PLUGIN_NAME=request-block make build
|
||||
```
|
||||
|
||||
|
||||
1
plugins/wasm-go/extensions/basic-auth/.buildrc
Normal file
1
plugins/wasm-go/extensions/basic-auth/.buildrc
Normal file
@@ -0,0 +1 @@
|
||||
IMAGE_NAME=go-basic-auth
|
||||
1
plugins/wasm-go/extensions/bot-detect/.buildrc
Normal file
1
plugins/wasm-go/extensions/bot-detect/.buildrc
Normal file
@@ -0,0 +1 @@
|
||||
IMAGE_NAME=go-bot-detect
|
||||
1
plugins/wasm-go/extensions/custom-response/.buildrc
Normal file
1
plugins/wasm-go/extensions/custom-response/.buildrc
Normal file
@@ -0,0 +1 @@
|
||||
IMAGE_NAME=go-custom-response
|
||||
1
plugins/wasm-go/extensions/jwt-auth/.buildrc
Normal file
1
plugins/wasm-go/extensions/jwt-auth/.buildrc
Normal file
@@ -0,0 +1 @@
|
||||
IMAGE_NAME=go-jwt-auth
|
||||
1
plugins/wasm-go/extensions/key-auth/.buildrc
Normal file
1
plugins/wasm-go/extensions/key-auth/.buildrc
Normal file
@@ -0,0 +1 @@
|
||||
IMAGE_NAME=go-key-auth
|
||||
1
plugins/wasm-go/extensions/sni-misdirect/.buildrc
Normal file
1
plugins/wasm-go/extensions/sni-misdirect/.buildrc
Normal file
@@ -0,0 +1 @@
|
||||
IMAGE_NAME=go-sni-misdirect
|
||||
Reference in New Issue
Block a user