{"id":15516212,"url":"https://github.com/dippynark/scm-controller","last_synced_at":"2025-03-17T02:15:48.982Z","repository":{"id":47298609,"uuid":"389445018","full_name":"dippynark/scm-controller","owner":"dippynark","description":"Manage SCM resources with Kubernetes","archived":false,"fork":false,"pushed_at":"2021-09-04T01:10:49.000Z","size":155,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-23T12:11:35.218Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dippynark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-25T21:35:20.000Z","updated_at":"2021-09-04T01:10:52.000Z","dependencies_parsed_at":"2022-09-01T02:30:18.986Z","dependency_job_id":null,"html_url":"https://github.com/dippynark/scm-controller","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dippynark%2Fscm-controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dippynark%2Fscm-controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dippynark%2Fscm-controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dippynark%2Fscm-controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dippynark","download_url":"https://codeload.github.com/dippynark/scm-controller/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243960667,"owners_count":20375105,"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-10-02T10:06:06.861Z","updated_at":"2025-03-17T02:15:48.958Z","avatar_url":"https://github.com/dippynark.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SCM Controller\n\nSCM Controller allows management of Source Control Management resources using Kubernetes. Currently only GitHubWebhooks\nare supported.\n\n[Kubebuilder](https://github.com/kubernetes-sigs/kubebuilder) was used to scaffold this project:\n\n```sh\nkubebuilder init --domain dippynark.co.uk\nkubebuilder create api --group scm --version v1alpha1 --kind GitHubWebhook\nkubebuilder create webhook --group scm --version v1alpha1 --kind GitHubWebhook --defaulting --programmatic-validation\n```\n\n## Create GitHubWebhook\n\n1. Create a GitHub personal access token with `admin:repo_hook` scope:\n[https://github.com/settings/tokens/new?scopes=write:repo_hook](https://github.com/settings/tokens/new?scopes=admin:repo_hook).\nAdmin is needed for webhook deletion.\n\n1. Create a Kubernetes Secret containing the personal access token:\n\n    ```sh\n    kubectl create namespace scm-controller-system \\\n      -o yaml \\\n      --dry-run=client \\\n        | kubectl apply -f -\n    kubectl apply -f - \u003c\u003cEOF\n    apiVersion: v1\n    kind: Secret\n    metadata:\n      name: github\n      namespace: scm-controller-system\n    stringData:\n      token: ghp_EXAMPLE123\n      # For Github Enterprise\n      # baseUrl: https://my.org.com\n    EOF\n    ```\n\n1. Deploy the controller:\n\n    ```sh\n    make deploy\n    ```\n\n1. Create GitHubWebhook with secret:\n\n    ```sh\n    kubectl apply -f - \u003c\u003cEOF\n    apiVersion: v1\n    kind: Secret\n    metadata:\n      name: github-webhook\n    stringData:\n      secret: c2VjcmV0\n    ---\n    apiVersion: scm.dippynark.co.uk/v1alpha1\n    kind: GitHubWebhook\n    metadata:\n      name: test\n    spec:\n      repository:\n        owner: example\n        name: application\n      payloadURL: https://test.example.com\n      contentType: json\n      secret:\n        name: github-webhook\n        key: secret\n      insecureSSL: false\n      events:\n      - \"*\"\n      active: true\n    EOF\n    ```\n\n## Adoption\n\nGitHub does not allow two different webhooks with the same parameters (unless they are created\ninactive). For safety we opt to not allow SCM controller to adopt existing webhooks by default and\ninstead raise an error if there is a collision. If you want an existing webhook to be adopted, set\nthe `.spec.id` field to the ID of the webhook. If a webhook of that ID does not exist, a new webhook\nwill be created and the new ID set.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdippynark%2Fscm-controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdippynark%2Fscm-controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdippynark%2Fscm-controller/lists"}