summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2022-12-04 20:28:28 +0100
committerChristian Marangi <ansuelsmth@gmail.com>2022-12-04 21:13:46 +0100
commitd48f38c30f7c3d8458d86fec238b5153f78df297 (patch)
tree3ab72add170fbf7c752e73e85509aea6742f14a9
parent26f35c40b624600b07292951c0ced58db500ce66 (diff)
downloadopenwrt-d48f38c30f7c3d8458d86fec238b5153f78df297.tar.gz
openwrt-d48f38c30f7c3d8458d86fec238b5153f78df297.tar.bz2
openwrt-d48f38c30f7c3d8458d86fec238b5153f78df297.zip
CI: fix matching for openwrt release branch for container selection
The current match logic doesn't handle test for push events related to stable release (example openwrt-22.03) but only fork with the related prefix (example openwrt-22.03-fixup) Fix wrong matching and while at it also add extra checks to other matching (check if the branch name actually start with the requested prefix) Fixes: abe8a4824210 ("CI: build: add support for per branch tools container") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> (cherry picked from commit 65c3d19c4b28ccac0d08d916de0ffa4c0e7b3dc2)
-rw-r--r--.github/workflows/build.yml10
-rw-r--r--.github/workflows/check-kernel-patches.yml10
2 files changed, 12 insertions, 8 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 511d9596fa..f35a70d8f9 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -62,16 +62,18 @@ jobs:
run: |
CONTAINER_TAG=latest
if [ -n "${{ github.base_ref }}" ]; then
- if echo "${{ github.base_ref }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then
+ if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
CONTAINER_TAG="${{ github.base_ref }}"
fi
elif [ ${{ github.ref_type }} == "branch" ]; then
- if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]-'; then
+ if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
+ CONTAINER_TAG=${{ github.ref_name }}
+ elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then
CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')"
fi
elif [ ${{ github.ref_type }} == "tag" ]; then
- if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then
- CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
+ if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then
+ CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
fi
fi
echo "Tools container to use tools:$CONTAINER_TAG"
diff --git a/.github/workflows/check-kernel-patches.yml b/.github/workflows/check-kernel-patches.yml
index f01782d5da..e5b619064f 100644
--- a/.github/workflows/check-kernel-patches.yml
+++ b/.github/workflows/check-kernel-patches.yml
@@ -39,16 +39,18 @@ jobs:
run: |
CONTAINER_TAG=latest
if [ -n "${{ github.base_ref }}" ]; then
- if echo "${{ github.base_ref }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then
+ if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
CONTAINER_TAG="${{ github.base_ref }}"
fi
elif [ ${{ github.ref_type }} == "branch" ]; then
- if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]-'; then
+ if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
+ CONTAINER_TAG=${{ github.ref_name }}
+ elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then
CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')"
fi
elif [ ${{ github.ref_type }} == "tag" ]; then
- if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then
- CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
+ if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then
+ CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
fi
fi
echo "Tools container to use tools:$CONTAINER_TAG"