# CI Billing Tool This tool implements some helpful operations required to do finops management of the CI sandbox clusters. While it can be built as a separate binary, it is likely that most users will just call it with bazel, for example: ``` just run cmd/tools/ci-billing -- refs ``` Note: Before running these commands, you may have to do a GCP application login: ``` gcloud auth application-default login ``` ## Commands ### Refs This parses the project folders in the edge-infra repository, and pulls out the billing references we include there in a CSV format for easy processing. An optional `--no-headings` flag prevents the column headings being included in the CSV file. ``` just run cmd/tools/ci-billing -- refs --no-headings ``` The command defaults to finding the config files in `config/clusters/ret-edge-pltf-infra/platform-infra/projects/preprod/dsds-ien-playpits`. If for some reason that is not the case, the location can be manually specified using the `--project-dir` flag: ``` just run cmd/tools/ci-billing -- refs --project-dir /home/myuser/projects ``` ### Owners This command pulls the iam roles associated with all the CI projects listed in the projects directory, and prints all the users assigned with owners, to help with identifying the correct point of contact for a project. As with the `refs` command above, the location of the project directory can be specified using the `--project-dir` flag if not in its default location. The command can also be limited to an individual project using the `--project` flag: ``` just run cmd/tools/ci-billing -- owners --project ret-edge-dsds-matrix ``` ### Labels This command consumes a CSV file of project and schedule information, and applies the labels consumed by GSRE to start and stop the VMS. The format of the CVS file is as follows: ``` ,,, ``` e.g: ``` ret-edge-dsds-ci-team-02,utc,12-23,01-02 ``` The location of the CSV file must be specified with the `csv-location` flag: ``` just run cmd/tools/ci-billing -- labels --csv-location /home/myuser/temp/schedules.csv ``` Optionally, a single project to run against can be specified with the `--project` flag: ``` just run cmd/tools/ci-billing -- labels --csv-location /home/myuser/temp/schedules.csv --project ret-edge-dsds-ci-team-02 ```