From 14d3f42ec0515a00a5562141693ba8fc05bb4a46 Mon Sep 17 00:00:00 2001 From: BushraS-Protean Date: Tue, 20 May 2025 15:59:47 +0530 Subject: [PATCH] Update build-and-deploy-plugins.yml --- .../workflows/build-and-deploy-plugins.yml | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-and-deploy-plugins.yml b/.github/workflows/build-and-deploy-plugins.yml index 731a42e..aa44d2f 100644 --- a/.github/workflows/build-and-deploy-plugins.yml +++ b/.github/workflows/build-and-deploy-plugins.yml @@ -40,41 +40,43 @@ jobs: echo "📂 Deep list of Gerrit repo:" find gerrit-repo + - name: Build Go plugins in Docker run: | set -e - mkdir -p $PLUGIN_OUTPUT_DIR + mkdir -p $PLUGIN_OUTPUT_DIR github-repo/plugins-temp + BUILD_CMDS="" - - # GitHub Plugins + + # GitHub plugins for dir in github-repo/pkg/plugin/implementation/*; do if [ -d "$dir/cmd" ]; then plugin=$(basename "$dir") BUILD_CMDS+="cd github-repo && go build -buildmode=plugin -buildvcs=false -o ../${PLUGIN_OUTPUT_DIR}/${plugin}.so ./pkg/plugin/implementation/${plugin}/cmd && cd - && " fi done - + + # Copy Gerrit plugins into GitHub repo so they inherit its go.mod for dir in gerrit-repo/plugins/*; do + plugin=$(basename "$dir") + cp -r "$dir" "github-repo/plugins-temp/$plugin" + done + + # Build copied Gerrit plugins + for dir in github-repo/plugins-temp/*; do if [ -d "$dir/cmd" ]; then plugin=$(basename "$dir") - BUILD_CMDS+="cd $dir/cmd && go mod init temp/$plugin && go build -buildmode=plugin -o /app/${PLUGIN_OUTPUT_DIR}/${plugin}.so && cd - && " + BUILD_CMDS+="cd github-repo && go build -buildmode=plugin -buildvcs=false -o ../${PLUGIN_OUTPUT_DIR}/${plugin}.so ./plugins-temp/${plugin}/cmd && cd - && " fi done - - # Gerrit Plugins (confirmed path: gerrit-repo/plugins/*/cmd) - #for dir in gerrit-repo/plugins/*; do - # if [ -d "$dir/cmd" ]; then - # plugin=$(basename "$dir") - # BUILD_CMDS+="go build -buildmode=plugin -buildvcs=false -o ${PLUGIN_OUTPUT_DIR}/${plugin}.so ./${dir}/cmd && " - # fi - #done - + BUILD_CMDS=${BUILD_CMDS%" && "} echo "🛠️ Running build commands inside Docker:" echo "$BUILD_CMDS" docker run --rm -v "$(pwd)":/app -w /app golang:1.24-bullseye sh -c "$BUILD_CMDS" + - name: List zip output run: | ls -lh plugins_bundle.zip