Skip to content

Commit c2db079

Browse files
committed
chore: initial commit
0 parents  commit c2db079

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+3014
-0
lines changed

.envrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
2+
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
3+
fi
4+
5+
nix_direnv_watch_file devenv.nix
6+
nix_direnv_watch_file devenv.lock
7+
nix_direnv_watch_file devenv.yaml
8+
if ! use flake . --impure
9+
then
10+
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
11+
fi

.github/workflows/release.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
- 'v[0-9]+.[0-9]+.[0-9]+-dev.[0-9]+'
8+
- 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
9+
10+
jobs:
11+
artifacts:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Setup pnpm
19+
uses: pnpm/action-setup@v2
20+
with:
21+
version: 8
22+
- name: Install Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '20'
26+
cache: 'pnpm'
27+
cache-dependency-path: './pnpm-lock.yaml'
28+
- name: Install dependencies
29+
run: pnpm install --frozen-lockfile
30+
- name: Generate bundled schemas
31+
run: pnpm run bundle
32+
- name: Release
33+
uses: ncipollo/release-action@v1
34+
with:
35+
allowUpdates: true
36+
artifacts: 'schemas/bundled/*.schema.{json,yaml}'

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
6+
# dependency directory
7+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
8+
node_modules
9+
10+
# editor
11+
.vscode/*
12+
!.vscode/settings.json
13+
!.vscode/tasks.json
14+
!.vscode/launch.json
15+
!.vscode/extensions.json
16+
!.vscode/*.code-snippets
17+
18+
# build
19+
tsconfig.tsbuildinfo
20+
dist/
21+
22+
# nix
23+
.devenv
24+
.direnv
25+
.pre-commit-config.yaml

.npmignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# dot-files (.env, .git, ...)
2+
.*
3+
4+
# logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
9+
# dependency directory
10+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
11+
node_modules
12+
13+
# editor
14+
.vscode/*
15+
!.vscode/settings.json
16+
!.vscode/tasks.json
17+
!.vscode/launch.json
18+
!.vscode/extensions.json
19+
!.vscode/*.code-snippets
20+
21+
# source
22+
scripts/
23+
test/
24+
tsconfig.json

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
save-exact=true

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pnpm-lock.yaml
2+
flake.lock

.prettierrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"trailingComma": "es5",
3+
"semi": false,
4+
"singleQuote": true
5+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Tailfin Cloud, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# FinOps FOCUS JSON Schemas
2+
3+
This repository contains JSON schemas and tools for the [FinOps Foundation's Open Cost and Usage Specification (FOCUS)](https://focus.finops.org/).
4+
5+
## Getting Started
6+
7+
To use the schema, clone this repository or download the schema directly and reference the JSON schema file in your data validation tools or scripts. Bundled schemas can be found in the `schemas/bundled` folder:
8+
9+
- [`v1.0-Preview Candidate Release`](./schemas/bundled/1.0-rc.1.schema.json)
10+
11+
## Roadmap
12+
13+
- [ ] Conditional rules, for example:
14+
15+
```json
16+
"$defs": {
17+
"rules": {
18+
"allOf": [
19+
{
20+
"$description": "When ChargeCategory is 'Purchase', ChargeFrequency MUST NOT be 'Usage-Based'.",
21+
"if": {
22+
"properties": {
23+
"ChargeCategory": { "const": "Purchase" }
24+
}
25+
},
26+
"then": {
27+
"properties": {
28+
"ChargeFrequency": { "not": { "const": "Usage-Based" } }
29+
}
30+
}
31+
}
32+
]
33+
}
34+
}
35+
```
36+
37+
- [ ] Validation CLI command
38+
- [ ] Sample data generation command
39+
40+
## Contributing
41+
42+
Contributions to the schema are welcome, particularly in the following areas:
43+
44+
- Enhancements to reflect updates in the FinOps FOCUS specification.
45+
- Additional examples and use cases.
46+
47+
## Development
48+
49+
**For an optimal developer experience, it is recommended to install [Nix](https://nixos.org/download.html) and [direnv](https://direnv.net/docs/installation.html).**
50+
51+
<details><summary><i>Installing Nix and direnv</i></summary><br>
52+
53+
**Note: These are instructions that _SHOULD_ work in most cases. Consult the links above for the official instructions for your OS.**
54+
55+
Install Nix:
56+
57+
```sh
58+
sh <(curl -L https://nixos.org/nix/install) --daemon
59+
```
60+
61+
Consult the [installation instructions](https://direnv.net/docs/installation.html) to install direnv using your package manager.
62+
63+
On MacOS:
64+
65+
```sh
66+
brew install direnv
67+
```
68+
69+
Install from binary builds:
70+
71+
```sh
72+
curl -sfL https://direnv.net/install.sh | bash
73+
```
74+
75+
The last step is to configure your shell to use direnv. For example for bash, add the following lines at the end of your `~/.bashrc`:
76+
77+
eval "\$(direnv hook bash)"
78+
79+
**Then restart the shell.**
80+
81+
For other shells, see [https://direnv.net/docs/hook.html](https://direnv.net/docs/hook.html).
82+
83+
**MacOS specific instructions**
84+
85+
Nix may stop working after a MacOS upgrade. If it does, follow [these instructions](https://github.com/NixOS/nix/issues/3616#issuecomment-662858874).
86+
87+
<hr>
88+
</details>
89+
90+
## License
91+
92+
This project is licensed under the MIT License - see the LICENSE file for details.

flake.nix

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
4+
flake-parts.url = "github:hercules-ci/flake-parts";
5+
devenv.url = "github:cachix/devenv";
6+
};
7+
8+
nixConfig = {
9+
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
10+
extra-substituters = "https://devenv.cachix.org";
11+
};
12+
13+
outputs = inputs@{ flake-parts, ... }:
14+
flake-parts.lib.mkFlake { inherit inputs; } {
15+
imports = [
16+
inputs.devenv.flakeModule
17+
];
18+
19+
systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
20+
21+
perSystem = { config, self', inputs', pkgs, system, ... }: rec {
22+
devenv.shells = {
23+
default = {
24+
languages = {
25+
javascript = {
26+
enable = true;
27+
package = pkgs.nodejs_20;
28+
};
29+
};
30+
31+
pre-commit.hooks = {
32+
nixpkgs-fmt.enable = true;
33+
commitizen.enable = true;
34+
35+
commitizen-branch = {
36+
enable = true;
37+
name = "commitizen-branch check";
38+
description = ''
39+
Check whether commit messages on the current HEAD follows committing rules.
40+
'';
41+
entry = "${pkgs.commitizen}/bin/cz check --allow-abort --rev-range origin/HEAD..HEAD";
42+
pass_filenames = false;
43+
stages = [ "manual" ];
44+
};
45+
};
46+
47+
packages = with pkgs; [
48+
# node
49+
nodePackages.pnpm
50+
];
51+
52+
# https://github.com/cachix/devenv/issues/528#issuecomment-1556108767
53+
containers = pkgs.lib.mkForce { };
54+
};
55+
56+
ci = devenv.shells.default;
57+
};
58+
};
59+
};
60+
}

0 commit comments

Comments
 (0)