Start CI rework

This commit is contained in:
thatmattlove 2021-12-06 16:44:46 -07:00
parent 889e44d6b1
commit 383494b8ef
8 changed files with 59 additions and 106 deletions

View file

@ -1,5 +1,7 @@
name: Backend Testing name: Backend Testing
on: [push, pull_request] on:
- push
- pull_request
jobs: jobs:
backend: backend:
@ -9,9 +11,9 @@ jobs:
matrix: matrix:
node-version: [14.x] node-version: [14.x]
redis-version: [5, 6] redis-version: [5, 6]
poetry-version: [1.1.4] poetry-version: [1.1.11]
python-version: [3.6, 3.8] python-version: [3.8, 3.9]
os: [ubuntu-20.04] os: [ubuntu-latest]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
@ -29,7 +31,7 @@ jobs:
poetry-version: ${{ matrix.poetry-version }} poetry-version: ${{ matrix.poetry-version }}
- name: Install Node - name: Install Node
uses: actions/setup-node@v1 uses: actions/setup-node@v2
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}

View file

@ -1,5 +1,7 @@
name: Frontend Testing name: Frontend Testing
on: [push, pull_request] on:
- push
- pull_request
jobs: jobs:
frontend: frontend:
@ -8,7 +10,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
node-version: [14.x] node-version: [14.x]
os: [ubuntu-20.04] os: [ubuntu-latest]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env: env:
working-directory: ./hyperglass/ui working-directory: ./hyperglass/ui
@ -25,11 +27,14 @@ jobs:
working-directory: ${{ env.working-directory }} working-directory: ${{ env.working-directory }}
run: yarn install run: yarn install
- name: TypeScript - name: Formatting (Prettier)
run: ./.tests/pre-commit-frontend.sh --typescript run: yarn format:check
- name: ESLint - name: Lint (ESLint)
run: ./.tests/pre-commit-frontend.sh --eslint run: yarn lint
- name: Prettier - name: Types (TypeScript)
run: ./.tests/pre-commit-frontend.sh --prettier run: yarn typecheck
- name: Tests (Jest)
run: yarn test

View file

@ -1,5 +1,7 @@
name: Installer Testing name: Installer Testing
on: [push, pull_request] on:
- push
- pull_request
jobs: jobs:
installer: installer:
@ -7,7 +9,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-20.04] os: [ubuntu-latest]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
@ -15,4 +17,4 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Run hyperglass - name: Run hyperglass
run: "sudo bash ./install.sh" run: 'sudo bash ./install.sh'

View file

@ -6,18 +6,21 @@ export POETRY_HYPERGLASS_UI_BUILD_TIMEOUT="600"
echo "[INFO] Set build timeout to $POETRY_HYPERGLASS_UI_BUILD_TIMEOUT seconds" echo "[INFO] Set build timeout to $POETRY_HYPERGLASS_UI_BUILD_TIMEOUT seconds"
echo "[INFO] Starting setup..." echo "[INFO] Starting setup..."
poetry run hyperglass setup -d &> $LOG_FILE poetry run hyperglass setup -d &>$LOG_FILE
echo "[SUCCESS] Setup completed." echo "[SUCCESS] Setup completed."
sleep 2 sleep 2
echo "[INFO] Copying directives.yaml file..."
cp ./hyperglass/examples/directives.yaml $HOME/hyperglass/directives.yaml
echo "[INFO] Copying devices.yaml file..." echo "[INFO] Copying devices.yaml file..."
cp ./hyperglass/examples/devices.yaml $HOME/hyperglass/devices.yaml cp ./hyperglass/examples/devices.yaml $HOME/hyperglass/devices.yaml
echo "[INFO] Setting listen_address..." echo "[INFO] Setting listen_address..."
echo "listen_address: 127.0.0.1" >> $HOME/hyperglass/hyperglass.yaml echo "listen_address: 127.0.0.1" >>$HOME/hyperglass/hyperglass.yaml
echo "[INFO] Starting UI build." echo "[INFO] Starting UI build."
poetry run hyperglass build-ui &> $LOG_FILE poetry run hyperglass build-ui &>$LOG_FILE
if [[ ! $? == 0 ]]; then if [[ ! $? == 0 ]]; then
echo "[ERROR] Failed to build hyperglass ui." echo "[ERROR] Failed to build hyperglass ui."
@ -29,7 +32,7 @@ else
fi fi
echo "[INFO] Starting hyperglass..." echo "[INFO] Starting hyperglass..."
poetry run hyperglass start &> $LOG_FILE & poetry run hyperglass start &>$LOG_FILE &
sleep 120 sleep 120
if [[ ! $? == 0 ]]; then if [[ ! $? == 0 ]]; then

View file

@ -1,89 +1,12 @@
--- ---
routers: routers:
- name: sfo_router01 - name: Example Device
address: 10.0.0.1 address: 127.0.0.1
network: group: Test
name: primary
display_name: Main Network
credential: credential:
username: user1 username: test
password: secret1 password: test
display_name: San Francisco, CA platform: juniper
port: 22 directives:
nos: cisco_ios - '*'
vrfs: - juniper_bgp_route
- name: default
display_name: Global
ipv4:
source_address: 192.0.2.1
access_list:
- network: 10.0.0.0/8
action: deny
- network: 192.168.0.0/16
action: deny
- network: 172.16.0.0/12
action: deny
- network: 0.0.0.0/0
action: permit
ge: 8
le: 24
ipv6:
source_address: 2001:db8::1
access_list:
- network: ::/0
action: permit
ge: 32
le: 64
- name: customer_a
display_name: Customer A
ipv4:
source_address: 192.168.1.1
access_list:
- network: 192.0.2.0/24
action: deny
- network: 10.0.0.0/8
action: permit
ipv6: null
proxy: null
- name: atl_router01
address: 10.0.0.2
network:
name: secondary
display_name: That Other Network
credential:
username: user2
password: secret2
display_name: Atlanta, GA
port: 22
nos: juniper
vrfs:
- name: default
display_name: Global
ipv4:
source_address: 192.0.2.2
access_list:
- network: 10.0.0.0/8
action: deny
- network: 192.168.0.0/16
action: deny
- network: 172.16.0.0/12
action: deny
- network: 0.0.0.0/0
action: permit
ge: 8
le: 24
ipv6:
source_address: 2001:db8::2
access_list:
- network: ::/0
action: permit
ge: 32
le: 64
proxy:
name: server01
address: 10.11.6.204
port: 22
credential:
username: user1
password: secret1
nos: linux_ssh

View file

@ -0,0 +1,17 @@
juniper_bgp_route:
name: BGP Route
groups:
- Global
rules:
- condition: '1.0.0.1/32'
action: deny
- condition: '0.0.0.0/0'
ge: 8
le: 25
command: 'show route protocol bgp table inet.0 {target} detail'
- condition: '::/0'
ge: 16
le: 64
command: 'show route protocol bgp table inet6.0 {target} detail'
field:
description: IP Address or Prefix

View file

@ -11,6 +11,7 @@
"start": "next start", "start": "next start",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"format": "prettier --config ./.prettierrc -c -w .", "format": "prettier --config ./.prettierrc -c -w .",
"format:check": "prettier --config ./.prettierrc -c .",
"build": "export NODE_OPTIONS=--openssl-legacy-provider; next build && next export -o ../hyperglass/static/ui", "build": "export NODE_OPTIONS=--openssl-legacy-provider; next build && next export -o ../hyperglass/static/ui",
"test": "jest" "test": "jest"
}, },