From a6c953b9bde24295e3c7b5999cc425c2e23dbf27 Mon Sep 17 00:00:00 2001 From: 186526 Date: Wed, 28 Dec 2022 16:46:22 +0800 Subject: [PATCH] Add: CI auto update for filter --- .drone.yml | 37 +++++++++++++++++++++++++++++++++++++ config-example.conf | 2 -- util/irr-filter.conf | 11 +++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 util/irr-filter.conf diff --git a/.drone.yml b/.drone.yml index 537dfc6..61c7e17 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,6 +2,12 @@ kind: pipeline type: docker name: default +trigger: + event: + include: + - push + - pull_request + steps: - name: test image: alpine:latest @@ -9,3 +15,34 @@ steps: - sed -i '1i\include "./config-example.conf";' bird.conf - apk add bird - bird -p -c ./bird.conf + +--- +kind: pipeline +type: docker +name: updateFilter + +trigger: + branch: + - main + event: + include: + - push + - cron + +steps: + - name: update filter + image: debian:latest + commands: + - apt-get update -y && apt-get install bgpq4 -y + - echo "define $(bgpq4 -tbl DOWNSTREAM_ASN AS-NET186 -S RIPE)" > util/irr-filter.conf + - echo "define $(bgpq4 -6bl DOWNSTREAM_PREFIXES AS-NET186)" >> util/irr-filter.conf + - name: push to repo + image: appleboy/drone-git-push + settings: + branch: production + remote: git@direct-git.186526.xyz:186526/net186-config.git + force: true + commit_message: "[CI] Update: update filter" + commit: true + ssh_key: + from_secret: ssh_private_key diff --git a/config-example.conf b/config-example.conf index 4b4d640..4e54d07 100644 --- a/config-example.conf +++ b/config-example.conf @@ -2,8 +2,6 @@ router id 10.0.0.101; define LOCAL_ASN = 200536; -define DOWNSTREAM_ASN = [ 140506, 200536 ]; - define POP = 101; define REGION = 100; diff --git a/util/irr-filter.conf b/util/irr-filter.conf new file mode 100644 index 0000000..0284184 --- /dev/null +++ b/util/irr-filter.conf @@ -0,0 +1,11 @@ +# Example: +# define DOWNSTREAM_ASN = [ 200536 ]; +# use bgpq4 generate this file: +# echo "define $(bgpq4 -tbl DOWNSTREAM_ASN AS-NET186 -S RIPE)" > util/irr-filter.conf +# echo "define $(bgpq4 -6bl DOWNSTREAM_PREFIXES AS-NET186 -S RIPE)" >> util/irr-filter.conf + +define DOWNSTREAM_ASN = [ 200536 ]; + +define DOWNSTREAM_PREFIXES = [ + 2a0a:6040:a900::/40 +];