Bypass issue with 8.7 #322
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests and push to PyPi and DockerHub | |
on: push | |
jobs: | |
tests: | |
name: Run tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
# This list must be kept in sync with setup.py. | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
- "3.12" # Reference version used to run integration tests; | |
# to keep in sync with 'if: ' statements in the rest | |
# of this file. | |
- "pypy3.10" # To keep in sync with other pypy releases referenced in the | |
# "Docker image tests" and "Push Docker image to Docker Hub" | |
# sections of this file. | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install bgpq3 / bgpq4 | |
run: | | |
./tests/external_resources/install_bgpq3.sh | |
./tests/external_resources/install_bgpq4.sh | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r requirements-dev.txt | |
- name: Flake8 | |
run: flake8 | |
- name: Test CLI | |
if: ${{ matrix.python-version == '3.12' }} | |
run: ./tests/cli | |
env: | |
SECRET_PEERINGDB_API_KEY: ${{ secrets.SECRET_PEERINGDB_API_KEY }} | |
- name: Static tests | |
run: pytest -vs -x tests/static/ | |
env: | |
TRAVIS: 1 | |
SECRET_PEERINGDB_API_KEY: ${{ secrets.SECRET_PEERINGDB_API_KEY }} | |
- name: Config build tests | |
if: ${{ matrix.python-version != '3.12' }} | |
run: BUILD_ONLY=1 pytest -vs -x tests/live_tests/ | |
env: | |
TRAVIS: 1 | |
SECRET_PEERINGDB_API_KEY: ${{ secrets.SECRET_PEERINGDB_API_KEY }} | |
- name: Test external resources | |
if: ${{ matrix.python-version == '3.12' }} | |
run: pytest -vs tests/external_resources/ | |
env: | |
TRAVIS: 1 | |
SECRET_PEERINGDB_API_KEY: ${{ secrets.SECRET_PEERINGDB_API_KEY }} | |
- name: Fetch Docker images used by tests | |
if: ${{ matrix.python-version == '3.12' }} | |
run: | | |
echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin | |
docker pull pierky/bird:1.6.8 | |
docker pull pierky/bird:2.16 | |
docker pull pierky/bird:3.0-alpha2 | |
docker pull pierky/openbgpd:8.0 | |
docker pull pierky/openbgpd:8.7 | |
docker pull pierky/exabgp:4.2.7 | |
docker pull nlnetlabs/routinator:v0.13.2 | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Integration tests | |
if: ${{ matrix.python-version == '3.12' }} | |
run: pytest -vs -x tests/live_tests/ | |
env: | |
TRAVIS: 1 | |
SECRET_PEERINGDB_API_KEY: ${{ secrets.SECRET_PEERINGDB_API_KEY }} | |
docker-image-tests: | |
name: Docker image tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
docker-image: | |
- base_image: python:3.12 | |
target_image: latest | |
- base_image: pypy:3.10 | |
target_image: latest-pypy3 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Build the image | |
run: > | |
docker build \ | |
--build-arg base_image=${{ matrix.docker-image.base_image }} \ | |
-t pierky/arouteserver:${{ matrix.docker-image.target_image }} \ | |
-f docker/Dockerfile \ | |
. | |
- name: Run PyTest | |
run: > | |
docker run \ | |
-t \ | |
--rm \ | |
-e SECRET_PEERINGDB_API_KEY="${SECRET_PEERINGDB_API_KEY}" \ | |
pierky/arouteserver:${{ matrix.docker-image.target_image }} \ | |
bash -c 'pip install -r requirements-dev.txt && pytest -vsx tests/static' | |
env: | |
SECRET_PEERINGDB_API_KEY: ${{ secrets.SECRET_PEERINGDB_API_KEY }} | |
- name: Run CLI tests | |
run: > | |
docker run \ | |
-t \ | |
--rm \ | |
-e DO_NOT_PERFORM_VALIDATION=1 \ | |
-e SECRET_PEERINGDB_API_KEY="${SECRET_PEERINGDB_API_KEY}" \ | |
-v $(pwd)/utils/fake_rtt_getter.sh:/arouteserver/utils/fake_rtt_getter.sh:ro \ | |
pierky/arouteserver:${{ matrix.docker-image.target_image }} \ | |
./tests/cli | |
env: | |
SECRET_PEERINGDB_API_KEY: ${{ secrets.SECRET_PEERINGDB_API_KEY }} | |
- name: Prep environment for configuration building tests | |
run: | | |
mkdir ~/arouteserver_configs | |
mkdir ~/arouteserver_html | |
- name: Build configuration for BIRD 1.x | |
run: > | |
docker run \ | |
-t \ | |
--rm \ | |
-v $(pwd)/config.d/clients.yml:/root/clients.yml:ro \ | |
-v ~/arouteserver_configs:/root/arouteserver_configs \ | |
-e RS_ASN=65500 \ | |
-e ROUTER_ID=192.0.2.123 \ | |
-e LOCAL_PREFIXES=192.0.2.0/24,2001:db8::/32 \ | |
-e IP_VER=4 \ | |
-e DAEMON=bird \ | |
-e VERSION=1.6.8 \ | |
-e SECRET_PEERINGDB_API_KEY="${SECRET_PEERINGDB_API_KEY}" \ | |
pierky/arouteserver:${{ matrix.docker-image.target_image }} | |
env: | |
SECRET_PEERINGDB_API_KEY: ${{ secrets.SECRET_PEERINGDB_API_KEY }} | |
- name: Validate BIRD 1.x configuration | |
run: > | |
docker run \ | |
-t \ | |
--rm \ | |
-v ~/arouteserver_configs/bird4.cfg:/etc/bird/bird.cfg \ | |
pierky/bird:1.6.8 \ | |
bird \ | |
-c /etc/bird/bird.cfg \ | |
-d \ | |
-p | |
- name: Build configuration for BIRD 2 (+ HTML representation) | |
run: > | |
docker run \ | |
-t \ | |
--rm \ | |
-v $(pwd)/config.d/clients.yml:/root/clients.yml:ro \ | |
-v ~/arouteserver_configs:/root/arouteserver_configs \ | |
-v ~/arouteserver_html:/root/arouteserver_html \ | |
-e RS_ASN=65500 \ | |
-e ROUTER_ID=192.0.2.123 \ | |
-e LOCAL_PREFIXES=192.0.2.0/24,2001:db8::/32 \ | |
-e DAEMON=bird \ | |
-e VERSION=2.0.7 \ | |
-e SECRET_PEERINGDB_API_KEY="${SECRET_PEERINGDB_API_KEY}" \ | |
pierky/arouteserver:${{ matrix.docker-image.target_image }} | |
env: | |
SECRET_PEERINGDB_API_KEY: ${{ secrets.SECRET_PEERINGDB_API_KEY }} | |
- name: Validate BIRD 2 configuration | |
run: > | |
docker run \ | |
-t \ | |
--rm \ | |
-v ~/arouteserver_configs/bird.cfg:/etc/bird/bird.cfg \ | |
pierky/bird:2.0.7 \ | |
bird \ | |
-c /etc/bird/bird.cfg \ | |
-d \ | |
-p | |
- name: Validate HTML representation | |
run: > | |
grep \ | |
'Configuration of route server 192.0.2.123 at AS65500' \ | |
~/arouteserver_html/bird.html &>/dev/null | |
- name: Build configuration for OpenBGPD (+ HTML representation) | |
run: > | |
docker run \ | |
-t \ | |
--rm \ | |
-v $(pwd)/config.d/clients.yml:/root/clients.yml:ro \ | |
-v ~/arouteserver_configs:/root/arouteserver_configs \ | |
-v ~/arouteserver_html:/root/arouteserver_html \ | |
-e RS_ASN=65500 \ | |
-e ROUTER_ID=192.0.2.124 \ | |
-e LOCAL_PREFIXES=192.0.2.0/24,2001:db8::/32 \ | |
-e DAEMON=openbgpd \ | |
-e VERSION=8.7 \ | |
-e SECRET_PEERINGDB_API_KEY="${SECRET_PEERINGDB_API_KEY}" \ | |
pierky/arouteserver:${{ matrix.docker-image.target_image }} | |
env: | |
SECRET_PEERINGDB_API_KEY: ${{ secrets.SECRET_PEERINGDB_API_KEY }} | |
- name: Validate OpenBGPD configuration | |
run: > | |
docker run \ | |
-t \ | |
--rm \ | |
-v ~/arouteserver_configs/openbgpd.cfg:/etc/bgpd/bgpd.conf \ | |
pierky/openbgpd:8.7 \ | |
bgpd \ | |
-f /etc/bgpd/bgpd.conf \ | |
-d \ | |
-n | |
- name: Validate HTML representation | |
run: > | |
grep \ | |
'Configuration of route server 192.0.2.124 at AS65500' \ | |
~/arouteserver_html/openbgpd.html &>/dev/null | |
- name: Build configuration using custom general.yml file | |
run: > | |
docker run \ | |
-t \ | |
--rm \ | |
-v $(pwd)/config.d/clients.yml:/root/clients.yml:ro \ | |
-v $(pwd)/examples/auto-config/bird-general.yml:/etc/arouteserver/general.yml:ro \ | |
-v ~/arouteserver_configs:/root/arouteserver_configs \ | |
-e DAEMON=bird \ | |
-e VERSION=2.16 \ | |
-e SECRET_PEERINGDB_API_KEY="${SECRET_PEERINGDB_API_KEY}" \ | |
pierky/arouteserver:${{ matrix.docker-image.target_image }} | |
env: | |
SECRET_PEERINGDB_API_KEY: ${{ secrets.SECRET_PEERINGDB_API_KEY }} | |
- name: Validate configuration built using custom general.yml file | |
run: > | |
docker run \ | |
-t \ | |
--rm \ | |
-v ~/arouteserver_configs/bird.cfg:/etc/bird/bird.cfg \ | |
pierky/bird:2.16 \ | |
bird \ | |
-c /etc/bird/bird.cfg \ | |
-d \ | |
-p | |
- name: Build configuration using custom general.yml file with env vars and reject reasons communities | |
run: > | |
docker run \ | |
-t \ | |
--rm \ | |
-v $(pwd)/config.d/clients.yml:/root/clients.yml:ro \ | |
-v $(pwd)/tests/var/general-env-vars-and-reject-reasons.yml:/etc/arouteserver/general.yml:ro \ | |
-v ~/arouteserver_configs:/root/arouteserver_configs \ | |
-v ~/arouteserver_html:/root/arouteserver_html \ | |
-e IP_VER=4 \ | |
-e DAEMON=bird \ | |
-e VERSION=1.6.8 \ | |
-e RS_ASN=9999 \ | |
-e ROUTER_ID=192.0.2.200 \ | |
-e SECRET_PEERINGDB_API_KEY="${SECRET_PEERINGDB_API_KEY}" \ | |
pierky/arouteserver:${{ matrix.docker-image.target_image }} | |
env: | |
SECRET_PEERINGDB_API_KEY: ${{ secrets.SECRET_PEERINGDB_API_KEY }} | |
- name: Validate configuration built using custom general.yml file with env vars and reject reasons communities | |
run: | | |
docker run \ | |
-t \ | |
--rm \ | |
-v ~/arouteserver_configs/bird4.cfg:/etc/bird/bird.cfg \ | |
pierky/bird:1.6.8 \ | |
bird \ | |
-c /etc/bird/bird.cfg \ | |
-d \ | |
-p | |
cat ~/arouteserver_configs/bird4.cfg | grep 'router id 192.0.2.200' | |
- name: Validate HTML representation | |
run: > | |
grep \ | |
'Configuration of route server 192.0.2.200 at AS9999' \ | |
~/arouteserver_html/bird.html &>/dev/null | |
- name: Build configuration using local files | |
run: > | |
docker run \ | |
-t \ | |
--rm \ | |
-v $(pwd)/config.d/clients.yml:/root/clients.yml:ro \ | |
-v ~/arouteserver_configs:/root/arouteserver_configs \ | |
-e RS_ASN=65500 \ | |
-e ROUTER_ID=192.0.2.123 \ | |
-e LOCAL_PREFIXES=192.0.2.0/24,2001:db8::/32 \ | |
-e IP_VER=4 \ | |
-e DAEMON=bird \ | |
-e VERSION=1.6.8 \ | |
-e LOCAL_FILES="header footer" \ | |
-e LOCAL_FILES_DIR=/var/pierky/test \ | |
-e SECRET_PEERINGDB_API_KEY="${SECRET_PEERINGDB_API_KEY}" \ | |
pierky/arouteserver:${{ matrix.docker-image.target_image }} | |
env: | |
SECRET_PEERINGDB_API_KEY: ${{ secrets.SECRET_PEERINGDB_API_KEY }} | |
- name: Verify that include statements are there | |
run: | | |
cat ~/arouteserver_configs/bird4.cfg | \ | |
grep include | \ | |
grep /var/pierky/test | \ | |
egrep 'header.local|footer.local' | \ | |
wc -l | \ | |
grep 2 | |
- name: Build configuration for 32bit ASN route-servers | |
run: > | |
docker run \ | |
-t \ | |
--rm \ | |
-v $(pwd)/config.d/clients.yml:/root/clients.yml:ro \ | |
-v ~/arouteserver_configs:/root/arouteserver_configs \ | |
-e RS_ASN=99999999 \ | |
-e PLACEHOLDER_16BIT_ASN=65333 \ | |
-e ROUTER_ID=192.0.2.123 \ | |
-e LOCAL_PREFIXES=192.0.2.0/24,2001:db8::/32 \ | |
-e IP_VER=4 \ | |
-e DAEMON=bird \ | |
-e VERSION=1.6.8 \ | |
-e SECRET_PEERINGDB_API_KEY="${SECRET_PEERINGDB_API_KEY}" \ | |
pierky/arouteserver:${{ matrix.docker-image.target_image }} | |
env: | |
SECRET_PEERINGDB_API_KEY: ${{ secrets.SECRET_PEERINGDB_API_KEY }} | |
- name: Verify that the desired 16bit placeholder ASN is used | |
run: | | |
cat ~/arouteserver_configs/bird4.cfg | \ | |
grep "if (65333, peer_as) ~ bgp_community then" | |
push_to_pypi: | |
name: Push to PyPi | |
needs: [tests, docker-image-tests] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
pip install --upgrade setuptools | |
- name: Build and push the release | |
run: | | |
pip install --upgrade packaging | |
python setup.py sdist | |
# All the tags go to PyPI test | |
- name: Publish distribution to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
# Only non-alpha releases go to the official PyPi | |
- name: Publish distribution to PyPI (official release) | |
if: contains(github.ref, 'alpha') != true | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
needs: [tests, docker-image-tests] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Get the release | |
run: echo "::set-output name=CURRENT_RELEASE::$(python -c 'from pierky.arouteserver.version import __version__; print(__version__)')" | |
id: get_the_release | |
- name: Is it a stable? | |
run: echo "::set-output name=IS_STABLE_RELEASE::$(python -c 'from pierky.arouteserver.version import __version__; import re; import sys; re.match(r"^\d+\.\d+\.\d+$", __version__); sys.stdout.write(str(bool(re.match(r"^\d+\.\d+\.\d+$", __version__))))')" | |
id: is_stable_release | |
- name: Show the arguments | |
run: echo "Release ${{ steps.get_the_release.outputs.CURRENT_RELEASE }} - stable ${{ steps.is_stable_release.outputs.IS_STABLE_RELEASE }}" | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push to Docker Hub (current release, CPython) | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
file: ./docker/Dockerfile | |
build-args: | | |
base_image=python:3.12 | |
tags: pierky/arouteserver:${{ steps.get_the_release.outputs.CURRENT_RELEASE }} | |
- name: Push to Docker Hub (current release, PyPy) | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
file: ./docker/Dockerfile | |
build-args: | | |
base_image=pypy:3.10 | |
tags: pierky/arouteserver:${{ steps.get_the_release.outputs.CURRENT_RELEASE }}-pypy3 | |
- name: Push to Docker Hub (latest, CPython) | |
# Only stable releases | |
if: steps.is_stable_release.outputs.IS_STABLE_RELEASE == 'True' | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
file: ./docker/Dockerfile | |
build-args: | | |
base_image=python:3.12 | |
tags: pierky/arouteserver:latest | |
- name: Push to Docker Hub (latest, PyPy) | |
# Only stable releases | |
if: steps.is_stable_release.outputs.IS_STABLE_RELEASE == 'True' | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
file: ./docker/Dockerfile | |
build-args: | | |
base_image=pypy:3.9 | |
tags: pierky/arouteserver:latest-pypy3 | |
- name: Update Docker Hub description | |
uses: peter-evans/dockerhub-description@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# This must be the DockerHub password, since AToW | |
# Docker Hub doesn't allow to use tokens to update | |
# the README. | |
# https://github.com/peter-evans/dockerhub-description/issues/10 | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
repository: pierky/arouteserver | |
short-description: ARouteServer official Docker images | |
readme-filepath: ./docker/README.md |