{"id":13741968,"url":"https://github.com/cloud66-oss/copper","last_synced_at":"2025-04-09T20:05:58.229Z","repository":{"id":32934115,"uuid":"126004012","full_name":"cloud66-oss/copper","owner":"cloud66-oss","description":"A configuration file validator for Kubernetes.","archived":false,"fork":false,"pushed_at":"2022-06-11T15:59:48.000Z","size":4498,"stargazers_count":277,"open_issues_count":5,"forks_count":15,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-09T20:05:53.635Z","etag":null,"topics":["cloud66","configuration","copper","kubernetes","validator"],"latest_commit_sha":null,"homepage":"https://help.cloud66.com/copper/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloud66-oss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-20T11:00:27.000Z","updated_at":"2025-04-08T19:04:22.000Z","dependencies_parsed_at":"2022-08-18T05:15:09.126Z","dependency_job_id":null,"html_url":"https://github.com/cloud66-oss/copper","commit_stats":null,"previous_names":["cloud66/copper"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud66-oss%2Fcopper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud66-oss%2Fcopper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud66-oss%2Fcopper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud66-oss%2Fcopper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloud66-oss","download_url":"https://codeload.github.com/cloud66-oss/copper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103871,"owners_count":21048245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud66","configuration","copper","kubernetes","validator"],"created_at":"2024-08-03T04:01:04.677Z","updated_at":"2025-04-09T20:05:58.201Z","avatar_url":"https://github.com/cloud66-oss.png","language":"JavaScript","readme":"\u003cimg src=\"http://cdn2-cloud66-com.s3.amazonaws.com/images/oss-sponsorship.png\" width=150/\u003e\n\n# Copper\n\nCopper is a simple tool for validate your configuration files. This is specifically useful with Kubernetes configuration files to enforce best practices, apply policies and compliance requirements.\n\nNOTE: This is Copper v2.0 which is a rewrite of Copper v1.0 (and not an in-place upgrade). Copper v2.0 uses Javascript as it's scripting language instead of Copper v1.0's custom DSL. At the moment, we don't offer any upgrades for old Copper v1 scripts to Copper v2.\n\n- Help Pages: https://help.cloud66.com/copper/\n- Slack Channel: [Join Our Slack Community](https://communityinviter.com/apps/cloud66ers/cloud-66-community).\n- Articles: https://blog.cloud66.com/tag/copper/\n\n\n![Copper Logo](https://blog.cloud66.com/content/images/2019/07/cloud66-copper.png)\n\n\n## Installation\n\nHead to the releases section of this repository and download the latest version of Copper. You can update Copper using `copper update` command at any time. By default, you will be running the `stable` releases. To change the channel, you can use the `--channel` argument in `copper update`.\n\n## Usage\n\n```bash\ncopper validate --in samples/sample.yml --validator samples/no_latest.js\n```\n\nThis will run `no_latest.js` script to validate `sample.yml` (both available in this repository).\n\nCopper supports YAML configuration files. By default, it loads the entire input YAML file into the `$$` variable that's available to your scripts. Each section of your YAML file is one item in the `$$` array.\n\nHere is an example on how to stop using `latest` as the image tag.\n\n```javascript\n$$.forEach(function($){\n    if ($.kind === 'Deployment') {\n        $.spec.template.spec.containers.forEach(function(container) {\n            var image = new DockerImage(container.image);\n            if (image.tag === 'latest') {\n                errors.add_error('no_latest',\"latest is used in \" + $.metadata.name, 1)\n            }\n        });\n    }\n});\n```\n\nAs you can see, for each section in the YAML, we check if the item is a `Deployment`, if it is use one of Copper's internal helper classes `DocerkImage` to load the image name and parse it. `DockerImage` understands the intricacies of Docker image names (default tag names, default repos, etc). If the tag is `latest` we push an error into the `errors` list.\n\nOnce our script has run, Copper will check `errors` for any errors.\n\nEach validation error should have 3 attributes:\n`check_name`: The name of the check we just performed\n`title`: Some explanation about this error\n`severity`: A numerical representation of the severity of this error.\n\nYou can set the maximum allowed severity when running Copper using the `--threshold` argument.\n\n### Helpers\n\nTo see what helpers are available for you to use in your scripts, see the files in the `libjs` folder in the repository. All these files are loaded before your script is run and therefore are available to use within your scripts.\n","funding_links":[],"categories":["Configuration Management","Tools and Libraries","Инструменты","Validation"],"sub_categories":["Testing and Troubleshooting","IAC Security","Variables (example workarounds)"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloud66-oss%2Fcopper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloud66-oss%2Fcopper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloud66-oss%2Fcopper/lists"}