{"id":18769282,"url":"https://github.com/score-spec/score-implementation-sample","last_synced_at":"2025-03-02T02:19:10.818Z","repository":{"id":260072425,"uuid":"875276147","full_name":"score-spec/score-implementation-sample","owner":"score-spec","description":"Score implementation template","archived":false,"fork":false,"pushed_at":"2025-02-24T11:55:23.000Z","size":87,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T12:38:29.872Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/score-spec.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-19T14:55:37.000Z","updated_at":"2025-02-24T11:48:48.000Z","dependencies_parsed_at":"2025-02-24T12:30:58.141Z","dependency_job_id":"125b0215-2f21-4299-96b5-4e508a52195c","html_url":"https://github.com/score-spec/score-implementation-sample","commit_stats":null,"previous_names":["score-spec/score-implementation-sample"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/score-spec%2Fscore-implementation-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/score-spec%2Fscore-implementation-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/score-spec%2Fscore-implementation-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/score-spec%2Fscore-implementation-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/score-spec","download_url":"https://codeload.github.com/score-spec/score-implementation-sample/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241447823,"owners_count":19964367,"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":[],"created_at":"2024-11-07T19:15:24.501Z","updated_at":"2025-03-02T02:19:10.789Z","avatar_url":"https://github.com/score-spec.png","language":"Go","readme":"# score-implementation-sample\n\nThis score-implementation-sample is a template repo for creating a new Score implementation following the conventions laid out in [Score Compose](https://github.com/score-spec/score-compose) and [Score K8s](https://github.com/score-spec/score-k8s).\n\nThis sample comes complete with:\n\n1. CLI skeleton including `init` and`generate` subcommands\n    - `generate --overrides-file` and `generate --override-property` for applying Score overrides before conversion\n    - `generate --image` for overriding the workload image before conversion.\n    - Full placeholder support for `${metadata...}` and `${resource...}` expressions in the workload variables, files, and resource params.\n2. State directory storage in `.score-implementation-sample/`\n3. `TODO` in place of resource provisioning and workload conversion\n\nTo adapt this for your target platform, you should:\n\n1. Fork the repo or use the \"use as template\" button in Github (this flattens the commit history)\n    ![use-as-template](use-template-screenshot.png)\n2. Rename the go module by replacing all instances of `github.com/score-spec/score-implementation-sample` with your own module name.\n3. Replace all other instances of `score-implementation-sample` with your own `score-xyz` name including renaming the `cmd/score-implementation-sample` directory.\n4. Run the tests with `go test -v ./...`.\n5. Change the `TODO` in [provisioning.go](./internal/provisioners/provisioning.go) to provision resources and set the resource outputs. The existing implementation resolves placeholders in the resource params but does not set any resource outputs.\n6. Change the `TODO` in [convert.go](./internal/convert/convert.go) to convert workloads into the target manifest form. The existing implementation resolves placeholders in the variables and files sections but just returns the workload spec as yaml content in the manifests.\n\nGood luck, and have fun!\n\n## Demo\n\nWrite the following to `score.yaml`:\n\n```yaml\napiVersion: score.dev/v1b1\nmetadata:\n    name: example\ncontainers:\n    main:\n        image: stefanprodan/podinfo\n        variables:\n            key: value\n            dynamic: ${metadata.name}\n        files:\n        - target: /somefile\n          content: |\n            ${metadata.name}\nresources:\n    thing:\n        type: something\n        params:\n          x: ${metadata.name}\n```\n\nAnd run:\n\n```sh\ngo run ./cmd/score-xyz init\ngo run ./cmd/score-xyz generate score.yaml\n```\n\nThe output `manifests.yaml` contains the following which indicates:\n\n1. Resources were \"provisioned\" and their parameters interpolated.\n2. Workloads were converted by copying them to the output manifests with variables or files interpolated as required.\n\n```yaml\napiVersion: score.dev/v1b1\nmetadata:\n    name: example\ncontainers:\n    main:\n        files:\n            - content: |\n                example\n              noExpand: true\n              target: /somefile\n        image: stefanprodan/podinfo\n        variables:\n            dynamic: example\n            key: value\nresources:\n    thing:\n        params:\n            x: example\n        type: something\n```\n\n## A note on licensing\n\nMost code files here retain the Apache licence header since they were copied or adapted from the reference `score-compose` which is Apache licensed. Any modifications to these files should retain the Apache licence and attribution.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscore-spec%2Fscore-implementation-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscore-spec%2Fscore-implementation-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscore-spec%2Fscore-implementation-sample/lists"}