Merge pull request #222 from netbox-community/fix-github-action
Fix Github Action
This commit is contained in:
commit
40ef427336
|
@ -15,17 +15,21 @@ jobs:
|
||||||
- '' # use the default of the DOCKERFILE
|
- '' # use the default of the DOCKERFILE
|
||||||
- python:3.7-alpine
|
- python:3.7-alpine
|
||||||
- python:3.8-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
|
fail-fast: false
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Builds new Netbox Docker Images
|
name: Builds new Netbox Docker Images
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- id: git-checkout
|
||||||
|
name: Checkout
|
||||||
uses: actions/checkout@v1
|
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 }}
|
run: ${{ matrix.build_cmd }}
|
||||||
env:
|
env:
|
||||||
DOCKER_FROM: ${{ matrix.docker_from }}
|
DOCKER_FROM: ${{ matrix.docker_from }}
|
||||||
GH_ACTION: enable
|
GH_ACTION: enable
|
||||||
- name: Test the image
|
- id: docker-test
|
||||||
|
name: Test the image
|
||||||
run: IMAGE="${FINAL_DOCKER_TAG}" ./test.sh
|
run: IMAGE="${FINAL_DOCKER_TAG}" ./test.sh
|
||||||
|
if: steps.docker-build.outputs.skipped != 'true'
|
||||||
|
|
|
@ -17,15 +17,20 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Builds new Netbox Docker Images
|
name: Builds new Netbox Docker Images
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- id: git-checkout
|
||||||
|
name: Checkout
|
||||||
uses: actions/checkout@v1
|
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 }}
|
run: ${{ matrix.build_cmd }}
|
||||||
env:
|
env:
|
||||||
GH_ACTION: enable
|
GH_ACTION: enable
|
||||||
- name: Test the image
|
- id: docker-test
|
||||||
|
name: Test the image
|
||||||
run: IMAGE="${FINAL_DOCKER_TAG}" ./test.sh
|
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: |
|
run: |
|
||||||
echo "::add-mask::$DOCKERHUB_USERNAME"
|
echo "::add-mask::$DOCKERHUB_USERNAME"
|
||||||
echo "::add-mask::$DOCKERHUB_PASSWORD"
|
echo "::add-mask::$DOCKERHUB_PASSWORD"
|
||||||
|
@ -33,7 +38,12 @@ jobs:
|
||||||
env:
|
env:
|
||||||
DOCKERHUB_USERNAME: ${{ secrets.dockerhub_username }}
|
DOCKERHUB_USERNAME: ${{ secrets.dockerhub_username }}
|
||||||
DOCKERHUB_PASSWORD: ${{ secrets.dockerhub_password }}
|
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
|
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}"
|
run: docker logout "${DOCKER_REGISTRY}"
|
||||||
|
if: steps.docker-build.outputs.skipped != 'true'
|
||||||
|
|
|
@ -66,6 +66,10 @@ if [ "${PRERELEASE}" == "true" ]; then
|
||||||
|
|
||||||
echo "❎ Latest unstable version '${VERSION}' is not higher than the latest stable version '$STABLE_VERSION'."
|
echo "❎ Latest unstable version '${VERSION}' is not higher than the latest stable version '$STABLE_VERSION'."
|
||||||
if [ -z "$DEBUG" ]; then
|
if [ -z "$DEBUG" ]; then
|
||||||
|
if [ -n "${GH_ACTION}" ]; then
|
||||||
|
echo "::set-output name=skipped::true"
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "⚠️ Would exit here with code '0', but DEBUG is enabled."
|
echo "⚠️ Would exit here with code '0', but DEBUG is enabled."
|
||||||
|
|
1
build.sh
1
build.sh
|
@ -210,6 +210,7 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do
|
||||||
fi
|
fi
|
||||||
if [ -n "${GH_ACTION}" ]; then
|
if [ -n "${GH_ACTION}" ]; then
|
||||||
echo "::set-env name=FINAL_DOCKER_TAG::${TARGET_DOCKER_TAG}"
|
echo "::set-env name=FINAL_DOCKER_TAG::${TARGET_DOCKER_TAG}"
|
||||||
|
echo "::set-output name=skipped::false"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
10
test.sh
10
test.sh
|
@ -7,6 +7,16 @@ set -e
|
||||||
# of the Docker Image that is to be used
|
# of the Docker Image that is to be used
|
||||||
export IMAGE="${IMAGE-netboxcommunity/netbox:latest}"
|
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
|
# The docker compose command to use
|
||||||
doco="docker-compose -f docker-compose.test.yml"
|
doco="docker-compose -f docker-compose.test.yml"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue