Skip to content

Regenerate All config #727

Regenerate All config

Regenerate All config #727

Workflow file for this run

name: Regenerate All config
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
schedule:
- cron: '0 0 * * *'
concurrency:
group: "PoemaIX-BIRDGen"
cancel-in-progress: true
jobs:
repo-sync:
name: Regenerate All config
runs-on: ubuntu-latest
timeout-minutes: 10
env:
GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa"
steps:
- name: Checkout Central Actions Repo
uses: actions/checkout@v3
- name: symlink to /root/arouteserver
run: |
sudo chmod 777 /root
ln -s $GITHUB_WORKSPACE /root/arouteserver
- name: setup ssh key
run: |
sudo chmod 777 /root
mkdir -p /root/.ssh
sudo chown -R "$USER" /root/
echo "$SSH_KEY_IXPAGE" > /root/.ssh/id_rsa_ixpage
chmod 600 /root/.ssh/id_rsa_ixpage
echo "$SSH_KEY_ARS" > /root/.ssh/id_rsa_ars
chmod 600 /root/.ssh/id_rsa_ars
echo "$IXLAN_OVPN_CONF" > /root/.ssh/ovpn-kskb-ix.conf
git config --global user.email [email protected]
git config --global user.name KusakabeSi
echo $HOME
echo $GITHUB_WORKSPACE
shell: bash
env:
SSH_KEY_IXPAGE: ${{secrets.SSH_KEY_IXPAGE}}
SSH_KEY_ARS: ${{secrets.SSH_KEY_ARS}}
IXLAN_OVPN_CONF: ${{secrets.IXLAN_OVPN_CONF}}
- name: Cache /root/.local 20230605
id: cache_pip
uses: actions/cache@v2
with:
path: |
/root/.local/lib
/root/.local/bin
/root/.local/share
key: /root/.local/items at PoemaIX-BIRDGen all
- name: Install depends
run: sudo apt-get install -y bgpq4 openvpn net-tools
- name: connect to openvpn
run: |
sudo openvpn --daemon --config /root/.ssh/ovpn-kskb-ix.conf
- name: Get current time
uses: gerred/actions/current-time@master
id: current-time
- name: Cache /root/gitrs 20230605
id: cache_ix_page
uses: actions/cache@v2
with:
path: |
/root/gitrs
/root/arouteserver/cache
key: /root/gitrs at PoemaIX-BIRDGen all v2
- name: Sync from /root/gitrs
if: steps.cache_ix_page.outputs.cache-hit != 'true'
run: |
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa_ixpage"
git clone [email protected]:PoemaIX/KSKB-IX.git /root/gitrs/KSKB-IX
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa_ars"
git clone [email protected]:PoemaIX/arouteserver.git /root/gitrs/ars
git clone https://github.com/PoemaIX/RIPE-AS-SET-SYNC.git /root/gitrs/RIPE-AS-SET-SYNC
- name: reset to girts origin
run: |
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa_ixpage"
cd /root/gitrs/KSKB-IX
git fetch --all --force
git reset --hard origin/main
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa_ars"
cd /root/gitrs/ars
git fetch --all --force
git reset --hard origin/KSKB-IX
cd /root/gitrs/RIPE-AS-SET-SYNC
cd /root/gitrs/KSKB-IX
git fetch --all --force
git reset --hard origin/main
- name: regenerate bird config
run: |
pip3 install -r /root/gitrs/ars/requirements.txt
/root/arouteserver/scripts/gen_rs.sh
env:
SECRET_PEERINGDB_API_KEY: ${{secrets.SECRET_PEERINGDB_API_KEY}}
PIP_BREAK_SYSTEM_PACKAGES: 1
HOME: /root
shell: bash
- name: push ixpage back
run: |
pip3 install mkdocs-bootswatch pymdown-extensions mkdocs-material jieba
git config --global user.email [email protected]
git config --global user.name KusakabeSi
/root/arouteserver/scripts/sync_asset.sh
/root/arouteserver/scripts/sync_ixpage.sh -b
env:
HOME: /root
RIPE_PASSWD: ${{secrets.RIPE_PASSWD}}
GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa_ixpage"
PIP_BREAK_SYSTEM_PACKAGES: 1
shell: bash
- name: Commit
run: |
cd $GITHUB_WORKSPACE
git add -A
git diff-index --quiet HEAD || git commit -m "update" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master