Skip to content

Commit

Permalink
feat: Add automation for feature flag data schema addition process (#6)
Browse files Browse the repository at this point in the history
* Add automation for feature flag data schema addition process

* Add newlines to end of files

* Add released/preview to events/metrics/alerts and update data loader

* Update scripts and README.md to follow new data schema supported events/metrics/alerts format

* Update GHA to include runs_on attribute for jobs

* Update README to work with GH pages

* Fix GHA errors

* Add github user registration to auto commit in GHA

* Use HEAD ref instead of merge ref from GITHUB ref

* Cleanup raw README.md file with newlines for visibility

* Modify README.md to improve GH Pages Visibility
  • Loading branch information
thogarty authored Dec 2, 2024
1 parent a594e3a commit ef9c8b4
Show file tree
Hide file tree
Showing 20 changed files with 1,025 additions and 315 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/sync_data_schema_updates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Synchronize Repo with Data Schemas
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'jsonschema/**'
- 'scripts/**'
- '.github/workflows/sync_data_schema_updates.yaml'


jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Set git user and generate files
run: |
git config --global user.name 'equinix-labs@auto-commit-workflow'
git config --global user.email '[email protected]'
git config advice.addIgnoredFile false
git fetch
echo -e "\nThis is executing for branch: ${GITHUB_HEAD_REF##*/}."
git checkout ${GITHUB_HEAD_REF##*/}
- name: Update Data Loaders
run: python3 ./scripts/update_data_loader.py

- name: Update JSON Catalog
run: python3 ./scripts/generate_json_catalog.py

- name: Update README.md
run: python3 ./scripts/generate_readme_event_catalog.py

- name: Auto Commit Updates
run: |
git add .
echo -e "\nGit status:"
echo `git status`
cdate=`date`
cmsg="Auto commit generated client synchronization changes for Data Schema Updates - $cdate"
echo -e "\nCommit message created : $cmsg"
echo -e "\nCommitting if there are files to update in client dir:"
echo `git commit -m "$cmsg"`
echo `git push`
30 changes: 30 additions & 0 deletions .github/workflows/validate_json_schemas.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Validate JSON Schemas Syntax
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'jsonschema/**'
- 'scripts/**'
- '.github/workflows/validate_json_schemas.yaml'


jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Install Python requirements.txt Dependencies
run: python3 -m pip install -r ./scripts/requirements.txt

- name: Download schema specifications
run: curl -o ./scripts/jsonschema-org-schema.json https://json-schema.org/draft-04/schema

- name: Validate JSON Schema
run: python3 ./scripts/validate_json_schemas.py
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@

# Local Setup Scripts for Repo
local_helper_scripts/*

# Python Generated Files
__pycache__
231 changes: 181 additions & 50 deletions DataLoader.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,185 @@
{
"access_manager": {
"cloudeventTypes": {
"released": [],
"preview": []
},
"metricNames": {
"released": [],
"preview": []
},
"alertNames": {
"released": [],
"preview": []
}
},
"fabric": {
"eventTypes": [
"equinix.fabric.connection.attribute.changed",
"equinix.fabric.connection.bgpipv4_session_status.connect",
"equinix.fabric.connection.bgpipv4_session_status.established",
"equinix.fabric.connection.bgpipv4_session_status.idle",
"equinix.fabric.connection.bgpipv6_session_status.connect",
"equinix.fabric.connection.bgpipv6_session_status.established",
"equinix.fabric.connection.bgpipv6_session_status.idle",
"equinix.fabric.connection.state.deprovisioned",
"equinix.fabric.connection.state.deprovisioning",
"equinix.fabric.connection.state.pending",
"equinix.fabric.connection.state.pending_approval",
"equinix.fabric.connection.state.pending_interface_configuration",
"equinix.fabric.connection.state.provisioned",
"equinix.fabric.connection.state.provisioning",
"equinix.fabric.connection.status.down",
"equinix.fabric.connection.status.up",
"equinix.fabric.metric",
"equinix.fabric.network.state.deprovisioned",
"equinix.fabric.network.state.deprovisioning",
"equinix.fabric.network.state.provisioned",
"equinix.fabric.network.state.provisioning",
"equinix.fabric.port.state.deprovisioned",
"equinix.fabric.port.state.failed",
"equinix.fabric.port.state.provisioned",
"equinix.fabric.port.status.down",
"equinix.fabric.port.status.up",
"equinix.fabric.router.state.deprovisioned",
"equinix.fabric.router.state.deprovisioning",
"equinix.fabric.router.state.failed",
"equinix.fabric.router.state.not_deprovisioned",
"equinix.fabric.router.state.not_provisioned",
"equinix.fabric.router.state.provisioned",
"equinix.fabric.router.state.provisioning",
"equinix.fabric.router.state.reprovisioning",
"equinix.fabric.service_token.attribute.changed",
"equinix.fabric.service_token.state.deleted",
"equinix.fabric.service_token.state.inactive"
],
"metricNames": [
"equinix.fabric.connection.bandwidth_rx.usage",
"equinix.fabric.connection.bandwidth_tx.usage",
"equinix.fabric.metro.{:asideMetroCode}_{:zsideMetroCode}.latency",
"equinix.fabric.port.bandwidth_rx.usage",
"equinix.fabric.port.bandwidth_tx.usage",
"equinix.fabric.port.packets_dropped_rx.count",
"equinix.fabric.port.packets_dropped_tx.count",
"equinix.fabric.port.packets_erred_rx.count",
"equinix.fabric.port.packets_erred_tx.count"
]
"cloudeventTypes": {
"released": [
"equinix.fabric.connection.attribute.changed",
"equinix.fabric.connection.bgpipv4_session_status.connect",
"equinix.fabric.connection.bgpipv4_session_status.established",
"equinix.fabric.connection.bgpipv4_session_status.idle",
"equinix.fabric.connection.bgpipv4_session_status.open_confirm",
"equinix.fabric.connection.bgpipv4_session_status.open_sent",
"equinix.fabric.connection.bgpipv6_session_status.connect",
"equinix.fabric.connection.bgpipv6_session_status.established",
"equinix.fabric.connection.bgpipv6_session_status.idle",
"equinix.fabric.connection.ipv4_installed_routes.utilization",
"equinix.fabric.connection.ipv6_installed_routes.utilization",
"equinix.fabric.connection.state.deprovisioned",
"equinix.fabric.connection.state.deprovisioning",
"equinix.fabric.connection.state.pending",
"equinix.fabric.connection.state.provisioned",
"equinix.fabric.connection.state.provisioning",
"equinix.fabric.connection.status.down",
"equinix.fabric.connection.status.up",
"equinix.fabric.metric",
"equinix.fabric.network.state.deprovisioned",
"equinix.fabric.network.state.deprovisioning",
"equinix.fabric.network.state.provisioned",
"equinix.fabric.network.state.provisioning",
"equinix.fabric.port.state.deprovisioned",
"equinix.fabric.port.state.failed",
"equinix.fabric.port.state.provisioned",
"equinix.fabric.port.status.down",
"equinix.fabric.port.status.up",
"equinix.fabric.router.ipv4_installed_routes.utilization",
"equinix.fabric.router.ipv6_installed_routes.utilization",
"equinix.fabric.router.state.deprovisioned",
"equinix.fabric.router.state.deprovisioning",
"equinix.fabric.router.state.failed",
"equinix.fabric.router.state.not_deprovisioned",
"equinix.fabric.router.state.not_provisioned",
"equinix.fabric.router.state.provisioned",
"equinix.fabric.router.state.provisioning",
"equinix.fabric.router.state.reprovisioning",
"equinix.fabric.service_token.attribute.changed",
"equinix.fabric.service_token.state.deleted",
"equinix.fabric.service_token.state.inactive"
],
"preview": []
},
"metricNames": {
"released": [
"equinix.fabric.connection.bandwidth_rx.usage",
"equinix.fabric.connection.bandwidth_tx.usage",
"equinix.fabric.metro.am_{:metroCode}.latency",
"equinix.fabric.metro.at_{:metroCode}.latency",
"equinix.fabric.metro.ba_{:metroCode}.latency",
"equinix.fabric.metro.bg_{:metroCode}.latency",
"equinix.fabric.metro.bl_{:metroCode}.latency",
"equinix.fabric.metro.bo_{:metroCode}.latency",
"equinix.fabric.metro.bx_{:metroCode}.latency",
"equinix.fabric.metro.ca_{:metroCode}.latency",
"equinix.fabric.metro.ch_{:metroCode}.latency",
"equinix.fabric.metro.cl_{:metroCode}.latency",
"equinix.fabric.metro.cu_{:metroCode}.latency",
"equinix.fabric.metro.da_{:metroCode}.latency",
"equinix.fabric.metro.db_{:metroCode}.latency",
"equinix.fabric.metro.dc_{:metroCode}.latency",
"equinix.fabric.metro.de_{:metroCode}.latency",
"equinix.fabric.metro.dx_{:metroCode}.latency",
"equinix.fabric.metro.fr_{:metroCode}.latency",
"equinix.fabric.metro.gv_{:metroCode}.latency",
"equinix.fabric.metro.he_{:metroCode}.latency",
"equinix.fabric.metro.hh_{:metroCode}.latency",
"equinix.fabric.metro.hk_{:metroCode}.latency",
"equinix.fabric.metro.ho_{:metroCode}.latency",
"equinix.fabric.metro.il_{:metroCode}.latency",
"equinix.fabric.metro.jh_{:metroCode}.latency",
"equinix.fabric.metro.ka_{:metroCode}.latency",
"equinix.fabric.metro.kl_{:metroCode}.latency",
"equinix.fabric.metro.la_{:metroCode}.latency",
"equinix.fabric.metro.ld_{:metroCode}.latency",
"equinix.fabric.metro.lm_{:metroCode}.latency",
"equinix.fabric.metro.ls_{:metroCode}.latency",
"equinix.fabric.metro.ma_{:metroCode}.latency",
"equinix.fabric.metro.mb_{:metroCode}.latency",
"equinix.fabric.metro.md_{:metroCode}.latency",
"equinix.fabric.metro.me_{:metroCode}.latency",
"equinix.fabric.metro.mi_{:metroCode}.latency",
"equinix.fabric.metro.ml_{:metroCode}.latency",
"equinix.fabric.metro.mo_{:metroCode}.latency",
"equinix.fabric.metro.mt_{:metroCode}.latency",
"equinix.fabric.metro.mu_{:metroCode}.latency",
"equinix.fabric.metro.mx_{:metroCode}.latency",
"equinix.fabric.metro.ny_{:metroCode}.latency",
"equinix.fabric.metro.os_{:metroCode}.latency",
"equinix.fabric.metro.ot_{:metroCode}.latency",
"equinix.fabric.metro.pa_{:metroCode}.latency",
"equinix.fabric.metro.pe_{:metroCode}.latency",
"equinix.fabric.metro.ph_{:metroCode}.latency",
"equinix.fabric.metro.rj_{:metroCode}.latency",
"equinix.fabric.metro.se_{:metroCode}.latency",
"equinix.fabric.metro.sg_{:metroCode}.latency",
"equinix.fabric.metro.sk_{:metroCode}.latency",
"equinix.fabric.metro.sl_{:metroCode}.latency",
"equinix.fabric.metro.so_{:metroCode}.latency",
"equinix.fabric.metro.sp_{:metroCode}.latency",
"equinix.fabric.metro.st_{:metroCode}.latency",
"equinix.fabric.metro.sv_{:metroCode}.latency",
"equinix.fabric.metro.sy_{:metroCode}.latency",
"equinix.fabric.metro.tr_{:metroCode}.latency",
"equinix.fabric.metro.ty_{:metroCode}.latency",
"equinix.fabric.metro.va_{:metroCode}.latency",
"equinix.fabric.metro.wa_{:metroCode}.latency",
"equinix.fabric.metro.wi_{:metroCode}.latency",
"equinix.fabric.metro.zh_{:metroCode}.latency",
"equinix.fabric.port.bandwidth_rx.usage",
"equinix.fabric.port.bandwidth_tx.usage",
"equinix.fabric.port.packets_dropped_rx.count",
"equinix.fabric.port.packets_dropped_tx.count",
"equinix.fabric.port.packets_erred_rx.count",
"equinix.fabric.port.packets_erred_tx.count"
],
"preview": []
},
"alertNames": {
"released": [],
"preview": []
}
},
"identity": {
"cloudeventTypes": {
"released": [],
"preview": []
},
"metricNames": {
"released": [],
"preview": []
},
"alertNames": {
"released": [],
"preview": []
}
},
"network_edge": {
"cloudeventTypes": {
"released": [],
"preview": []
},
"metricNames": {
"released": [],
"preview": []
},
"alertNames": {
"released": [],
"preview": []
}
},
"resource_manager": {
"cloudeventTypes": {
"released": [],
"preview": []
},
"metricNames": {
"released": [],
"preview": []
},
"alertNames": {
"released": [],
"preview": []
}
}
}
Loading

0 comments on commit ef9c8b4

Please sign in to comment.