-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: add configurable branches for gitlab target manager #182
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK, but some things should change as they introduce some complexity we don't need.
I think the biggest problem IMO here is, that we're using the interface in the target manager. The target manager should just have a config; this would have been the gitlab.Config now. Then there would be no need to change the Bytes()
to Serialize(branch string)
, as the target manager would know which branch it's supposed to talk to.
We introduced the abstraction way too soo with no concrete use case. Please let's stop doing this; we've already done a major cleanup on the code base almost a year ago, because it had many premature abstractions which got in the way of our requirements.
Yeah I've also thought about this and maybe we should move some of the additional attributes of the |
* refactor: simplify error handling * refactor: use unnamed return values * chore: rm special error handling case in favor of comment on special case
That's exactly what it should do, well said. The I'm afraid that's that exactly the problem: the added layer of abstraction with the I suggest we discuss this in a smaller circle with @y-eight the next couple of days and see how to move on from here. Since we're mostly expecting people to primarily use Gitlab/ Github to registrer their targets, we should also strive to achieve to facilitate this. I'm pretty sure two different implementations of a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll keep the remote interactor, as discussed, and talk again if we need to change something in this part of the codebase.
Motivation
Closes #179
Changes
I've added a configuration option to let the user set the branch to use.
Additional to that, I've also improved error handling of response body close errors and refactored the gitlab interactor to use the (*slog.Logger).*Context methods.
For additional information look at the commits.
Tests done
Manual E2E tests
Registration Repository
Branch set to
main
Logs:
Repository commits:
![image](https://private-user-images.githubusercontent.com/75443136/364778110-3d076d8b-3950-4768-ae9b-1c62924f75ad.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NzU0NjQsIm5iZiI6MTczOTU3NTE2NCwicGF0aCI6Ii83NTQ0MzEzNi8zNjQ3NzgxMTAtM2QwNzZkOGItMzk1MC00NzY4LWFlOWItMWM2MjkyNGY3NWFkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDIzMTkyNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI0YWE2NDQ5MDNjMmVmNmYxMDMwZmQxNGYzZWUxOTZhMjBjNDczZWFiMTcyOGFkNmMyZTA5NjQ1ZTk2MjRiMzYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.ucL-Bgir4aQO82_O476OLfwYPbdDxnaDQ9Ka4wTvtys)
Branch set to
registry
Logs:
Repository commits:
![image](https://private-user-images.githubusercontent.com/75443136/364780671-cb3492a5-da0d-4e76-93a3-a8b14e9b2ca1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NzU0NjQsIm5iZiI6MTczOTU3NTE2NCwicGF0aCI6Ii83NTQ0MzEzNi8zNjQ3ODA2NzEtY2IzNDkyYTUtZGEwZC00ZTc2LTkzYTMtYThiMTRlOWIyY2ExLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDIzMTkyNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY5ZmVlNDdhNDM1NDE3ODMyODE4NjUwZjNlYjhhMmUxYWNmNDkxZjg3NDU5YWNjODk3OGQwNGFlZTc5YTI0YzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.sRLV-y76A1j-jMaLfsW2afmvsaccXdMjYe_NP2QaHuQ)
No branch configured (defaults to the default branch of the repository)
Logs:
Repository commits:
![image](https://private-user-images.githubusercontent.com/75443136/364782611-e3ea017c-b6b6-4804-9e8d-ef166f5c85f4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NzU0NjQsIm5iZiI6MTczOTU3NTE2NCwicGF0aCI6Ii83NTQ0MzEzNi8zNjQ3ODI2MTEtZTNlYTAxN2MtYjZiNi00ODA0LTllOGQtZWYxNjZmNWM4NWY0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDIzMTkyNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE0YjJiY2U0YmFhMzc2Y2ViN2MyODZkZjkwMTQwOGZlYjAxYTQxZjQ3NmFlZTBhYWIyMzUyMzg5YzQzMjc5NmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.4fayR9exB5HILzSPOt_0yvMUnZxLI3OP4AFURY1HSwQ)
TODO