netbox-docker/.github/workflows/push.yml
Matthew Seaman f24bc0a9e0
Update README.md (#1)
* Update README.md

* We don't want to use the netbox-community pull-request template

* Update container building workflow

* Only build amd64 images
* Add our 'oxcert' branch as equivalent to upstream's 'release' branch

* Tag the version of the container as OxCERT's modification

This is just for the netbox container: the underlying netbox version
will come from upstream

* Build own own images and push to ghcr.io

* Only build amd64 images
* Only push images to GitHub Container Registry for the OxCERT organization

* Refer to our private copy in the GitHub Container Registry ghcr.io

* Use ghcr.io/oxcert/netbox for all netbox images

Build and push to this repo. Read from it with docker-compose

* Make releases relative to the 'oxcert' branch

rather than upstream's 'release' branch.  This is a different workflow
than used in any of our other repos, where PRs, changes, etc. are
first merged into a 'develop' branch, and the release process is to
merge accumulated changes into the main 'oxcert' branch.

Tag names for releases should follow whatever upstream is using with
"-oxcert" appended.

* Re-add the pull-request template

But in a very cut-down form.  We don't have an issue tracker on this
repo, and we assume the intentions and motivations for any PR will
have been discussed within the team already.  We do, however, want all
PRs to be against the 'develop' branch, in parallel to upstream's
workflow.

* On second thoughts, set container version to 1.0.0

This is OxCERT's version 1.0.0 of the containerized Netbox image which
is basically the same as the 2.7.0 netbox-community equivalent.

* Fix typo from upstream

Function should have been called `git_rebase()` rather than
duplicating the name of `git_merge()`
2023-10-13 11:34:37 +01:00

88 lines
2.6 KiB
YAML

---
name: push
on:
push:
branches-ignore:
- release
- oxcert
pull_request:
branches-ignore:
- release
- oxcert
jobs:
lint:
runs-on: ubuntu-latest
name: Checks syntax of our code
steps:
- uses: actions/checkout@v3
with:
# Full git history is needed to get a proper
# list of changed files within `super-linter`
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Lint Code Base
uses: github/super-linter@v5
env:
DEFAULT_BRANCH: develop
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SUPPRESS_POSSUM: true
LINTER_RULES_PATH: /
VALIDATE_ALL_CODEBASE: false
VALIDATE_DOCKERFILE: false
VALIDATE_GITLEAKS: false
FILTER_REGEX_EXCLUDE: (.*/)?(LICENSE|configuration/.*)
EDITORCONFIG_FILE_NAME: .ecrc
DOCKERFILE_HADOLINT_FILE_NAME: .hadolint.yaml
MARKDOWN_CONFIG_FILE: .markdown-lint.yml
PYTHON_BLACK_CONFIG_FILE: pyproject.toml
PYTHON_FLAKE8_CONFIG_FILE: .flake8
PYTHON_ISORT_CONFIG_FILE: pyproject.toml
YAML_CONFIG_FILE: .yamllint.yaml
build:
continue-on-error: ${{ matrix.build_cmd != './build-latest.sh' }}
strategy:
matrix:
build_cmd:
- ./build-latest.sh
- PRERELEASE=true ./build-latest.sh
- ./build.sh feature
- ./build.sh develop
platform:
- linux/amd64
fail-fast: false
env:
GH_ACTION: enable
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_NAMES: ghcr.io/oxcert/netbox
runs-on: ubuntu-latest
name: Builds new NetBox Docker Images
steps:
- id: git-checkout
name: Checkout
uses: actions/checkout@v3
- id: qemu-setup
name: Set up QEMU
uses: docker/setup-qemu-action@v2
- id: buildx-setup
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- id: docker-build
name: Build the image for '${{ matrix.platform }}' with '${{ matrix.build_cmd }}'
run: ${{ matrix.build_cmd }}
env:
BUILDX_PLATFORM: ${{ matrix.platform }}
BUILDX_BUILDER_NAME: ${{ steps.buildx-setup.outputs.name }}
- id: arm-time-limit
name: Set Netbox container start_period higher on ARM64
if: matrix.platform == 'linux/arm64'
run: |
echo "NETBOX_START_PERIOD=240s" >>"${GITHUB_ENV}"
- id: docker-test
name: Test the image
run: IMAGE="${FINAL_DOCKER_TAG}" ./test.sh
if: steps.docker-build.outputs.skipped != 'true'