Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRH Cloud event update #13

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/create_tag_on_main_merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Bump version
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@master
with:
# Fetches entire history, so we can analyze commits since last tag
fetch-depth: 0

- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
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__
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
99 changes: 99 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Equinix CloudEvents Contributors

Thanks for your interest! We're so glad you're here.

The Equinix CloudEvents Repo is a self-service contribution model that allows cross functional teams to manage their own
data schemas related to the CloudEvent types, metric names, and alert names that will be published from their team.

We follow the [CloudEvents](https://cloudevents.io/) project.

Every Data Schema is published to Github Pages through this repo on merges to the `main` branch. Contribution guidelines for
registration and promotion are provided in this document. Please read it thoroughly.

## Code of Conduct

Available via [https://github.com/equinix/equinix-cloudevents/blob/main/.github/CODE_OF_CONDUCT.md](https://github.com/equinix/equinix-cloudevents/blob/main/.github/CODE_OF_CONDUCT.md)

## Data Schema Gating through Equinix Event Manager

Each data schema is created to support CloudEvent types, metrics, and alerts.
The team responsible for the data schema manages which environment the data schema is ready to support by managing the
`cloudeventTypes`, `metricNames`, and `alertNames` attributes in the JSON. Each attribute is an object with list attributes
`released` and `preview` that mark which environment the data schema is ready to suppport the given event/metric/alert in. Only
place types in the `released` list if it is fully tested and ready for production. Place it into the `preview` list if it is under
development and should only be available in UAT.
* `released` - attribute list under `cloudeventTypes`, `metricNames` and `alertNames` signifying that the name listed is fully tested and ready to be sent in production
* `preview` - attribute list under `cloudeventTypes`, `metricNames` and `alertNames` signifying that the name listed is under preview; meaning that the name is in development and should only be exposed to UAT

**Even if the data schema is not using metrics, or alerts, each attribute and sub attribute is required in the data schema. The Github Action will fail if they are not present and the Pull Request will not be merged.**

These lists are retrieved automatically via Github Actions to create a Data Loader that the Equinix Event Manager uses for event,
metric, and alert gating. **Contributing teams are fully responsible for managing these lists to ensure the proper gating is occuring for the Equinix Event Manager.**

Example of complete use case for the attributes:

```
...
"cloudeventTypes": {
"released": [
"equinix.fabric.connection.ipv4_installed_routes.utilization",
"equinix.fabric.connection.ipv6_installed_routes.utilization",
"equinix.fabric.router.ipv4_installed_routes.utilization",
"equinix.fabric.router.ipv6_installed_routes.utilization"
],
"preview": []
},
"metricNames": {
"released": [],
"preview": []
},
"alertNames": {
"released": [],
"preview": []
}
...
```

## Registering a Data Schema

Each team will be adding data schemas in JSON format to their domain. The data schema will be used in the CloudEvent envelope to
specify the format of the data being streamed to customers.

The domains are added under `jsonschema/equinix` in the repository. Of the pattern `jsonschema/equinix/<domain>/<major_version>` with a full example being `jsonschema/equinix/fabric/v1`.

Each data schema is created to support CloudEvent types, metrics, and alerts. Please ensure the [Gating](#data-schema-gating-through-equinix-event-manager) section is read and properly understood to abide by those rules.

Each contributed data schema requires the following attributes:
* "$id" - The fully resolved URL to the data schema for linking from CloudEvent envelope and for generating Github Pages Site
* "name" - The name of the Data Schema being registered. Should match the file name
* "examples" - Provided examples of what the data schema could contain in a streamed event. Can be an empty list `[]` to start.
* "package" - The name of the package containing the data schema. Example: `equinix.fabric.v1`
* "datatype" - The full name of the datatype within the package. Example: `equinix.fabric.v1.ChangeEvent`
* "$schema" - The JSON Schema Specification used to draft the data schema. Use `"http://json-schema.org/draft-04/schema#"` for all
* "$ref" - The reference to the definition provided for the data schema. Example: `#/definitions/Data`
* "definitions" - The JSON Schema definition that describes the contents of the data schema for what will be contained in the event, metric, or alert that is supported by this data schema
* "cloudeventTypes" - Object with list attributes `released` and `preview` that mark which environment the data schema is ready to suppport the given event type in. Only place types in the `released` list if it is fully tested and ready for production. Place it into the `preview` list if it is under development and should only be available in UAT.
* "metricNames" - - Object with list attributes `released` and `preview` that mark which environment the data schema is ready to suppport the given metric in. Only place types in the `released` list if it is fully tested and ready for production. Place it into the `preview` list if it is under development and should only be available in UAT.
* "alertNames" - Object with list attributes `released` and `preview` that mark which environment the data schema is ready to suppport the given event type in. Only place types in the `released` list if it is fully tested and ready for production. Place it into the `preview` list if it is under development and should only be available in UAT.

## Data Schema Versioning

Versioning for data schemas is only based on major versions; there are no minor or patch versions. The major versions
are determined by the directory structure containing the data schema.

If no breaking changes (only additions, no modifications or deletions) are made to the data_schema when it is updated it can stay under the same major version; i.e. v1.

If a breaking change is made to the data_schema (deletion or modification) then it needs to be put into the next major version in a new version directory; i.e. v2.

Not all data_schemas need to be moved to v2. Just the ones that have breaking changes.

## Repository Versioning

The self service contribution model is setup to ensure the repo is always in a stable state that can be released to either UAT or production. Each time a Pull Request is merged into main a new version tag will be created based on SemVar for the commit names
present in the change. This tag will always be available to the Equinix Event Manager for releases. This setup is possible because of our CODEOWNERSHIP model.

## CODEOWNERS

CODEOWNERS file will be in place to establish a Github team (Synced with Equinix IAM) responsible for the files along the domain path they are contributing to. This ensures that 1 member from each domain team and 1 architect will always be necessary to approve a Pull Request before it can be merged.

This is critical because the responsibility of maintaining the `released` and `preview` lists outlined in the [Gating](#data-schema-gating-through-equinix-event-manager) section lies with the Domain owners and not the architects. Should any production defect be found the Domain owner is responsible for resolution
Loading
Loading