-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add a pending status for apply when running plan command (#2053)
* add a pending status for apply when running plan command * fix status updater logic, we should only update the status after we check if the PR is mergeable like the doc next to it says * do not dismiss the PR if the only our "atlantis/apply" status is pending/failing * fix logic and tests * linting
- Loading branch information
1 parent
534ccb0
commit 1a7cc36
Showing
6 changed files
with
297 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
server/events/vcs/fixtures/github-commit-status-empty.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"state": "pending", | ||
"statuses": [ | ||
|
||
], | ||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e", | ||
"total_count": 0, | ||
"repository": { | ||
"id": 1296269, | ||
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", | ||
"name": "Hello-World", | ||
"full_name": "octocat/Hello-World", | ||
"private": false, | ||
"owner": { | ||
"login": "octocat", | ||
"id": 583231, | ||
"node_id": "MDQ6VXNlcjU4MzIzMQ==", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4", | ||
"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 | ||
}, | ||
"html_url": "https://github.com/octocat/Hello-World", | ||
"description": "My first repository on GitHub!", | ||
"fork": false, | ||
"url": "https://api.github.com/repos/octocat/Hello-World", | ||
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", | ||
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", | ||
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", | ||
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", | ||
"hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks", | ||
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", | ||
"events_url": "https://api.github.com/repos/octocat/Hello-World/events", | ||
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", | ||
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", | ||
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", | ||
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", | ||
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", | ||
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", | ||
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", | ||
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", | ||
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", | ||
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", | ||
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", | ||
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", | ||
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", | ||
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", | ||
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", | ||
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", | ||
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", | ||
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", | ||
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", | ||
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", | ||
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", | ||
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", | ||
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", | ||
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", | ||
"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}", | ||
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", | ||
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", | ||
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments" | ||
}, | ||
"commit_url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e", | ||
"url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/status" | ||
} |
148 changes: 148 additions & 0 deletions
148
server/events/vcs/fixtures/github-commit-status-full.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
{ | ||
"state": "blocked", | ||
"statuses": [ | ||
{ | ||
"url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4", | ||
"id": 16230299674, | ||
"node_id": "SC_kwDOFRFvL88AAAADx2a4Gg", | ||
"state": "success", | ||
"description": "Plan succeeded.", | ||
"target_url": "https://localhost/jobs/octocat/Hello-World/1/project1", | ||
"context": "atlantis/plan: project1", | ||
"created_at": "2022-02-10T15:26:01Z", | ||
"updated_at": "2022-02-10T15:26:01Z" | ||
}, | ||
{ | ||
"url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4", | ||
"id": 16230303174, | ||
"node_id": "SC_kwDOFRFvL88AAAADx2bFxg", | ||
"state": "success", | ||
"description": "Plan succeeded.", | ||
"target_url": "https://localhost/jobs/octocat/Hello-World/1/project2", | ||
"context": "atlantis/plan: project2", | ||
"created_at": "2022-02-10T15:26:12Z", | ||
"updated_at": "2022-02-10T15:26:12Z" | ||
}, | ||
{ | ||
"url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4", | ||
"id": 16230303679, | ||
"node_id": "SC_kwDOFRFvL88AAAADx2bHvw", | ||
"state": "success", | ||
"description": "2/2 projects planned successfully.", | ||
"target_url": "", | ||
"context": "atlantis/plan", | ||
"created_at": "2022-02-10T15:26:13Z", | ||
"updated_at": "2022-02-10T15:26:13Z" | ||
}, | ||
{ | ||
"url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4", | ||
"id": 16230307923, | ||
"node_id": "SC_kwDOFRFvL88AAAADx2bYUw", | ||
"state": "failure", | ||
"description": "Apply failed.", | ||
"target_url": "https://localhost/jobs/octocat/Hello-World/1/project1", | ||
"context": "atlantis/apply: project1", | ||
"created_at": "2022-02-10T15:26:27Z", | ||
"updated_at": "2022-02-10T15:26:27Z" | ||
}, | ||
{ | ||
"url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4", | ||
"id": 16230308153, | ||
"node_id": "SC_kwDOFRFvL88AAAADx2bZOQ", | ||
"state": "failure", | ||
"description": "Apply failed.", | ||
"target_url": "https://localhost/jobs/octocat/Hello-World/1/project2", | ||
"context": "atlantis/apply: project2", | ||
"created_at": "2022-02-10T15:26:27Z", | ||
"updated_at": "2022-02-10T15:26:27Z" | ||
}, | ||
{ | ||
"url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4", | ||
"id": 16230308528, | ||
"node_id": "SC_kwDOFRFvL88AAAADx2basA", | ||
"state": "failure", | ||
"description": "0/2 projects applied successfully.", | ||
"target_url": "", | ||
"context": "atlantis/apply", | ||
"created_at": "2022-02-10T15:26:28Z", | ||
"updated_at": "2022-02-10T15:26:28Z" | ||
} | ||
], | ||
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e", | ||
"total_count": 0, | ||
"repository": { | ||
"id": 1296269, | ||
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", | ||
"name": "Hello-World", | ||
"full_name": "octocat/Hello-World", | ||
"private": false, | ||
"owner": { | ||
"login": "octocat", | ||
"id": 583231, | ||
"node_id": "MDQ6VXNlcjU4MzIzMQ==", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4", | ||
"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 | ||
}, | ||
"html_url": "https://github.com/octocat/Hello-World", | ||
"description": "My first repository on GitHub!", | ||
"fork": false, | ||
"url": "https://api.github.com/repos/octocat/Hello-World", | ||
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", | ||
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", | ||
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", | ||
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", | ||
"hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks", | ||
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", | ||
"events_url": "https://api.github.com/repos/octocat/Hello-World/events", | ||
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", | ||
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", | ||
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", | ||
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", | ||
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", | ||
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", | ||
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", | ||
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", | ||
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", | ||
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", | ||
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", | ||
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", | ||
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", | ||
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", | ||
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", | ||
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", | ||
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", | ||
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", | ||
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", | ||
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", | ||
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", | ||
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", | ||
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", | ||
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", | ||
"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}", | ||
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", | ||
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", | ||
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments" | ||
}, | ||
"commit_url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e", | ||
"url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/status" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.