From ce966bba481ec678b52d9d49864242f214ad5182 Mon Sep 17 00:00:00 2001 From: Viktor Date: Fri, 12 Nov 2021 10:25:29 +0200 Subject: [PATCH] added counterfeiter licenses --- license_prefix.txt | 3 + pkg/git/git.go | 2 +- pkg/git/gitfakes/fake_git.go | 3 + pkg/git/gitfakes/fake_repository.go | 3 + pkg/git/gitfakes/fake_repository_worktree.go | 3 + pkg/reactor/reactor.go | 5 +- .../reactorfakes/fake_download_scheduler.go | 3 + pkg/reactor/reactorfakes/fake_git_hub_info.go | 3 + pkg/reactor/reactorfakes/fake_reader.go | 3 + pkg/reactor/reactorfakes/fake_validator.go | 3 + .../git/gitGinko_resource_handler_test.go | 510 +--------------- .../git/git_resource_handler.go | 2 +- .../git/gitfakes/fake_file_info.go | 3 + .../git/gitfakes/fake_file_reader.go | 3 + .../githubGinko_resource_handler_test.go | 573 +----------------- pkg/resourcehandlers/resource_handlers.go | 5 +- .../resourcehandlersfakes/fake_registry.go | 3 + .../fake_resource_handler.go | 3 + pkg/util/httpclient/client.go | 2 +- .../httpclient/httpclientfakes/fake_client.go | 3 + pkg/writers/writers.go | 2 +- pkg/writers/writersfakes/fake_writer.go | 3 + 22 files changed, 65 insertions(+), 1078 deletions(-) create mode 100644 license_prefix.txt diff --git a/license_prefix.txt b/license_prefix.txt new file mode 100644 index 00000000..f8b4310e --- /dev/null +++ b/license_prefix.txt @@ -0,0 +1,3 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 diff --git a/pkg/git/git.go b/pkg/git/git.go index 05d6804d..9d03dfdc 100644 --- a/pkg/git/git.go +++ b/pkg/git/git.go @@ -4,7 +4,7 @@ package git -//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate +//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate -header ../../license_prefix.txt import ( "context" diff --git a/pkg/git/gitfakes/fake_git.go b/pkg/git/gitfakes/fake_git.go index 79e540c0..b9f65a43 100644 --- a/pkg/git/gitfakes/fake_git.go +++ b/pkg/git/gitfakes/fake_git.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 // Code generated by counterfeiter. DO NOT EDIT. package gitfakes diff --git a/pkg/git/gitfakes/fake_repository.go b/pkg/git/gitfakes/fake_repository.go index 07714b33..3ffcdfe1 100644 --- a/pkg/git/gitfakes/fake_repository.go +++ b/pkg/git/gitfakes/fake_repository.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 // Code generated by counterfeiter. DO NOT EDIT. package gitfakes diff --git a/pkg/git/gitfakes/fake_repository_worktree.go b/pkg/git/gitfakes/fake_repository_worktree.go index c95a1b20..5ae8a0ee 100644 --- a/pkg/git/gitfakes/fake_repository_worktree.go +++ b/pkg/git/gitfakes/fake_repository_worktree.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 // Code generated by counterfeiter. DO NOT EDIT. package gitfakes diff --git a/pkg/reactor/reactor.go b/pkg/reactor/reactor.go index 6613e235..a45f0874 100644 --- a/pkg/reactor/reactor.go +++ b/pkg/reactor/reactor.go @@ -4,13 +4,12 @@ package reactor -//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate +//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate -header ../../license_prefix.txt import ( "context" "errors" "fmt" - "github.com/gardener/docforge/pkg/jobs" "io" "net/http" "os" @@ -18,6 +17,8 @@ import ( "sync" "text/template" + "github.com/gardener/docforge/pkg/jobs" + "github.com/gardener/docforge/pkg/processors" "k8s.io/klog/v2" diff --git a/pkg/reactor/reactorfakes/fake_download_scheduler.go b/pkg/reactor/reactorfakes/fake_download_scheduler.go index 87306129..c45045a6 100644 --- a/pkg/reactor/reactorfakes/fake_download_scheduler.go +++ b/pkg/reactor/reactorfakes/fake_download_scheduler.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 // Code generated by counterfeiter. DO NOT EDIT. package reactorfakes diff --git a/pkg/reactor/reactorfakes/fake_git_hub_info.go b/pkg/reactor/reactorfakes/fake_git_hub_info.go index 018a5a93..6d9de49c 100644 --- a/pkg/reactor/reactorfakes/fake_git_hub_info.go +++ b/pkg/reactor/reactorfakes/fake_git_hub_info.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 // Code generated by counterfeiter. DO NOT EDIT. package reactorfakes diff --git a/pkg/reactor/reactorfakes/fake_reader.go b/pkg/reactor/reactorfakes/fake_reader.go index e4609e58..174c5a33 100644 --- a/pkg/reactor/reactorfakes/fake_reader.go +++ b/pkg/reactor/reactorfakes/fake_reader.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 // Code generated by counterfeiter. DO NOT EDIT. package reactorfakes diff --git a/pkg/reactor/reactorfakes/fake_validator.go b/pkg/reactor/reactorfakes/fake_validator.go index 09e00fcc..e34c9dec 100644 --- a/pkg/reactor/reactorfakes/fake_validator.go +++ b/pkg/reactor/reactorfakes/fake_validator.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 // Code generated by counterfeiter. DO NOT EDIT. package reactorfakes diff --git a/pkg/resourcehandlers/git/gitGinko_resource_handler_test.go b/pkg/resourcehandlers/git/gitGinko_resource_handler_test.go index bd218b03..25e09282 100644 --- a/pkg/resourcehandlers/git/gitGinko_resource_handler_test.go +++ b/pkg/resourcehandlers/git/gitGinko_resource_handler_test.go @@ -102,513 +102,9 @@ var ( }) mux.HandleFunc("/repos/testOrg/testRepo", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(fmt.Sprintf(` - { - "id": 1296269, - "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", - "name": "Hello-World", - "full_name": "octocat/Hello-World", - "owner": { - "login": "octocat", - "id": 1, - "node_id": "MDQ6VXNlcjE=", - "avatar_url": "https://github.com/images/error/octocat_happy.gif", - "gravatar_id": "", - "url": "https://api.github.com/users/octocat", - "html_url": "https://github.com/octocat", - "followers_url": "https://api.github.com/users/octocat/followers", - "following_url": "https://api.github.com/users/octocat/following{/other_user}", - "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", - "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", - "organizations_url": "https://api.github.com/users/octocat/orgs", - "repos_url": "https://api.github.com/users/octocat/repos", - "events_url": "https://api.github.com/users/octocat/events{/privacy}", - "received_events_url": "https://api.github.com/users/octocat/received_events", - "type": "User", - "site_admin": false - }, - "private": false, - "html_url": "https://github.com/octocat/Hello-World", - "description": "This your first repo!", - "fork": false, - "url": "https://api.github.com/repos/octocat/Hello-World", - "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", - "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", - "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", - "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", - "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", - "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", - "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", - "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", - "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", - "events_url": "https://api.github.com/repos/octocat/Hello-World/events", - "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", - "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", - "git_url": "git:github.com/octocat/Hello-World.git", - "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", - "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", - "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", - "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", - "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", - "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", - "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", - "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", - "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", - "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", - "ssh_url": "git@github.com:octocat/Hello-World.git", - "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", - "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", - "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", - "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", - "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", - "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", - "clone_url": "https://github.com/octocat/Hello-World.git", - "mirror_url": "git:git.example.com/octocat/Hello-World", - "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks", - "svn_url": "https://svn.github.com/octocat/Hello-World", - "homepage": "https://github.com", - "language": null, - "forks_count": 9, - "forks": 9, - "stargazers_count": 80, - "watchers_count": 80, - "watchers": 80, - "size": 108, - "default_branch": "testMainBranch", - "open_issues_count": 0, - "open_issues": 0, - "is_template": false, - "topics": [ - "octocat", - "atom", - "electron", - "api" - ], - "has_issues": true, - "has_projects": true, - "has_wiki": true, - "has_pages": false, - "has_downloads": true, - "archived": false, - "disabled": false, - "visibility": "public", - "pushed_at": "2011-01-26T19:06:43Z", - "created_at": "2011-01-26T19:01:12Z", - "updated_at": "2011-01-26T19:14:43Z", - "permissions": { - "pull": true, - "push": false, - "admin": false - }, - "allow_rebase_merge": true, - "template_repository": { - "id": 1296269, - "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", - "name": "Hello-World-Template", - "full_name": "octocat/Hello-World-Template", - "owner": { - "login": "octocat", - "id": 1, - "node_id": "MDQ6VXNlcjE=", - "avatar_url": "https://github.com/images/error/octocat_happy.gif", - "gravatar_id": "", - "url": "https://api.github.com/users/octocat", - "html_url": "https://github.com/octocat", - "followers_url": "https://api.github.com/users/octocat/followers", - "following_url": "https://api.github.com/users/octocat/following{/other_user}", - "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", - "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", - "organizations_url": "https://api.github.com/users/octocat/orgs", - "repos_url": "https://api.github.com/users/octocat/repos", - "events_url": "https://api.github.com/users/octocat/events{/privacy}", - "received_events_url": "https://api.github.com/users/octocat/received_events", - "type": "User", - "site_admin": false - }, - "private": false, - "html_url": "https://github.com/octocat/Hello-World-Template", - "description": "This your first repo!", - "fork": false, - "url": "https://api.github.com/repos/octocat/Hello-World-Template", - "archive_url": "https://api.github.com/repos/octocat/Hello-World-Template/{archive_format}{/ref}", - "assignees_url": "https://api.github.com/repos/octocat/Hello-World-Template/assignees{/user}", - "blobs_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/octocat/Hello-World-Template/branches{/branch}", - "collaborators_url": "https://api.github.com/repos/octocat/Hello-World-Template/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/octocat/Hello-World-Template/comments{/number}", - "commits_url": "https://api.github.com/repos/octocat/Hello-World-Template/commits{/sha}", - "compare_url": "https://api.github.com/repos/octocat/Hello-World-Template/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/octocat/Hello-World-Template/contents/{+path}", - "contributors_url": "https://api.github.com/repos/octocat/Hello-World-Template/contributors", - "deployments_url": "https://api.github.com/repos/octocat/Hello-World-Template/deployments", - "downloads_url": "https://api.github.com/repos/octocat/Hello-World-Template/downloads", - "events_url": "https://api.github.com/repos/octocat/Hello-World-Template/events", - "forks_url": "https://api.github.com/repos/octocat/Hello-World-Template/forks", - "git_commits_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/tags{/sha}", - "git_url": "git:github.com/octocat/Hello-World-Template.git", - "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues/events{/number}", - "issues_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues{/number}", - "keys_url": "https://api.github.com/repos/octocat/Hello-World-Template/keys{/key_id}", - "labels_url": "https://api.github.com/repos/octocat/Hello-World-Template/labels{/name}", - "languages_url": "https://api.github.com/repos/octocat/Hello-World-Template/languages", - "merges_url": "https://api.github.com/repos/octocat/Hello-World-Template/merges", - "milestones_url": "https://api.github.com/repos/octocat/Hello-World-Template/milestones{/number}", - "notifications_url": "https://api.github.com/repos/octocat/Hello-World-Template/notifications{?since,all,participating}", - "pulls_url": "https://api.github.com/repos/octocat/Hello-World-Template/pulls{/number}", - "releases_url": "https://api.github.com/repos/octocat/Hello-World-Template/releases{/id}", - "ssh_url": "git@github.com:octocat/Hello-World-Template.git", - "stargazers_url": "https://api.github.com/repos/octocat/Hello-World-Template/stargazers", - "statuses_url": "https://api.github.com/repos/octocat/Hello-World-Template/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/octocat/Hello-World-Template/subscribers", - "subscription_url": "https://api.github.com/repos/octocat/Hello-World-Template/subscription", - "tags_url": "https://api.github.com/repos/octocat/Hello-World-Template/tags", - "teams_url": "https://api.github.com/repos/octocat/Hello-World-Template/teams", - "trees_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/trees{/sha}", - "clone_url": "https://github.com/octocat/Hello-World-Template.git", - "mirror_url": "git:git.example.com/octocat/Hello-World-Template", - "hooks_url": "https://api.github.com/repos/octocat/Hello-World-Template/hooks", - "svn_url": "https://svn.github.com/octocat/Hello-World-Template", - "homepage": "https://github.com", - "language": null, - "forks": 9, - "forks_count": 9, - "stargazers_count": 80, - "watchers_count": 80, - "watchers": 80, - "size": 108, - "default_branch": "master", - "open_issues": 0, - "open_issues_count": 0, - "is_template": true, - "license": { - "key": "mit", - "name": "MIT License", - "url": "https://api.github.com/licenses/mit", - "spdx_id": "MIT", - "node_id": "MDc6TGljZW5zZW1pdA==", - "html_url": "https://api.github.com/licenses/mit" - }, - "topics": [ - "octocat", - "atom", - "electron", - "api" - ], - "has_issues": true, - "has_projects": true, - "has_wiki": true, - "has_pages": false, - "has_downloads": true, - "archived": false, - "disabled": false, - "visibility": "public", - "pushed_at": "2011-01-26T19:06:43Z", - "created_at": "2011-01-26T19:01:12Z", - "updated_at": "2011-01-26T19:14:43Z", - "permissions": { - "admin": false, - "push": false, - "pull": true - }, - "allow_rebase_merge": true, - "temp_clone_token": "dummy", - "allow_squash_merge": true, - "allow_auto_merge": false, - "delete_branch_on_merge": true, - "allow_merge_commit": true, - "subscribers_count": 42, - "network_count": 0 - }, - "temp_clone_token": "dummy", - "allow_squash_merge": true, - "allow_auto_merge": false, - "delete_branch_on_merge": true, - "allow_merge_commit": true, - "subscribers_count": 42, - "network_count": 0, - "license": { - "key": "mit", - "name": "MIT License", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit", - "node_id": "MDc6TGljZW5zZW1pdA==" - }, - "organization": { - "login": "octocat", - "id": 1, - "node_id": "MDQ6VXNlcjE=", - "avatar_url": "https://github.com/images/error/octocat_happy.gif", - "gravatar_id": "", - "url": "https://api.github.com/users/octocat", - "html_url": "https://github.com/octocat", - "followers_url": "https://api.github.com/users/octocat/followers", - "following_url": "https://api.github.com/users/octocat/following{/other_user}", - "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", - "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", - "organizations_url": "https://api.github.com/users/octocat/orgs", - "repos_url": "https://api.github.com/users/octocat/repos", - "events_url": "https://api.github.com/users/octocat/events{/privacy}", - "received_events_url": "https://api.github.com/users/octocat/received_events", - "type": "Organization", - "site_admin": false - }, - "parent": { - "id": 1296269, - "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", - "name": "Hello-World", - "full_name": "octocat/Hello-World", - "owner": { - "login": "octocat", - "id": 1, - "node_id": "MDQ6VXNlcjE=", - "avatar_url": "https://github.com/images/error/octocat_happy.gif", - "gravatar_id": "", - "url": "https://api.github.com/users/octocat", - "html_url": "https://github.com/octocat", - "followers_url": "https://api.github.com/users/octocat/followers", - "following_url": "https://api.github.com/users/octocat/following{/other_user}", - "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", - "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", - "organizations_url": "https://api.github.com/users/octocat/orgs", - "repos_url": "https://api.github.com/users/octocat/repos", - "events_url": "https://api.github.com/users/octocat/events{/privacy}", - "received_events_url": "https://api.github.com/users/octocat/received_events", - "type": "User", - "site_admin": false - }, - "private": false, - "html_url": "https://github.com/octocat/Hello-World", - "description": "This your first repo!", - "fork": false, - "url": "https://api.github.com/repos/octocat/Hello-World", - "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", - "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", - "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", - "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", - "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", - "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", - "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", - "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", - "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", - "events_url": "https://api.github.com/repos/octocat/Hello-World/events", - "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", - "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", - "git_url": "git:github.com/octocat/Hello-World.git", - "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", - "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", - "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", - "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", - "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", - "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", - "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", - "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", - "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", - "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", - "ssh_url": "git@github.com:octocat/Hello-World.git", - "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", - "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", - "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", - "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", - "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", - "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", - "clone_url": "https://github.com/octocat/Hello-World.git", - "mirror_url": "git:git.example.com/octocat/Hello-World", - "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks", - "svn_url": "https://svn.github.com/octocat/Hello-World", - "homepage": "https://github.com", - "language": null, - "forks_count": 9, - "stargazers_count": 80, - "watchers_count": 80, - "size": 108, - "default_branch": "master", - "open_issues_count": 0, - "is_template": true, - "topics": [ - "octocat", - "atom", - "electron", - "api" - ], - "has_issues": true, - "has_projects": true, - "has_wiki": true, - "has_pages": false, - "has_downloads": true, - "archived": false, - "disabled": false, - "visibility": "public", - "pushed_at": "2011-01-26T19:06:43Z", - "created_at": "2011-01-26T19:01:12Z", - "updated_at": "2011-01-26T19:14:43Z", - "permissions": { - "admin": false, - "push": false, - "pull": true - }, - "allow_rebase_merge": true, - "temp_clone_token": "dummy", - "allow_squash_merge": true, - "allow_auto_merge": false, - "delete_branch_on_merge": true, - "allow_merge_commit": true, - "subscribers_count": 42, - "network_count": 0, - "license": { - "key": "mit", - "name": "MIT License", - "url": "https://api.github.com/licenses/mit", - "spdx_id": "MIT", - "node_id": "MDc6TGljZW5zZW1pdA==", - "html_url": "https://api.github.com/licenses/mit" - }, - "forks": 1, - "open_issues": 1, - "watchers": 1 - }, - "source": { - "id": 1296269, - "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", - "name": "Hello-World", - "full_name": "octocat/Hello-World", - "owner": { - "login": "octocat", - "id": 1, - "node_id": "MDQ6VXNlcjE=", - "avatar_url": "https://github.com/images/error/octocat_happy.gif", - "gravatar_id": "", - "url": "https://api.github.com/users/octocat", - "html_url": "https://github.com/octocat", - "followers_url": "https://api.github.com/users/octocat/followers", - "following_url": "https://api.github.com/users/octocat/following{/other_user}", - "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", - "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", - "organizations_url": "https://api.github.com/users/octocat/orgs", - "repos_url": "https://api.github.com/users/octocat/repos", - "events_url": "https://api.github.com/users/octocat/events{/privacy}", - "received_events_url": "https://api.github.com/users/octocat/received_events", - "type": "User", - "site_admin": false - }, - "private": false, - "html_url": "https://github.com/octocat/Hello-World", - "description": "This your first repo!", - "fork": false, - "url": "https://api.github.com/repos/octocat/Hello-World", - "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", - "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", - "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", - "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", - "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", - "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", - "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", - "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", - "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", - "events_url": "https://api.github.com/repos/octocat/Hello-World/events", - "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", - "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", - "git_url": "git:github.com/octocat/Hello-World.git", - "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", - "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", - "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", - "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", - "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", - "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", - "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", - "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", - "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", - "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", - "ssh_url": "git@github.com:octocat/Hello-World.git", - "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", - "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", - "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", - "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", - "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", - "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", - "clone_url": "https://github.com/octocat/Hello-World.git", - "mirror_url": "git:git.example.com/octocat/Hello-World", - "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks", - "svn_url": "https://svn.github.com/octocat/Hello-World", - "homepage": "https://github.com", - "language": null, - "forks_count": 9, - "stargazers_count": 80, - "watchers_count": 80, - "size": 108, - "default_branch": "master", - "open_issues_count": 0, - "is_template": true, - "topics": [ - "octocat", - "atom", - "electron", - "api" - ], - "has_issues": true, - "has_projects": true, - "has_wiki": true, - "has_pages": false, - "has_downloads": true, - "archived": false, - "disabled": false, - "visibility": "public", - "pushed_at": "2011-01-26T19:06:43Z", - "created_at": "2011-01-26T19:01:12Z", - "updated_at": "2011-01-26T19:14:43Z", - "permissions": { - "admin": false, - "push": false, - "pull": true - }, - "allow_rebase_merge": true, - "temp_clone_token": "dummy", - "allow_squash_merge": true, - "allow_auto_merge": false, - "delete_branch_on_merge": true, - "allow_merge_commit": true, - "subscribers_count": 42, - "network_count": 0, - "license": { - "key": "mit", - "name": "MIT License", - "url": "https://api.github.com/licenses/mit", - "spdx_id": "MIT", - "node_id": "MDc6TGljZW5zZW1pdA==", - "html_url": "https://api.github.com/licenses/mit" - }, - "forks": 1, - "open_issues": 1, - "watchers": 1 - } - } + { + "default_branch": "testMainBranch" + } `))) }) diff --git a/pkg/resourcehandlers/git/git_resource_handler.go b/pkg/resourcehandlers/git/git_resource_handler.go index 0f35eef2..1c44c098 100644 --- a/pkg/resourcehandlers/git/git_resource_handler.go +++ b/pkg/resourcehandlers/git/git_resource_handler.go @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate +//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate -header ../../../license_prefix.txt //counterfeiter:generate os.FileInfo diff --git a/pkg/resourcehandlers/git/gitfakes/fake_file_info.go b/pkg/resourcehandlers/git/gitfakes/fake_file_info.go index 4c480e50..8a2ac628 100644 --- a/pkg/resourcehandlers/git/gitfakes/fake_file_info.go +++ b/pkg/resourcehandlers/git/gitfakes/fake_file_info.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 // Code generated by counterfeiter. DO NOT EDIT. package gitfakes diff --git a/pkg/resourcehandlers/git/gitfakes/fake_file_reader.go b/pkg/resourcehandlers/git/gitfakes/fake_file_reader.go index f1de0338..1dea5b1c 100644 --- a/pkg/resourcehandlers/git/gitfakes/fake_file_reader.go +++ b/pkg/resourcehandlers/git/gitfakes/fake_file_reader.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 // Code generated by counterfeiter. DO NOT EDIT. package gitfakes diff --git a/pkg/resourcehandlers/github/githubGinko_resource_handler_test.go b/pkg/resourcehandlers/github/githubGinko_resource_handler_test.go index 3b0ec3da..30e8d95d 100644 --- a/pkg/resourcehandlers/github/githubGinko_resource_handler_test.go +++ b/pkg/resourcehandlers/github/githubGinko_resource_handler_test.go @@ -105,34 +105,13 @@ var _ = Describe("Github", func() { w.Write([]byte(fmt.Sprintf(` [ { - "ref": "refs/tags/v0.0.1", - "node_id": "MDM6UmVmMjc3ODAyNDY2OnJlZnMvdGFncy92MC4wLjE=", - "url": "https://api.github.com/repos/gardener/docforge/git/refs/tags/v0.0.1", - "object": { - "sha": "c5391f5187af434160c8056f47fbeeaed3670a9d", - "type": "commit", - "url": "https://api.github.com/repos/gardener/docforge/git/commits/c5391f5187af434160c8056f47fbeeaed3670a9d" - } + "ref": "refs/tags/v0.0.1" }, { - "ref": "refs/tags/v0.1.0", - "node_id": "MDM6UmVmMjc3ODAyNDY2OnJlZnMvdGFncy92MC4xLjA=", - "url": "https://api.github.com/repos/gardener/docforge/git/refs/tags/v0.1.0", - "object": { - "sha": "6bd668f2353f7ae6cddab09ef1434defe6431b89", - "type": "commit", - "url": "https://api.github.com/repos/gardener/docforge/git/commits/6bd668f2353f7ae6cddab09ef1434defe6431b89" - } + "ref": "refs/tags/v0.1.0" }, { - "ref": "refs/tags/v0.2.0", - "node_id": "MDM6UmVmMjc3ODAyNDY2OnJlZnMvdGFncy92MC4yLjA=", - "url": "https://api.github.com/repos/gardener/docforge/git/refs/tags/v0.2.0", - "object": { - "sha": "183554163eb56886860ba40af0c4b121379d4459", - "type": "commit", - "url": "https://api.github.com/repos/gardener/docforge/git/commits/183554163eb56886860ba40af0c4b121379d4459" - } + "ref": "refs/tags/v0.2.0" } ]`))) }) @@ -213,556 +192,24 @@ var _ = Describe("Github", func() { w.Write([]byte(fmt.Sprintf(` [ { - "ref": "refs/tags/v4.9", - "node_id": "MDM6UmVmMjc3ODAyNDY2OnJlZnMvdGFncy92MC4wLjE=", - "url": "https://api.github.com/repos/gardener/docforge/git/refs/tags/v4.9", - "object": { - "sha": "c5391f5187af434160c8056f47fbeeaed3670a9d", - "type": "commit", - "url": "https://api.github.com/repos/gardener/docforge/git/commits/c5391f5187af434160c8056f47fbeeaed3670a9d" - } + "ref": "refs/tags/v4.9" }, { - "ref": "refs/tags/v5.7", - "node_id": "MDM6UmVmMjc3ODAyNDY2OnJlZnMvdGFncy92MC4xLjA=", - "url": "https://api.github.com/repos/gardener/docforge/git/refs/tags/v5.7", - "object": { - "sha": "6bd668f2353f7ae6cddab09ef1434defe6431b89", - "type": "commit", - "url": "https://api.github.com/repos/gardener/docforge/git/commits/6bd668f2353f7ae6cddab09ef1434defe6431b89" - } + "ref": "refs/tags/v5.7" }, { - "ref": "refs/tags/v6.1", - "node_id": "MDM6UmVmMjc3ODAyNDY2OnJlZnMvdGFncy92MC4yLjA=", - "url": "https://api.github.com/repos/gardener/docforge/git/refs/tags/v6.1", - "object": { - "sha": "183554163eb56886860ba40af0c4b121379d4459", - "type": "commit", - "url": "https://api.github.com/repos/gardener/docforge/git/commits/183554163eb56886860ba40af0c4b121379d4459" - } + "ref": "refs/tags/v6.1" }, { - "ref": "refs/tags/v7.7", - "node_id": "MDM6UmVmMjc3ODAyNDY2OnJlZnMvdGFncy92MC4yLjA=", - "url": "https://api.github.com/repos/gardener/docforge/git/refs/tags/v7.7", - "object": { - "sha": "183554163eb56886860ba40af0c4b121379d4459", - "type": "commit", - "url": "https://api.github.com/repos/gardener/docforge/git/commits/183554163eb56886860ba40af0c4b121379d4459" - } + "ref": "refs/tags/v7.7" } ]`))) }) mux.HandleFunc("/repos/testOrg/testRepo", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(fmt.Sprintf(` - { - "id": 1296269, - "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", - "name": "Hello-World", - "full_name": "octocat/Hello-World", - "owner": { - "login": "octocat", - "id": 1, - "node_id": "MDQ6VXNlcjE=", - "avatar_url": "https://github.com/images/error/octocat_happy.gif", - "gravatar_id": "", - "url": "https://api.github.com/users/octocat", - "html_url": "https://github.com/octocat", - "followers_url": "https://api.github.com/users/octocat/followers", - "following_url": "https://api.github.com/users/octocat/following{/other_user}", - "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", - "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", - "organizations_url": "https://api.github.com/users/octocat/orgs", - "repos_url": "https://api.github.com/users/octocat/repos", - "events_url": "https://api.github.com/users/octocat/events{/privacy}", - "received_events_url": "https://api.github.com/users/octocat/received_events", - "type": "User", - "site_admin": false - }, - "private": false, - "html_url": "https://github.com/octocat/Hello-World", - "description": "This your first repo!", - "fork": false, - "url": "https://api.github.com/repos/octocat/Hello-World", - "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", - "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", - "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", - "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", - "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", - "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", - "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", - "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", - "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", - "events_url": "https://api.github.com/repos/octocat/Hello-World/events", - "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", - "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", - "git_url": "git:github.com/octocat/Hello-World.git", - "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", - "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", - "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", - "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", - "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", - "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", - "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", - "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", - "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", - "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", - "ssh_url": "git@github.com:octocat/Hello-World.git", - "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", - "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", - "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", - "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", - "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", - "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", - "clone_url": "https://github.com/octocat/Hello-World.git", - "mirror_url": "git:git.example.com/octocat/Hello-World", - "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks", - "svn_url": "https://svn.github.com/octocat/Hello-World", - "homepage": "https://github.com", - "language": null, - "forks_count": 9, - "forks": 9, - "stargazers_count": 80, - "watchers_count": 80, - "watchers": 80, - "size": 108, - "default_branch": "testMainBranch", - "open_issues_count": 0, - "open_issues": 0, - "is_template": false, - "topics": [ - "octocat", - "atom", - "electron", - "api" - ], - "has_issues": true, - "has_projects": true, - "has_wiki": true, - "has_pages": false, - "has_downloads": true, - "archived": false, - "disabled": false, - "visibility": "public", - "pushed_at": "2011-01-26T19:06:43Z", - "created_at": "2011-01-26T19:01:12Z", - "updated_at": "2011-01-26T19:14:43Z", - "permissions": { - "pull": true, - "push": false, - "admin": false - }, - "allow_rebase_merge": true, - "template_repository": { - "id": 1296269, - "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", - "name": "Hello-World-Template", - "full_name": "octocat/Hello-World-Template", - "owner": { - "login": "octocat", - "id": 1, - "node_id": "MDQ6VXNlcjE=", - "avatar_url": "https://github.com/images/error/octocat_happy.gif", - "gravatar_id": "", - "url": "https://api.github.com/users/octocat", - "html_url": "https://github.com/octocat", - "followers_url": "https://api.github.com/users/octocat/followers", - "following_url": "https://api.github.com/users/octocat/following{/other_user}", - "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", - "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", - "organizations_url": "https://api.github.com/users/octocat/orgs", - "repos_url": "https://api.github.com/users/octocat/repos", - "events_url": "https://api.github.com/users/octocat/events{/privacy}", - "received_events_url": "https://api.github.com/users/octocat/received_events", - "type": "User", - "site_admin": false - }, - "private": false, - "html_url": "https://github.com/octocat/Hello-World-Template", - "description": "This your first repo!", - "fork": false, - "url": "https://api.github.com/repos/octocat/Hello-World-Template", - "archive_url": "https://api.github.com/repos/octocat/Hello-World-Template/{archive_format}{/ref}", - "assignees_url": "https://api.github.com/repos/octocat/Hello-World-Template/assignees{/user}", - "blobs_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/octocat/Hello-World-Template/branches{/branch}", - "collaborators_url": "https://api.github.com/repos/octocat/Hello-World-Template/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/octocat/Hello-World-Template/comments{/number}", - "commits_url": "https://api.github.com/repos/octocat/Hello-World-Template/commits{/sha}", - "compare_url": "https://api.github.com/repos/octocat/Hello-World-Template/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/octocat/Hello-World-Template/contents/{+path}", - "contributors_url": "https://api.github.com/repos/octocat/Hello-World-Template/contributors", - "deployments_url": "https://api.github.com/repos/octocat/Hello-World-Template/deployments", - "downloads_url": "https://api.github.com/repos/octocat/Hello-World-Template/downloads", - "events_url": "https://api.github.com/repos/octocat/Hello-World-Template/events", - "forks_url": "https://api.github.com/repos/octocat/Hello-World-Template/forks", - "git_commits_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/tags{/sha}", - "git_url": "git:github.com/octocat/Hello-World-Template.git", - "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues/events{/number}", - "issues_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues{/number}", - "keys_url": "https://api.github.com/repos/octocat/Hello-World-Template/keys{/key_id}", - "labels_url": "https://api.github.com/repos/octocat/Hello-World-Template/labels{/name}", - "languages_url": "https://api.github.com/repos/octocat/Hello-World-Template/languages", - "merges_url": "https://api.github.com/repos/octocat/Hello-World-Template/merges", - "milestones_url": "https://api.github.com/repos/octocat/Hello-World-Template/milestones{/number}", - "notifications_url": "https://api.github.com/repos/octocat/Hello-World-Template/notifications{?since,all,participating}", - "pulls_url": "https://api.github.com/repos/octocat/Hello-World-Template/pulls{/number}", - "releases_url": "https://api.github.com/repos/octocat/Hello-World-Template/releases{/id}", - "ssh_url": "git@github.com:octocat/Hello-World-Template.git", - "stargazers_url": "https://api.github.com/repos/octocat/Hello-World-Template/stargazers", - "statuses_url": "https://api.github.com/repos/octocat/Hello-World-Template/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/octocat/Hello-World-Template/subscribers", - "subscription_url": "https://api.github.com/repos/octocat/Hello-World-Template/subscription", - "tags_url": "https://api.github.com/repos/octocat/Hello-World-Template/tags", - "teams_url": "https://api.github.com/repos/octocat/Hello-World-Template/teams", - "trees_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/trees{/sha}", - "clone_url": "https://github.com/octocat/Hello-World-Template.git", - "mirror_url": "git:git.example.com/octocat/Hello-World-Template", - "hooks_url": "https://api.github.com/repos/octocat/Hello-World-Template/hooks", - "svn_url": "https://svn.github.com/octocat/Hello-World-Template", - "homepage": "https://github.com", - "language": null, - "forks": 9, - "forks_count": 9, - "stargazers_count": 80, - "watchers_count": 80, - "watchers": 80, - "size": 108, - "default_branch": "master", - "open_issues": 0, - "open_issues_count": 0, - "is_template": true, - "license": { - "key": "mit", - "name": "MIT License", - "url": "https://api.github.com/licenses/mit", - "spdx_id": "MIT", - "node_id": "MDc6TGljZW5zZW1pdA==", - "html_url": "https://api.github.com/licenses/mit" - }, - "topics": [ - "octocat", - "atom", - "electron", - "api" - ], - "has_issues": true, - "has_projects": true, - "has_wiki": true, - "has_pages": false, - "has_downloads": true, - "archived": false, - "disabled": false, - "visibility": "public", - "pushed_at": "2011-01-26T19:06:43Z", - "created_at": "2011-01-26T19:01:12Z", - "updated_at": "2011-01-26T19:14:43Z", - "permissions": { - "admin": false, - "push": false, - "pull": true - }, - "allow_rebase_merge": true, - "temp_clone_token": "dummy", - "allow_squash_merge": true, - "allow_auto_merge": false, - "delete_branch_on_merge": true, - "allow_merge_commit": true, - "subscribers_count": 42, - "network_count": 0 - }, - "temp_clone_token": "dummy", - "allow_squash_merge": true, - "allow_auto_merge": false, - "delete_branch_on_merge": true, - "allow_merge_commit": true, - "subscribers_count": 42, - "network_count": 0, - "license": { - "key": "mit", - "name": "MIT License", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit", - "node_id": "MDc6TGljZW5zZW1pdA==" - }, - "organization": { - "login": "octocat", - "id": 1, - "node_id": "MDQ6VXNlcjE=", - "avatar_url": "https://github.com/images/error/octocat_happy.gif", - "gravatar_id": "", - "url": "https://api.github.com/users/octocat", - "html_url": "https://github.com/octocat", - "followers_url": "https://api.github.com/users/octocat/followers", - "following_url": "https://api.github.com/users/octocat/following{/other_user}", - "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", - "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", - "organizations_url": "https://api.github.com/users/octocat/orgs", - "repos_url": "https://api.github.com/users/octocat/repos", - "events_url": "https://api.github.com/users/octocat/events{/privacy}", - "received_events_url": "https://api.github.com/users/octocat/received_events", - "type": "Organization", - "site_admin": false - }, - "parent": { - "id": 1296269, - "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", - "name": "Hello-World", - "full_name": "octocat/Hello-World", - "owner": { - "login": "octocat", - "id": 1, - "node_id": "MDQ6VXNlcjE=", - "avatar_url": "https://github.com/images/error/octocat_happy.gif", - "gravatar_id": "", - "url": "https://api.github.com/users/octocat", - "html_url": "https://github.com/octocat", - "followers_url": "https://api.github.com/users/octocat/followers", - "following_url": "https://api.github.com/users/octocat/following{/other_user}", - "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", - "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", - "organizations_url": "https://api.github.com/users/octocat/orgs", - "repos_url": "https://api.github.com/users/octocat/repos", - "events_url": "https://api.github.com/users/octocat/events{/privacy}", - "received_events_url": "https://api.github.com/users/octocat/received_events", - "type": "User", - "site_admin": false - }, - "private": false, - "html_url": "https://github.com/octocat/Hello-World", - "description": "This your first repo!", - "fork": false, - "url": "https://api.github.com/repos/octocat/Hello-World", - "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", - "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", - "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", - "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", - "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", - "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", - "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", - "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", - "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", - "events_url": "https://api.github.com/repos/octocat/Hello-World/events", - "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", - "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", - "git_url": "git:github.com/octocat/Hello-World.git", - "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", - "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", - "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", - "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", - "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", - "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", - "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", - "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", - "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", - "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", - "ssh_url": "git@github.com:octocat/Hello-World.git", - "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", - "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", - "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", - "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", - "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", - "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", - "clone_url": "https://github.com/octocat/Hello-World.git", - "mirror_url": "git:git.example.com/octocat/Hello-World", - "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks", - "svn_url": "https://svn.github.com/octocat/Hello-World", - "homepage": "https://github.com", - "language": null, - "forks_count": 9, - "stargazers_count": 80, - "watchers_count": 80, - "size": 108, - "default_branch": "master", - "open_issues_count": 0, - "is_template": true, - "topics": [ - "octocat", - "atom", - "electron", - "api" - ], - "has_issues": true, - "has_projects": true, - "has_wiki": true, - "has_pages": false, - "has_downloads": true, - "archived": false, - "disabled": false, - "visibility": "public", - "pushed_at": "2011-01-26T19:06:43Z", - "created_at": "2011-01-26T19:01:12Z", - "updated_at": "2011-01-26T19:14:43Z", - "permissions": { - "admin": false, - "push": false, - "pull": true - }, - "allow_rebase_merge": true, - "temp_clone_token": "dummy", - "allow_squash_merge": true, - "allow_auto_merge": false, - "delete_branch_on_merge": true, - "allow_merge_commit": true, - "subscribers_count": 42, - "network_count": 0, - "license": { - "key": "mit", - "name": "MIT License", - "url": "https://api.github.com/licenses/mit", - "spdx_id": "MIT", - "node_id": "MDc6TGljZW5zZW1pdA==", - "html_url": "https://api.github.com/licenses/mit" - }, - "forks": 1, - "open_issues": 1, - "watchers": 1 - }, - "source": { - "id": 1296269, - "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", - "name": "Hello-World", - "full_name": "octocat/Hello-World", - "owner": { - "login": "octocat", - "id": 1, - "node_id": "MDQ6VXNlcjE=", - "avatar_url": "https://github.com/images/error/octocat_happy.gif", - "gravatar_id": "", - "url": "https://api.github.com/users/octocat", - "html_url": "https://github.com/octocat", - "followers_url": "https://api.github.com/users/octocat/followers", - "following_url": "https://api.github.com/users/octocat/following{/other_user}", - "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", - "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", - "organizations_url": "https://api.github.com/users/octocat/orgs", - "repos_url": "https://api.github.com/users/octocat/repos", - "events_url": "https://api.github.com/users/octocat/events{/privacy}", - "received_events_url": "https://api.github.com/users/octocat/received_events", - "type": "User", - "site_admin": false - }, - "private": false, - "html_url": "https://github.com/octocat/Hello-World", - "description": "This your first repo!", - "fork": false, - "url": "https://api.github.com/repos/octocat/Hello-World", - "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", - "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", - "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", - "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", - "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", - "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", - "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", - "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", - "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", - "events_url": "https://api.github.com/repos/octocat/Hello-World/events", - "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", - "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", - "git_url": "git:github.com/octocat/Hello-World.git", - "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", - "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", - "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", - "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", - "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", - "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", - "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", - "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", - "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", - "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", - "ssh_url": "git@github.com:octocat/Hello-World.git", - "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", - "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", - "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", - "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", - "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", - "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", - "clone_url": "https://github.com/octocat/Hello-World.git", - "mirror_url": "git:git.example.com/octocat/Hello-World", - "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks", - "svn_url": "https://svn.github.com/octocat/Hello-World", - "homepage": "https://github.com", - "language": null, - "forks_count": 9, - "stargazers_count": 80, - "watchers_count": 80, - "size": 108, - "default_branch": "master", - "open_issues_count": 0, - "is_template": true, - "topics": [ - "octocat", - "atom", - "electron", - "api" - ], - "has_issues": true, - "has_projects": true, - "has_wiki": true, - "has_pages": false, - "has_downloads": true, - "archived": false, - "disabled": false, - "visibility": "public", - "pushed_at": "2011-01-26T19:06:43Z", - "created_at": "2011-01-26T19:01:12Z", - "updated_at": "2011-01-26T19:14:43Z", - "permissions": { - "admin": false, - "push": false, - "pull": true - }, - "allow_rebase_merge": true, - "temp_clone_token": "dummy", - "allow_squash_merge": true, - "allow_auto_merge": false, - "delete_branch_on_merge": true, - "allow_merge_commit": true, - "subscribers_count": 42, - "network_count": 0, - "license": { - "key": "mit", - "name": "MIT License", - "url": "https://api.github.com/licenses/mit", - "spdx_id": "MIT", - "node_id": "MDc6TGljZW5zZW1pdA==", - "html_url": "https://api.github.com/licenses/mit" - }, - "forks": 1, - "open_issues": 1, - "watchers": 1 - } - }`))) + { + "default_branch": "testMainBranch" + }`))) }) } diff --git a/pkg/resourcehandlers/resource_handlers.go b/pkg/resourcehandlers/resource_handlers.go index e76fdb12..40f40985 100644 --- a/pkg/resourcehandlers/resource_handlers.go +++ b/pkg/resourcehandlers/resource_handlers.go @@ -4,14 +4,15 @@ package resourcehandlers -//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate +//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate -header ../../license_prefix.txt import ( "context" "fmt" + "reflect" + "github.com/gardener/docforge/pkg/api" "github.com/gardener/docforge/pkg/util/httpclient" - "reflect" ) // ErrResourceNotFound indicated that a resource was not found diff --git a/pkg/resourcehandlers/resourcehandlersfakes/fake_registry.go b/pkg/resourcehandlers/resourcehandlersfakes/fake_registry.go index 2083bee4..176bb7ab 100644 --- a/pkg/resourcehandlers/resourcehandlersfakes/fake_registry.go +++ b/pkg/resourcehandlers/resourcehandlersfakes/fake_registry.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 // Code generated by counterfeiter. DO NOT EDIT. package resourcehandlersfakes diff --git a/pkg/resourcehandlers/resourcehandlersfakes/fake_resource_handler.go b/pkg/resourcehandlers/resourcehandlersfakes/fake_resource_handler.go index 31c83cfc..e9450fd2 100644 --- a/pkg/resourcehandlers/resourcehandlersfakes/fake_resource_handler.go +++ b/pkg/resourcehandlers/resourcehandlersfakes/fake_resource_handler.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 // Code generated by counterfeiter. DO NOT EDIT. package resourcehandlersfakes diff --git a/pkg/util/httpclient/client.go b/pkg/util/httpclient/client.go index a1a88ec6..e3b36db8 100644 --- a/pkg/util/httpclient/client.go +++ b/pkg/util/httpclient/client.go @@ -4,7 +4,7 @@ package httpclient -//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate +//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate -header ../../../license_prefix.txt import "net/http" diff --git a/pkg/util/httpclient/httpclientfakes/fake_client.go b/pkg/util/httpclient/httpclientfakes/fake_client.go index bd349324..1e219c30 100644 --- a/pkg/util/httpclient/httpclientfakes/fake_client.go +++ b/pkg/util/httpclient/httpclientfakes/fake_client.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 // Code generated by counterfeiter. DO NOT EDIT. package httpclientfakes diff --git a/pkg/writers/writers.go b/pkg/writers/writers.go index c50af5d3..4b310933 100644 --- a/pkg/writers/writers.go +++ b/pkg/writers/writers.go @@ -4,7 +4,7 @@ package writers -//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate +//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate -header ../../license_prefix.txt import "github.com/gardener/docforge/pkg/api" diff --git a/pkg/writers/writersfakes/fake_writer.go b/pkg/writers/writersfakes/fake_writer.go index c07f3b8d..68bf685c 100644 --- a/pkg/writers/writersfakes/fake_writer.go +++ b/pkg/writers/writersfakes/fake_writer.go @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 // Code generated by counterfeiter. DO NOT EDIT. package writersfakes