From 71e5271716e09814fb1413f0ce90c4d8919a5879 Mon Sep 17 00:00:00 2001 From: lea Date: Wed, 17 Jul 2024 21:18:58 -0700 Subject: [PATCH] feat(ci): add commit tracking to mg (#1537) (#1539) close #1429 (cherry picked from commit 0c37ae038e8e1989e00d576017f83bcf6ecb0f5e) Co-authored-by: madomado --- .github/workflows/autobuild.yml | 4 ++-- .github/workflows/build.yml | 30 ++++++++++++++---------------- .github/workflows/json-build.yml | 4 ++-- .github/workflows/mg.sh | 2 +- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 084654abb1..fca369071c 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -94,7 +94,7 @@ jobs: - name: Notify Madoguchi (Success) if: success() && github.event_name == 'push' - run: ./.github/workflows/mg.sh true ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} + run: ./.github/workflows/mg.sh true ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} ${{github.sha}} - name: Notify Madoguchi (Failure) if: ( cancelled() || failure() ) && github.event_name == 'push' - run: ./.github/workflows/mg.sh false ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} + run: ./.github/workflows/mg.sh false ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} ${{github.sha}} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 853784b9f7..ba1951f984 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,8 +14,6 @@ on: required: false default: all type: string - - jobs: parse: @@ -28,18 +26,18 @@ jobs: - name: Parse Input id: parsing run: | - echo "${{ inputs.packages }}" | sed 's/ /\n/g' | sed 's/$/\//g' | jq -R . | jq -s . | jq -c . | sed 's/^/pkgs=/' >> $GITHUB_OUTPUT - echo "builder=${{ inputs.custom_builder }}" >> $GITHUB_OUTPUT - arch="${{ inputs.architecture }}" - # Convert to json array using jq - # if arch is not all, convert to array - if [ "$arch" != "all" ]; then - # jq, array with single element as string - arch=$(echo $arch | sed 's/,/\n/g') - echo "arch=$(echo $arch | jq -Rs 'split("\n")' | jq 'map(select(length > 0))' | jq -c .)" >> $GITHUB_OUTPUT - else - echo "arch=$(echo '["aarch64", "x86_64"]' | jq -c .)" >> $GITHUB_OUTPUT - fi + echo "${{ inputs.packages }}" | sed 's/ /\n/g' | sed 's/$/\//g' | jq -R . | jq -s . | jq -c . | sed 's/^/pkgs=/' >> $GITHUB_OUTPUT + echo "builder=${{ inputs.custom_builder }}" >> $GITHUB_OUTPUT + arch="${{ inputs.architecture }}" + # Convert to json array using jq + # if arch is not all, convert to array + if [ "$arch" != "all" ]; then + # jq, array with single element as string + arch=$(echo $arch | sed 's/,/\n/g') + echo "arch=$(echo $arch | jq -Rs 'split("\n")' | jq 'map(select(length > 0))' | jq -c .)" >> $GITHUB_OUTPUT + else + echo "arch=$(echo '["aarch64", "x86_64"]' | jq -c .)" >> $GITHUB_OUTPUT + fi build: needs: parse @@ -102,7 +100,7 @@ jobs: - name: Notify Madoguchi (Success) if: success() - run: ./.github/workflows/mg.sh true ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} + run: ./.github/workflows/mg.sh true ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} ${{github.sha}} - name: Notify Madoguchi (Failure) if: cancelled() || failure() - run: ./.github/workflows/mg.sh false ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} + run: ./.github/workflows/mg.sh false ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} ${{github.sha}} diff --git a/.github/workflows/json-build.yml b/.github/workflows/json-build.yml index a9ef395779..1eb08fd47c 100644 --- a/.github/workflows/json-build.yml +++ b/.github/workflows/json-build.yml @@ -67,7 +67,7 @@ jobs: - name: Notify Madoguchi (Success) if: success() - run: ./.github/workflows/mg.sh true ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} + run: ./.github/workflows/mg.sh true ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} ${{github.sha}} - name: Notify Madoguchi (Failure) if: cancelled() || failure() - run: ./.github/workflows/mg.sh false ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} + run: ./.github/workflows/mg.sh false ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} ${{github.sha}} diff --git a/.github/workflows/mg.sh b/.github/workflows/mg.sh index 1d581aef14..037c4197a1 100755 --- a/.github/workflows/mg.sh +++ b/.github/workflows/mg.sh @@ -2,7 +2,7 @@ set -x dirs=$2 dirs=${dirs/\/pkg/} -export p="{\"id\":\"$5\",\"ver\":\"%v\",\"rel\":\"%r\",\"arch\":\"$4\",\"dirs\":\"$dirs\",\"succ\":$1}" +export p="{\"id\":\"$5\",\"ver\":\"%v\",\"rel\":\"%r\",\"arch\":\"$4\",\"dirs\":\"$dirs\",\"succ\":$1,\"commit\":\"%6\"}" if [[ $1 == false ]]; then d=${p/\%v/?}