From cfbd037f79e58fbd881cc99dacc4adeba9f1d3d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=A4der?= Date: Fri, 17 Jan 2020 15:21:53 +0100 Subject: [PATCH 1/2] Enable tests with Python 3.9 --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4a67b5e..3290e27 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -15,7 +15,7 @@ jobs: - '' # use the default of the DOCKERFILE - python:3.7-alpine - python:3.8-alpine - # - python:3.9-rc-alpine # Netbox does not work with Python 3.9 yet. + - python:3.9-rc-alpine fail-fast: false runs-on: ubuntu-latest name: Builds new Netbox Docker Images From dd0aee081a8e0f818fe8a95a2efd44449838ee5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=A4der?= Date: Fri, 17 Jan 2020 18:10:36 +0100 Subject: [PATCH 2/2] Fix failing GH Action --- .github/workflows/push.yml | 10 +++++++--- .github/workflows/release.yml | 22 ++++++++++++++++------ build-latest.sh | 4 ++++ build.sh | 1 + test.sh | 10 ++++++++++ 5 files changed, 38 insertions(+), 9 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 3290e27..8f9ca18 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -20,12 +20,16 @@ jobs: runs-on: ubuntu-latest name: Builds new Netbox Docker Images steps: - - name: Checkout + - id: git-checkout + name: Checkout uses: actions/checkout@v1 - - name: Build the image from '${{ matrix.docker_from }}' with '${{ matrix.build_cmd }}' + - id: docker-build + name: Build the image from '${{ matrix.docker_from }}' with '${{ matrix.build_cmd }}' run: ${{ matrix.build_cmd }} env: DOCKER_FROM: ${{ matrix.docker_from }} GH_ACTION: enable - - name: Test the image + - id: docker-test + name: Test the image run: IMAGE="${FINAL_DOCKER_TAG}" ./test.sh + if: steps.docker-build.outputs.skipped != 'true' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 72a0bdb..9a00d3d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,15 +17,20 @@ jobs: runs-on: ubuntu-latest name: Builds new Netbox Docker Images steps: - - name: Checkout + - id: git-checkout + name: Checkout uses: actions/checkout@v1 - - name: Build the image with '${{ matrix.build_cmd }}' + - id: docker-build + name: Build the image with '${{ matrix.build_cmd }}' run: ${{ matrix.build_cmd }} env: GH_ACTION: enable - - name: Test the image + - id: docker-test + name: Test the image run: IMAGE="${FINAL_DOCKER_TAG}" ./test.sh - - name: Login to the Docker Registry + if: steps.docker-build.outputs.skipped != 'true' + - id: registry-login + name: Login to the Docker Registry run: | echo "::add-mask::$DOCKERHUB_USERNAME" echo "::add-mask::$DOCKERHUB_PASSWORD" @@ -33,7 +38,12 @@ jobs: env: DOCKERHUB_USERNAME: ${{ secrets.dockerhub_username }} DOCKERHUB_PASSWORD: ${{ secrets.dockerhub_password }} - - name: Push the image + if: steps.docker-build.outputs.skipped != 'true' + - id: registry-push + name: Push the image run: ${{ matrix.build_cmd }} --push-only - - name: Logout of the Docker Registry + if: steps.docker-build.outputs.skipped != 'true' + - id: registry-logout + name: Logout of the Docker Registry run: docker logout "${DOCKER_REGISTRY}" + if: steps.docker-build.outputs.skipped != 'true' diff --git a/build-latest.sh b/build-latest.sh index 31a0f76..468dffe 100755 --- a/build-latest.sh +++ b/build-latest.sh @@ -66,6 +66,10 @@ if [ "${PRERELEASE}" == "true" ]; then echo "❎ Latest unstable version '${VERSION}' is not higher than the latest stable version '$STABLE_VERSION'." if [ -z "$DEBUG" ]; then + if [ -n "${GH_ACTION}" ]; then + echo "::set-output name=skipped::true" + fi + exit 0 else echo "⚠️ Would exit here with code '0', but DEBUG is enabled." diff --git a/build.sh b/build.sh index 94cbe6a..82a6e34 100755 --- a/build.sh +++ b/build.sh @@ -210,6 +210,7 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do fi if [ -n "${GH_ACTION}" ]; then echo "::set-env name=FINAL_DOCKER_TAG::${TARGET_DOCKER_TAG}" + echo "::set-output name=skipped::false" fi ### diff --git a/test.sh b/test.sh index 627eef1..419589b 100755 --- a/test.sh +++ b/test.sh @@ -7,6 +7,16 @@ set -e # of the Docker Image that is to be used export IMAGE="${IMAGE-netboxcommunity/netbox:latest}" +if [ -z "${IMAGE}" ]; then + echo "⚠️ No image defined" + + if [ -z "${DEBUG}" ]; then + exit 1; + else + echo "⚠️ Would 'exit 1' here, but DEBUG is '${DEBUG}'." + fi +fi + # The docker compose command to use doco="docker-compose -f docker-compose.test.yml"