Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #957 #983

Merged
merged 10 commits into from
Apr 28, 2020
Merged

Fixes #957 #983

merged 10 commits into from
Apr 28, 2020

Conversation

mcdafydd
Copy link
Contributor

@mcdafydd mcdafydd commented Apr 9, 2020

How does this look for a solution to this issue?

@jpreese
Copy link
Contributor

jpreese commented Apr 10, 2020

Definitely gets the job done! Looking forward to this one getting released.

I will say it does feel a bit cleaner to have each VCS client define their own pull request link format. Thinking ahead, I would have concerns about littering checks/tests/etc that are specific to a single VCS.

In this case it's probably overkill to let a VCS define their own ProjectLocker, because the only difference is the PR link. Maybe its something we add into the VCSHost struct as it should be global for the entire VCS, and then the DefaultProjectLocker just uses that.

@cket cket mentioned this pull request Apr 10, 2020
@mcdafydd
Copy link
Contributor Author

Good point. I'll look into something a bit more general.

@lkysow
Copy link
Member

lkysow commented Apr 16, 2020

Yeah this was an issue waiting to happen because it's coupled the error message with the markdown linking method of the VCS.

Let's make vcs.Client a field of ProjectLocker and add a new method to the interface: MarkdownPullLink(pullNum int) string that is implemented by all the vcs clients.

This can then be used by the project locker:

		link := p.VCSClient.MarkdownPullLink(lockAttempt.CurrLock.Pull.Num)
		failureMsg := fmt.Sprintf(
			"This project is currently locked by an unapplied plan from pull %s. To continue, delete the lock from %s or apply that plan and merge the pull request.\n\nOnce the lock is released, comment `atlantis plan` here to re-plan.",
			link,
			link)

@lkysow lkysow added the waiting-on-response Waiting for a response from the user label Apr 16, 2020
Copy link
Member

@lkysow lkysow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. You'll probably need to rebase off master to get the tests passing.

@mcdafydd
Copy link
Contributor Author

Sorry for the messy PR if there's a better way to rebase in this case.

I'm getting some local errors trying to regen the mock client. Hopefully, I will sort this out quickly and push a fix.

@jpreese
Copy link
Contributor

jpreese commented Apr 21, 2020

No worries, I always lean on my good friend squash merge. 😄

@mcdafydd
Copy link
Contributor Author

Sorry for the delay on this. I should be able to wrap it up this weekend.

@codecov
Copy link

codecov bot commented Apr 27, 2020

Codecov Report

Merging #983 into master will decrease coverage by 0.01%.
The diff coverage is 72.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #983      +/-   ##
==========================================
- Coverage   71.98%   71.96%   -0.02%     
==========================================
  Files          65       65              
  Lines        5411     5429      +18     
==========================================
+ Hits         3895     3907      +12     
- Misses       1210     1215       +5     
- Partials      306      307       +1     
Impacted Files Coverage Δ
server/events/vcs/not_configured_vcs_client.go 0.00% <0.00%> (ø)
server/events/vcs/proxy.go 0.00% <0.00%> (ø)
server/events/project_locker.go 82.60% <66.66%> (-7.40%) ⬇️
server/events/vcs/azuredevops_client.go 66.82% <100.00%> (+0.32%) ⬆️
server/events/vcs/bitbucketcloud/client.go 47.40% <100.00%> (+0.79%) ⬆️
server/events/vcs/bitbucketserver/client.go 35.63% <100.00%> (+0.74%) ⬆️
server/events/vcs/github_client.go 80.70% <100.00%> (+0.22%) ⬆️
server/events/vcs/gitlab_client.go 39.66% <100.00%> (+1.01%) ⬆️
server/server.go 63.77% <100.00%> (+0.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fea1891...86cf4d3. Read the comment docs.

Copy link
Member

@lkysow lkysow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there

server/events/project_locker_test.go Outdated Show resolved Hide resolved
Co-Authored-By: Luke Kysow <1034429+lkysow@users.noreply.github.com>
@mcdafydd
Copy link
Contributor Author

Sounds good, thanks!

@lkysow lkysow merged commit 86cf4d3 into runatlantis:master Apr 28, 2020
@mcdafydd mcdafydd deleted the azdo-957 branch May 2, 2020 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-response Waiting for a response from the user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants