diff --git a/cmd/image-builder/config.go b/cmd/image-builder/config.go index 0354051a4c13..0b9e71c489be 100644 --- a/cmd/image-builder/config.go +++ b/cmd/image-builder/config.go @@ -318,6 +318,7 @@ func loadGithubActionsGitState() (GitStateConfig, error) { BaseCommitSHA: commitSHA, BaseCommitRef: gitRef, PullHeadCommitSHA: *payload.MergeGroup.HeadSHA, + isPullRequest: true, }, nil default: diff --git a/cmd/image-builder/config_test.go b/cmd/image-builder/config_test.go index 6957108d60af..97ae9d27aa2f 100644 --- a/cmd/image-builder/config_test.go +++ b/cmd/image-builder/config_test.go @@ -371,12 +371,12 @@ func TestLoadGitStateConfig(t *testing.T) { }, gitState: GitStateConfig{ RepositoryName: "test-infra", - RepositoryOwner: "edplanes", + RepositoryOwner: "kyma-project", JobType: "merge_group", BaseCommitSHA: "659bf74f7b4ecab07d9398eec554217b51bad738", BaseCommitRef: "refs/heads/main", - isPullRequest: false, - PullHeadCommitSHA: "d42c05aa25fc3e8bfff0396086de3fccd4b34c29", + isPullRequest: true, + PullHeadCommitSHA: "e47034172c36d3e5fb407b5ba57adf0f7868599d", }, }, } diff --git a/cmd/image-builder/test_fixture/merge-group_event.json b/cmd/image-builder/test_fixture/merge-group_event.json index 6fc5ff47d753..a94215a060ce 100644 --- a/cmd/image-builder/test_fixture/merge-group_event.json +++ b/cmd/image-builder/test_fixture/merge-group_event.json @@ -1,8 +1,20 @@ { "action": "checks_requested", + "enterprise": { + "avatar_url": "https://avatars.githubusercontent.com/b/4978?v=4", + "created_at": "2020-12-16T23:19:05Z", + "description": "SAP Enterprise Account", + "html_url": "https://github.com/enterprises/sap", + "id": 4978, + "name": "SAP", + "node_id": "MDEwOkVudGVycHJpc2U0OTc4", + "slug": "sap", + "updated_at": "2024-06-27T14:56:18Z", + "website_url": "https://sap.com" + }, "merge_group": { - "base_ref": "refs/heads/main", - "base_sha": "659bf74f7b4ecab07d9398eec554217b51bad738", + "base_ref": "refs/heads/test-merge-group", + "base_sha": "4e2379dce4dcce7648c1ae3d7e9f44cf93a2b93d", "head_commit": { "author": { "email": "38684517+KacperMalachowski@users.noreply.github.com", @@ -12,128 +24,134 @@ "email": "noreply@github.com", "name": "GitHub" }, - "id": "d42c05aa25fc3e8bfff0396086de3fccd4b34c29", - "message": "Merge pull request #26 from edplanes/dependabot/github_actions/docker/metadata-action-5.5.1\n\nBump docker/metadata-action from 4.4.0 to 5.5.1", - "timestamp": "2024-11-25T07:51:32Z", - "tree_id": "4e6511450d1f377531c92719edf29974eb28b3f1" + "id": "e47034172c36d3e5fb407b5ba57adf0f7868599d", + "message": "Merge pull request #12387 from KacperMalachowski/test-merge-queue\n\nTest merge queue", + "timestamp": "2024-11-25T09:24:38Z", + "tree_id": "3efa879dafdbeee187d2a3cedb8b7b8dae25e904" }, - "head_ref": "refs/heads/gh-readonly-queue/main/pr-26-659bf74f7b4ecab07d9398eec554217b51bad738", - "head_sha": "d42c05aa25fc3e8bfff0396086de3fccd4b34c29" + "head_ref": "refs/heads/gh-readonly-queue/test-merge-group/pr-12387-4e2379dce4dcce7648c1ae3d7e9f44cf93a2b93d", + "head_sha": "e47034172c36d3e5fb407b5ba57adf0f7868599d" }, "organization": { - "avatar_url": "https://avatars.githubusercontent.com/u/115666164?v=4", - "description": "Open Source Virtual Airline Managment Tool started as university project", - "events_url": "https://api.github.com/orgs/edplanes/events", - "hooks_url": "https://api.github.com/orgs/edplanes/hooks", - "id": 115666164, - "issues_url": "https://api.github.com/orgs/edplanes/issues", - "login": "edplanes", - "members_url": "https://api.github.com/orgs/edplanes/members{/member}", - "node_id": "O_kgDOBuTs9A", - "public_members_url": "https://api.github.com/orgs/edplanes/public_members{/member}", - "repos_url": "https://api.github.com/orgs/edplanes/repos", - "url": "https://api.github.com/orgs/edplanes" + "avatar_url": "https://avatars.githubusercontent.com/u/39153523?v=4", + "description": "A flexible and easy way to connect and extend enterprise applications in a cloud-native world.", + "events_url": "https://api.github.com/orgs/kyma-project/events", + "hooks_url": "https://api.github.com/orgs/kyma-project/hooks", + "id": 39153523, + "issues_url": "https://api.github.com/orgs/kyma-project/issues", + "login": "kyma-project", + "members_url": "https://api.github.com/orgs/kyma-project/members{/member}", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjM5MTUzNTIz", + "public_members_url": "https://api.github.com/orgs/kyma-project/public_members{/member}", + "repos_url": "https://api.github.com/orgs/kyma-project/repos", + "url": "https://api.github.com/orgs/kyma-project" }, "repository": { "allow_forking": true, - "archive_url": "https://api.github.com/repos/edplanes/test-infra/{archive_format}{/ref}", + "archive_url": "https://api.github.com/repos/kyma-project/test-infra/{archive_format}{/ref}", "archived": false, - "assignees_url": "https://api.github.com/repos/edplanes/test-infra/assignees{/user}", - "blobs_url": "https://api.github.com/repos/edplanes/test-infra/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/edplanes/test-infra/branches{/branch}", - "clone_url": "https://github.com/edplanes/test-infra.git", - "collaborators_url": "https://api.github.com/repos/edplanes/test-infra/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/edplanes/test-infra/comments{/number}", - "commits_url": "https://api.github.com/repos/edplanes/test-infra/commits{/sha}", - "compare_url": "https://api.github.com/repos/edplanes/test-infra/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/edplanes/test-infra/contents/{+path}", - "contributors_url": "https://api.github.com/repos/edplanes/test-infra/contributors", - "created_at": "2023-05-25T19:10:09Z", + "assignees_url": "https://api.github.com/repos/kyma-project/test-infra/assignees{/user}", + "blobs_url": "https://api.github.com/repos/kyma-project/test-infra/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/kyma-project/test-infra/branches{/branch}", + "clone_url": "https://github.com/kyma-project/test-infra.git", + "collaborators_url": "https://api.github.com/repos/kyma-project/test-infra/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/kyma-project/test-infra/comments{/number}", + "commits_url": "https://api.github.com/repos/kyma-project/test-infra/commits{/sha}", + "compare_url": "https://api.github.com/repos/kyma-project/test-infra/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/kyma-project/test-infra/contents/{+path}", + "contributors_url": "https://api.github.com/repos/kyma-project/test-infra/contributors", + "created_at": "2018-09-05T09:44:20Z", "custom_properties": {}, "default_branch": "main", - "deployments_url": "https://api.github.com/repos/edplanes/test-infra/deployments", - "description": null, + "deployments_url": "https://api.github.com/repos/kyma-project/test-infra/deployments", + "description": "Test infrastructure for the Kyma project.", "disabled": false, - "downloads_url": "https://api.github.com/repos/edplanes/test-infra/downloads", - "events_url": "https://api.github.com/repos/edplanes/test-infra/events", + "downloads_url": "https://api.github.com/repos/kyma-project/test-infra/downloads", + "events_url": "https://api.github.com/repos/kyma-project/test-infra/events", "fork": false, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/edplanes/test-infra/forks", - "full_name": "edplanes/test-infra", - "git_commits_url": "https://api.github.com/repos/edplanes/test-infra/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/edplanes/test-infra/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/edplanes/test-infra/git/tags{/sha}", - "git_url": "git://github.com/edplanes/test-infra.git", + "forks": 180, + "forks_count": 180, + "forks_url": "https://api.github.com/repos/kyma-project/test-infra/forks", + "full_name": "kyma-project/test-infra", + "git_commits_url": "https://api.github.com/repos/kyma-project/test-infra/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/kyma-project/test-infra/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/kyma-project/test-infra/git/tags{/sha}", + "git_url": "git://github.com/kyma-project/test-infra.git", "has_discussions": false, "has_downloads": true, "has_issues": true, "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/edplanes/test-infra/hooks", - "html_url": "https://github.com/edplanes/test-infra", - "id": 645488158, + "has_projects": false, + "has_wiki": false, + "homepage": "https://status.build.kyma-project.io/", + "hooks_url": "https://api.github.com/repos/kyma-project/test-infra/hooks", + "html_url": "https://github.com/kyma-project/test-infra", + "id": 147495537, "is_template": false, - "issue_comment_url": "https://api.github.com/repos/edplanes/test-infra/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/edplanes/test-infra/issues/events{/number}", - "issues_url": "https://api.github.com/repos/edplanes/test-infra/issues{/number}", - "keys_url": "https://api.github.com/repos/edplanes/test-infra/keys{/key_id}", - "labels_url": "https://api.github.com/repos/edplanes/test-infra/labels{/name}", + "issue_comment_url": "https://api.github.com/repos/kyma-project/test-infra/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/kyma-project/test-infra/issues/events{/number}", + "issues_url": "https://api.github.com/repos/kyma-project/test-infra/issues{/number}", + "keys_url": "https://api.github.com/repos/kyma-project/test-infra/keys{/key_id}", + "labels_url": "https://api.github.com/repos/kyma-project/test-infra/labels{/name}", "language": "Go", - "languages_url": "https://api.github.com/repos/edplanes/test-infra/languages", - "license": null, - "merges_url": "https://api.github.com/repos/edplanes/test-infra/merges", - "milestones_url": "https://api.github.com/repos/edplanes/test-infra/milestones{/number}", + "languages_url": "https://api.github.com/repos/kyma-project/test-infra/languages", + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "node_id": "MDc6TGljZW5zZTI=", + "spdx_id": "Apache-2.0", + "url": "https://api.github.com/licenses/apache-2.0" + }, + "merges_url": "https://api.github.com/repos/kyma-project/test-infra/merges", + "milestones_url": "https://api.github.com/repos/kyma-project/test-infra/milestones{/number}", "mirror_url": null, "name": "test-infra", - "node_id": "R_kgDOJnleHg", - "notifications_url": "https://api.github.com/repos/edplanes/test-infra/notifications{?since,all,participating}", - "open_issues": 6, - "open_issues_count": 6, + "node_id": "MDEwOlJlcG9zaXRvcnkxNDc0OTU1Mzc=", + "notifications_url": "https://api.github.com/repos/kyma-project/test-infra/notifications{?since,all,participating}", + "open_issues": 68, + "open_issues_count": 68, "owner": { - "avatar_url": "https://avatars.githubusercontent.com/u/115666164?v=4", - "events_url": "https://api.github.com/users/edplanes/events{/privacy}", - "followers_url": "https://api.github.com/users/edplanes/followers", - "following_url": "https://api.github.com/users/edplanes/following{/other_user}", - "gists_url": "https://api.github.com/users/edplanes/gists{/gist_id}", + "avatar_url": "https://avatars.githubusercontent.com/u/39153523?v=4", + "events_url": "https://api.github.com/users/kyma-project/events{/privacy}", + "followers_url": "https://api.github.com/users/kyma-project/followers", + "following_url": "https://api.github.com/users/kyma-project/following{/other_user}", + "gists_url": "https://api.github.com/users/kyma-project/gists{/gist_id}", "gravatar_id": "", - "html_url": "https://github.com/edplanes", - "id": 115666164, - "login": "edplanes", - "node_id": "O_kgDOBuTs9A", - "organizations_url": "https://api.github.com/users/edplanes/orgs", - "received_events_url": "https://api.github.com/users/edplanes/received_events", - "repos_url": "https://api.github.com/users/edplanes/repos", + "html_url": "https://github.com/kyma-project", + "id": 39153523, + "login": "kyma-project", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjM5MTUzNTIz", + "organizations_url": "https://api.github.com/users/kyma-project/orgs", + "received_events_url": "https://api.github.com/users/kyma-project/received_events", + "repos_url": "https://api.github.com/users/kyma-project/repos", "site_admin": false, - "starred_url": "https://api.github.com/users/edplanes/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/edplanes/subscriptions", + "starred_url": "https://api.github.com/users/kyma-project/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kyma-project/subscriptions", "type": "Organization", - "url": "https://api.github.com/users/edplanes", + "url": "https://api.github.com/users/kyma-project", "user_view_type": "public" }, "private": false, - "pulls_url": "https://api.github.com/repos/edplanes/test-infra/pulls{/number}", - "pushed_at": "2024-11-25T07:51:47Z", - "releases_url": "https://api.github.com/repos/edplanes/test-infra/releases{/id}", - "size": 150, - "ssh_url": "git@github.com:edplanes/test-infra.git", - "stargazers_count": 0, - "stargazers_url": "https://api.github.com/repos/edplanes/test-infra/stargazers", - "statuses_url": "https://api.github.com/repos/edplanes/test-infra/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/edplanes/test-infra/subscribers", - "subscription_url": "https://api.github.com/repos/edplanes/test-infra/subscription", - "svn_url": "https://github.com/edplanes/test-infra", - "tags_url": "https://api.github.com/repos/edplanes/test-infra/tags", - "teams_url": "https://api.github.com/repos/edplanes/test-infra/teams", + "pulls_url": "https://api.github.com/repos/kyma-project/test-infra/pulls{/number}", + "pushed_at": "2024-11-25T09:18:28Z", + "releases_url": "https://api.github.com/repos/kyma-project/test-infra/releases{/id}", + "size": 46482, + "ssh_url": "git@github.com:kyma-project/test-infra.git", + "stargazers_count": 37, + "stargazers_url": "https://api.github.com/repos/kyma-project/test-infra/stargazers", + "statuses_url": "https://api.github.com/repos/kyma-project/test-infra/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/kyma-project/test-infra/subscribers", + "subscription_url": "https://api.github.com/repos/kyma-project/test-infra/subscription", + "svn_url": "https://github.com/kyma-project/test-infra", + "tags_url": "https://api.github.com/repos/kyma-project/test-infra/tags", + "teams_url": "https://api.github.com/repos/kyma-project/test-infra/teams", "topics": [], - "trees_url": "https://api.github.com/repos/edplanes/test-infra/git/trees{/sha}", - "updated_at": "2024-11-25T07:50:31Z", - "url": "https://api.github.com/repos/edplanes/test-infra", + "trees_url": "https://api.github.com/repos/kyma-project/test-infra/git/trees{/sha}", + "updated_at": "2024-11-25T09:13:39Z", + "url": "https://api.github.com/repos/kyma-project/test-infra", "visibility": "public", - "watchers": 0, - "watchers_count": 0, + "watchers": 37, + "watchers_count": 37, "web_commit_signoff_required": false }, "sender": {