aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2023-05-23 15:25:56 +0200
committerChristian Marangi <ansuelsmth@gmail.com>2023-05-23 23:33:13 +0200
commit23a5c715a9296e828be5c32eadf68eacdb326a0a (patch)
tree776afa690c82c214df3c0c4da23d9e45143e63e6 /.github/workflows
parent803b0110485a12c1119a51044d17979795ede966 (diff)
downloadupstream-23a5c715a9296e828be5c32eadf68eacdb326a0a.tar.gz
upstream-23a5c715a9296e828be5c32eadf68eacdb326a0a.tar.bz2
upstream-23a5c715a9296e828be5c32eadf68eacdb326a0a.zip
CI: build: add checks to test if toolchain container can be used
Add checks to test if toolchain container can be used. This is to handle case of new target or migration of any sort. If the toolchain container can't be found, the tools container is used instead. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build.yml20
1 files changed, 18 insertions, 2 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef7fc51d9ad..f60e4748a09 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -66,6 +66,7 @@ jobs:
owner_lc: ${{ steps.lower_owner.outputs.owner_lc }}
ccache_hash: ${{ steps.ccache_hash.outputs.ccache_hash }}
container_tag: ${{ steps.determine_tools_container.outputs.container_tag }}
+ container_name: ${{ steps.determine_tools_container.outputs.container_name }}
steps:
- name: Checkout
@@ -99,6 +100,7 @@ jobs:
- name: Determine tools container tag
id: determine_tools_container
run: |
+ CONTAINER_NAME=${{ inputs.container_name }}
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
@@ -115,15 +117,29 @@ jobs:
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"
+
+ if [ "$CONTAINER_NAME" = "toolchain" ]; then
+ GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64)
+ GHCR_HEADER="Authorization: Bearer ${GHCR_TOKEN}"
+ GHCR_MANIFEST_LINK=https://ghcr.io/v2/${{ steps.lower_owner.outputs.owner_lc }}/${{ inputs.container_name }}/manifests/${{ inputs.target }}-${{ inputs.subtarget }}-"$CONTAINER_TAG"
+ # Check if container exist
+ if [ $(curl -s -o /dev/null -w "%{http_code}" -H "$GHCR_HEADER" -I "$GHCR_MANIFEST_LINK") = 200 ]; then
+ CONTAINER_TAG=${{ inputs.target }}-${{ inputs.subtarget }}-"$CONTAINER_TAG"
+ else
+ CONTAINER_NAME=tools
+ fi
+ fi
+
+ echo "Tools container to use $CONTAINER_NAME:$CONTAINER_TAG"
echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT
+ echo "container_name=$CONTAINER_NAME" >> $GITHUB_OUTPUT
build:
name: Build ${{ inputs.target }}/${{ inputs.subtarget }}
needs: setup_build
runs-on: ubuntu-latest
- container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/${{ inputs.container_name }}:${{ needs.setup_build.outputs.container_tag }}
+ container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/${{ needs.setup_build.outputs.container_name }}:${{ needs.setup_build.outputs.container_tag }}
permissions:
contents: read