mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #14980 from saheerb/master
github action fix for uppercase repository ownerpull/14982/head
commit
e14b9617dd
|
@ -58,6 +58,7 @@ jobs:
|
||||||
echo ${{ steps.extract_branch.outputs.branch }}-${date} > build_info/prod_tag_dated
|
echo ${{ steps.extract_branch.outputs.branch }}-${date} > build_info/prod_tag_dated
|
||||||
echo ${{ steps.extract_branch.outputs.branch }}-latest > build_info/prod_tag_latest
|
echo ${{ steps.extract_branch.outputs.branch }}-latest > build_info/prod_tag_latest
|
||||||
echo ${{ steps.extract_branch.outputs.branch }} > build_info/mbed_os_version
|
echo ${{ steps.extract_branch.outputs.branch }} > build_info/mbed_os_version
|
||||||
|
echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]' > build_info/repository_owner
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Archive information
|
name: Archive information
|
||||||
|
@ -95,6 +96,8 @@ jobs:
|
||||||
value=`cat prod_tag_latest`
|
value=`cat prod_tag_latest`
|
||||||
echo "::set-output name=DOCKER_PROD_TAG_LATEST::$value"
|
echo "::set-output name=DOCKER_PROD_TAG_LATEST::$value"
|
||||||
echo "PROD TAG is $value"
|
echo "PROD TAG is $value"
|
||||||
|
value=`cat repository_owner`
|
||||||
|
echo "::set-output name=REPO_OWNER::$value"
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
|
@ -125,7 +128,7 @@ jobs:
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
file: ./docker_images/mbed-os-env/Dockerfile
|
file: ./docker_images/mbed-os-env/Dockerfile
|
||||||
tags: ghcr.io/${{ github.repository_owner }}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }}
|
tags: ghcr.io/${{ steps.build_info.outputs.REPO_OWNER }}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }}
|
||||||
|
|
||||||
test-container:
|
test-container:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -156,6 +159,8 @@ jobs:
|
||||||
echo "::set-output name=DOCKER_PROD_TAG_LATEST::$value"
|
echo "::set-output name=DOCKER_PROD_TAG_LATEST::$value"
|
||||||
value=`cat mbed_os_version`
|
value=`cat mbed_os_version`
|
||||||
echo "::set-output name=MBED_OS_VERSION::$value"
|
echo "::set-output name=MBED_OS_VERSION::$value"
|
||||||
|
value=`cat repository_owner`
|
||||||
|
echo "::set-output name=REPO_OWNER::$value"
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
|
@ -165,7 +170,7 @@ jobs:
|
||||||
name: Find DEV DOCKER DIGEST
|
name: Find DEV DOCKER DIGEST
|
||||||
id: docker_info_dev
|
id: docker_info_dev
|
||||||
run: |
|
run: |
|
||||||
DIGEST=$(python ./.github/workflows/ci_scripts/ghcr_utils.py -u ${{ github.repository_owner }} -p ${{ secrets.GITHUB_TOKEN }} get-digest -r mbed-os-env-tmp -t ${{ steps.build_info.outputs.DOCKER_DEV_TAG }} -p ${{ matrix.platform }} )
|
DIGEST=$(python ./.github/workflows/ci_scripts/ghcr_utils.py -u ${{ steps.build_info.outputs.REPO_OWNER }} -p ${{ secrets.GITHUB_TOKEN }} get-digest -r mbed-os-env-tmp -t ${{ steps.build_info.outputs.DOCKER_DEV_TAG }} -p ${{ matrix.platform }} )
|
||||||
echo "::set-output name=DIGEST::$DIGEST"
|
echo "::set-output name=DIGEST::$DIGEST"
|
||||||
echo "Docker DIGEST: $DIGEST"
|
echo "Docker DIGEST: $DIGEST"
|
||||||
|
|
||||||
|
@ -191,7 +196,7 @@ jobs:
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
options: -v ${{ github.workspace }}:/work -w=/work
|
options: -v ${{ github.workspace }}:/work -w=/work
|
||||||
image: ghcr.io/${{ github.repository_owner }}/mbed-os-env-tmp@${{ steps.docker_info_dev.outputs.DIGEST }}
|
image: ghcr.io/${{ steps.build_info.outputs.REPO_OWNER }}/mbed-os-env-tmp@${{ steps.docker_info_dev.outputs.DIGEST }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
run: |
|
run: |
|
||||||
|
@ -229,9 +234,11 @@ jobs:
|
||||||
echo "::set-output name=DOCKER_PROD_TAG_DATED::$value"
|
echo "::set-output name=DOCKER_PROD_TAG_DATED::$value"
|
||||||
value=`cat prod_tag_latest`
|
value=`cat prod_tag_latest`
|
||||||
echo "::set-output name=DOCKER_PROD_TAG_LATEST::$value"
|
echo "::set-output name=DOCKER_PROD_TAG_LATEST::$value"
|
||||||
|
value=`cat repository_owner`
|
||||||
|
echo "::set-output name=REPO_OWNER::$value"
|
||||||
|
|
||||||
-
|
-
|
||||||
name: copy dev tag to prod
|
name: copy dev tag to prod
|
||||||
run: |
|
run: |
|
||||||
docker run quay.io/skopeo/stable --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} copy --all docker://ghcr.io/${{ github.repository_owner }}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }} docker://ghcr.io/${{ github.repository_owner }}/mbed-os-env:${{ steps.build_info.outputs.DOCKER_PROD_TAG_LATEST }}
|
docker run quay.io/skopeo/stable --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} copy --all docker://ghcr.io/${{ steps.build_info.outputs.REPO_OWNER }}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }} docker://ghcr.io/${{ steps.build_info.outputs.REPO_OWNER }}/mbed-os-env:${{ steps.build_info.outputs.DOCKER_PROD_TAG_LATEST }}
|
||||||
docker run quay.io/skopeo/stable --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} copy --all docker://ghcr.io/${{ github.repository_owner }}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }} docker://ghcr.io/${{ github.repository_owner }}/mbed-os-env:${{ steps.build_info.outputs.DOCKER_PROD_TAG_DATED }}
|
docker run quay.io/skopeo/stable --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} copy --all docker://ghcr.io/${{ steps.build_info.outputs.REPO_OWNER }}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }} docker://ghcr.io/${{ steps.build_info.outputs.REPO_OWNER }}/mbed-os-env:${{ steps.build_info.outputs.DOCKER_PROD_TAG_DATED }}
|
|
@ -22,4 +22,4 @@ jobs:
|
||||||
# deletion if only one image exists or if DOCKER_MANAGEMENT_TOKEN is not
|
# deletion if only one image exists or if DOCKER_MANAGEMENT_TOKEN is not
|
||||||
# setup. This shouldn't create any alarm as temporary image deletion is
|
# setup. This shouldn't create any alarm as temporary image deletion is
|
||||||
# not a critical activity.
|
# not a critical activity.
|
||||||
python ./.github/workflows/ci_scripts/ghcr_utils.py -u ${{ github.actor }} -p ${{ secrets.DOCKER_MANAGEMENT_TOKEN }} delete-old-images -r mbed-os-env-tmp || true
|
python ./.github/workflows/ci_scripts/ghcr_utils.py -u ${{ github.repository_owner }} -p ${{ secrets.DOCKER_MANAGEMENT_TOKEN }} delete-old-images -r mbed-os-env-tmp || true
|
|
@ -72,6 +72,7 @@ jobs:
|
||||||
echo dev-${version}-${date}-${version} > build_info/dev_tag
|
echo dev-${version}-${date}-${version} > build_info/dev_tag
|
||||||
echo ${version}-${date} > build_info/prod_tag_dated
|
echo ${version}-${date} > build_info/prod_tag_dated
|
||||||
echo ${version} > build_info/mbed_os_version
|
echo ${version} > build_info/mbed_os_version
|
||||||
|
echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]' > build_info/repository_owner
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Archive information
|
name: Archive information
|
||||||
|
@ -87,6 +88,7 @@ jobs:
|
||||||
outputs:
|
outputs:
|
||||||
DEV_DIGEST: ${{ steps.docker_info_dev.outputs.DIGEST }}
|
DEV_DIGEST: ${{ steps.docker_info_dev.outputs.DIGEST }}
|
||||||
PROD_DIGEST: ${{ steps.docker_info_prod.outputs.DIGEST }}
|
PROD_DIGEST: ${{ steps.docker_info_prod.outputs.DIGEST }}
|
||||||
|
REPO_FILE_CHECK: ${{steps.repo_status.outcome}}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
|
@ -111,6 +113,8 @@ jobs:
|
||||||
echo "::set-output name=DOCKER_PROD_TAG_DATED::$value"
|
echo "::set-output name=DOCKER_PROD_TAG_DATED::$value"
|
||||||
value=`cat mbed_os_version`
|
value=`cat mbed_os_version`
|
||||||
echo "::set-output name=MBED_OS_VERSION::$value"
|
echo "::set-output name=MBED_OS_VERSION::$value"
|
||||||
|
value=`cat repository_owner`
|
||||||
|
echo "::set-output name=REPO_OWNER::$value"
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
|
@ -134,8 +138,21 @@ jobs:
|
||||||
with:
|
with:
|
||||||
ref: refs/tags/${{ steps.build_info.outputs.MBED_OS_VERSION }}
|
ref: refs/tags/${{ steps.build_info.outputs.MBED_OS_VERSION }}
|
||||||
|
|
||||||
|
# if we are trying to build docker image for an earlier version of mbed-os, either scheduled
|
||||||
|
# or manually, dockerfile will not exist. Then, skip the workflow
|
||||||
|
-
|
||||||
|
name: Skip the workflow if Dockerfile doesn't exist
|
||||||
|
id: repo_status
|
||||||
|
run: |
|
||||||
|
if [ ! -f "./docker_images/mbed-os-env/Dockerfile" ]; then
|
||||||
|
echo "Dockerfile doesn't in this repo."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Build docker containers
|
name: Build docker containers
|
||||||
|
if: steps.repo_status.outcome == 'success'
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
id: docker_build_dev
|
id: docker_build_dev
|
||||||
with:
|
with:
|
||||||
|
@ -143,12 +160,13 @@ jobs:
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
file: ./docker_images/mbed-os-env/Dockerfile
|
file: ./docker_images/mbed-os-env/Dockerfile
|
||||||
tags: ghcr.io/${{ github.repository_owner }}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }}
|
tags: ghcr.io/${{ steps.build_info.outputs.REPO_OWNER }}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }}
|
||||||
|
|
||||||
|
|
||||||
test-container:
|
test-container:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build-container
|
needs: build-container
|
||||||
|
if: needs.build-container.outputs.REPO_FILE_CHECK=='success'
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
platform: [linux/amd64, linux/arm64]
|
platform: [linux/amd64, linux/arm64]
|
||||||
|
@ -173,6 +191,8 @@ jobs:
|
||||||
echo "::set-output name=DOCKER_PROD_TAG_DATED::$value"
|
echo "::set-output name=DOCKER_PROD_TAG_DATED::$value"
|
||||||
value=`cat mbed_os_version`
|
value=`cat mbed_os_version`
|
||||||
echo "::set-output name=MBED_OS_VERSION::$value"
|
echo "::set-output name=MBED_OS_VERSION::$value"
|
||||||
|
value=`cat repository_owner`
|
||||||
|
echo "::set-output name=REPO_OWNER::$value"
|
||||||
|
|
||||||
# as the dev images are created only for master branch, run test against
|
# as the dev images are created only for master branch, run test against
|
||||||
# development branch of blinky
|
# development branch of blinky
|
||||||
|
@ -200,7 +220,6 @@ jobs:
|
||||||
if git rev-parse "$MBED_OS_VERSION" >/dev/null 2>&1; then
|
if git rev-parse "$MBED_OS_VERSION" >/dev/null 2>&1; then
|
||||||
EXAMPLE_VERSION=$MBED_OS_VERSION
|
EXAMPLE_VERSION=$MBED_OS_VERSION
|
||||||
fi
|
fi
|
||||||
# echo "::set-output VERSION=MBED_OS_VERSION::$EXAMPLE_VERSION"
|
|
||||||
git checkout ${EXAMPLE_VERSION}
|
git checkout ${EXAMPLE_VERSION}
|
||||||
|
|
||||||
-
|
-
|
||||||
|
@ -215,7 +234,7 @@ jobs:
|
||||||
id: docker_info
|
id: docker_info
|
||||||
run: |
|
run: |
|
||||||
cd mbed-os-example-blinky/mbed-os
|
cd mbed-os-example-blinky/mbed-os
|
||||||
DIGEST=$(python ./.github/workflows/ci_scripts/ghcr_utils.py -u ${{ github.repository_owner }} -p ${{ secrets.GITHUB_TOKEN }} get-digest -r mbed-os-env-tmp -t ${{ steps.build_info.outputs.DOCKER_DEV_TAG }} -p ${{ matrix.platform }} )
|
DIGEST=$(python ./.github/workflows/ci_scripts/ghcr_utils.py -u ${{ steps.build_info.outputs.REPO_OWNER }} -p ${{ secrets.GITHUB_TOKEN }} get-digest -r mbed-os-env-tmp -t ${{ steps.build_info.outputs.DOCKER_DEV_TAG }} -p ${{ matrix.platform }} )
|
||||||
echo "::set-output name=DIGEST::$DIGEST"
|
echo "::set-output name=DIGEST::$DIGEST"
|
||||||
echo "Docker DIGEST: $DIGEST"
|
echo "Docker DIGEST: $DIGEST"
|
||||||
|
|
||||||
|
@ -232,7 +251,7 @@ jobs:
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
options: -v ${{ github.workspace }}:/work -w=/work
|
options: -v ${{ github.workspace }}:/work -w=/work
|
||||||
image: ghcr.io/${{ github.repository_owner }}/mbed-os-env-tmp@${{ steps.docker_info.outputs.DIGEST }}
|
image: ghcr.io/${{ steps.build_info.outputs.REPO_OWNER }}/mbed-os-env-tmp@${{ steps.docker_info.outputs.DIGEST }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
uname -m
|
uname -m
|
||||||
|
@ -268,18 +287,21 @@ jobs:
|
||||||
value=`cat mbed_os_version`
|
value=`cat mbed_os_version`
|
||||||
echo "MBED OS VERSION is $value"
|
echo "MBED OS VERSION is $value"
|
||||||
echo "::set-output name=MBED_OS_VERSION::$value"
|
echo "::set-output name=MBED_OS_VERSION::$value"
|
||||||
|
value=`cat repository_owner`
|
||||||
|
echo "::set-output name=REPO_OWNER::$value"
|
||||||
|
|
||||||
-
|
-
|
||||||
name: copy dev tag to prod tags
|
name: copy dev tag to prod tags
|
||||||
run: |
|
run: |
|
||||||
set -x
|
set -x
|
||||||
echo ${{ needs.test-container.result }}
|
echo ${{ needs.test-container.result }}
|
||||||
|
REPO_OWNER=${{ steps.build_info.outputs.REPO_OWNER }}
|
||||||
upto_patch_version=${{ steps.build_info.outputs.MBED_OS_VERSION }}-latest
|
upto_patch_version=${{ steps.build_info.outputs.MBED_OS_VERSION }}-latest
|
||||||
upto_min_version=${upto_patch_version%.[0-9]*}-latest
|
upto_min_version=${upto_patch_version%.[0-9]*}-latest
|
||||||
upto_major_version=${upto_patch_version%.[0-9]*.[0-9]*}-latest
|
upto_major_version=${upto_patch_version%.[0-9]*.[0-9]*}-latest
|
||||||
docker run quay.io/skopeo/stable --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} copy --all docker://ghcr.io/${{ github.repository_owner }}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }} docker://ghcr.io/${{ github.repository_owner }}/mbed-os-env:${upto_patch_version}
|
docker run quay.io/skopeo/stable --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} copy --all docker://ghcr.io/${REPO_OWNER}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }} docker://ghcr.io/${REPO_OWNER}/mbed-os-env:${upto_patch_version}
|
||||||
docker run quay.io/skopeo/stable --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} copy --all docker://ghcr.io/${{ github.repository_owner }}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }} docker://ghcr.io/${{ github.repository_owner }}/mbed-os-env:${upto_min_version}
|
docker run quay.io/skopeo/stable --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} copy --all docker://ghcr.io/${REPO_OWNER}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }} docker://ghcr.io/${REPO_OWNER}/mbed-os-env:${upto_min_version}
|
||||||
docker run quay.io/skopeo/stable --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} copy --all docker://ghcr.io/${{ github.repository_owner }}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }} docker://ghcr.io/${{ github.repository_owner }}/mbed-os-env:${upto_major_version}
|
docker run quay.io/skopeo/stable --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} copy --all docker://ghcr.io/${REPO_OWNER}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }} docker://ghcr.io/${REPO_OWNER}/mbed-os-env:${upto_major_version}
|
||||||
|
|
||||||
# copy to fixed tag
|
# copy to fixed tag
|
||||||
docker run quay.io/skopeo/stable --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} copy --all docker://ghcr.io/${{ github.repository_owner }}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }} docker://ghcr.io/${{ github.repository_owner }}/mbed-os-env:${{ steps.build_info.outputs.DOCKER_PROD_TAG_DATED }}
|
docker run quay.io/skopeo/stable --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} copy --all docker://ghcr.io/${REPO_OWNER}/mbed-os-env-tmp:${{ steps.build_info.outputs.DOCKER_DEV_TAG }} docker://ghcr.io/${REPO_OWNER}/mbed-os-env:${{ steps.build_info.outputs.DOCKER_PROD_TAG_DATED }}
|
Loading…
Reference in New Issue