From 7435bbbee7a56efeec05b8ef2b8da62e1d8ae86d Mon Sep 17 00:00:00 2001 From: Se7en Date: Thu, 27 Jun 2024 12:42:48 +0800 Subject: [PATCH] push attached files --- .../build-and-push-wasm-go-plugin.yaml | 41 +++++++++++++------ .../extensions/bot-detect/plugin.tar.gz | 0 2 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 plugins/wasm-go/extensions/bot-detect/plugin.tar.gz diff --git a/.github/workflows/build-and-push-wasm-go-plugin.yaml b/.github/workflows/build-and-push-wasm-go-plugin.yaml index 457c696fdb..62de995167 100644 --- a/.github/workflows/build-and-push-wasm-go-plugin.yaml +++ b/.github/workflows/build-and-push-wasm-go-plugin.yaml @@ -48,27 +48,42 @@ jobs: PLUGIN_DIRS=$(basename -a ./extensions/*) fi - for plugin in ${PLUGIN_DIRS[@]}; do - echo "Build and push wasm go plugin: ${plugin}" - max_retries=3 - retries=0 - while [[ "${retries}" -lt "${max_retries}" ]]; do - IMAGE="${{ env.IMAGE_REGISTRY_SERVICE }}/${{ env.IMAGE_REPOSITORY }}/wasm-go-${plugin}:${PLUGIN_VERSION}" - PLUGIN_DIR="./extensions/${plugin}" - GOPROXY="https://proxy.golang.org,direct" PLUGIN_NAME="${plugin}" make build + for PLUGIN in ${PLUGIN_DIRS[@]}; do + echo "Build and push wasm go plugin: ${PLUGIN}" + MAX_RETRIES=3 + RETRIES=0 + while [[ "${RETRIES}" -lt "${MAX_RETRIES}" ]]; do + IMAGE="${{ env.IMAGE_REGISTRY_SERVICE }}/${{ env.IMAGE_REPOSITORY }}/wasm-go-${PLUGIN}:${PLUGIN_VERSION}" + PLUGIN_DIR="./extensions/${PLUGIN}" + GOPROXY="https://proxy.golang.org,direct" PLUGIN_NAME="${PLUGIN}" make build if [[ $? -eq 0 ]]; then tar czvf "${PLUGIN_DIR}/plugin.tar.gz" "${PLUGIN_DIR}/plugin.wasm" - oras push "$IMAGE" "${PLUGIN_DIR}/plugin.tar.gz:application/vnd.oci.image.layer.v1.tar+gzip" + PUSH_FILES="${PLUGIN_DIR}/plugin.tar.gz:application/vnd.oci.image.layer.v1.tar+gzip" + declare -A FILES=( + ["spec.yaml"]="application/vnd.module.wasm.spec.v1+yaml" + ["README.md"]="application/vnd.module.wasm.doc.v1+markdown" + ["README_EN.md"]="application/vnd.module.wasm.doc.v1.en+markdown" + ) + + for FILE in "${!FILES[@]}"; do + FILE_PATH="${PLUGIN_DIR}/${FILE}" + if [[ -f "${FILE_PATH}" ]]; then + PUSH_FILES="${PUSH_FILES} ${FILE_PATH}:${FILES[$FILE]}" + fi + done + echo "${PUSH_FILES}" + echo "${FILES}" + oras push "${IMAGE}" "${PUSH_FILES}" break else - (( retries++ )) - echo "Build failed. Retrying ${retries}/${max_retries}..." + (( RETRIES++ )) + echo "Build failed. Retrying ${RETRIES}/${MAX_RETRIES}..." fi done - if [[ "${retries}" -eq "${max_retries}" ]]; then - echo "Build failed after ${max_retries} retries." + if [[ "${RETRIES}" -eq "${MAX_RETRIES}" ]]; then + echo "Build failed after ${MAX_RETRIES} retries." exit 1 fi done diff --git a/plugins/wasm-go/extensions/bot-detect/plugin.tar.gz b/plugins/wasm-go/extensions/bot-detect/plugin.tar.gz new file mode 100644 index 0000000000..e69de29bb2