-
Notifications
You must be signed in to change notification settings - Fork 45
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
Create a Provider (Github/Gitlab) during init and pass it on to other steps #73
Merged
Conversation
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
The high level goal here is to setup the provider once during initialize. After that, all following steps will respect this configuration. 1. created `package lib`, which now holds - `Provider` abstraction (for Github or Gitlab) - `Repo` - allows us to pass along the `Provider` configuration 2. centralized the logic to setup a Github or Gitlab client, in the `Provider`
Version bump only relates to releasing a new version, which can be managed by repo owners after merge to maser.
seems like CODEOWNERS auto-assignment isn't enabled |
This is just a script for local testing. It's not yet used in any CI automation.
github run: ``` ❯ ./integration_test.sh github nuke nuking ./mp [Init] 1 2 [Clone] 2021/03/21 16:30:27 cloning: microplane-test/2 2021/03/21 16:30:27 cloning: microplane-test/1 [Plan] 2021/03/21 16:30:29 planning 2 repos with parallelism limit [10] 2021/03/21 16:30:29 planning: microplane-test/2 2021/03/21 16:30:29 planning: microplane-test/1 [Push] 2021/03/21 16:30:29 pushing: microplane-test/2 2021/03/21 16:30:29 pushing: microplane-test/1 [Merge] 2021/03/21 16:30:36 microplane-test/2 - merging... 2021/03/21 16:30:36 microplane-test/1 - merging... ``` gitlab run ``` ❯ ./integration_test.sh gitlab nuke nuking ./mp [Init] 1 2 [Clone] 2021/03/21 16:31:59 cloning: microplane-gitlab/2 2021/03/21 16:31:59 cloning: microplane-gitlab/1 [Plan] 2021/03/21 16:32:00 planning 2 repos with parallelism limit [10] 2021/03/21 16:32:00 planning: microplane-gitlab/2 2021/03/21 16:32:00 planning: microplane-gitlab/1 [Push] 2021/03/21 16:32:00 pushing: microplane-gitlab/2 2021/03/21 16:32:00 pushing: microplane-gitlab/1 [Merge] 2021/03/21 16:32:06 microplane-gitlab/2 - merging... 2021/03/21 16:32:06 microplane-gitlab/1 - merging... ```
saw errors like: ``` 2021/03/21 16:13:14 multiple errors: POST https://api.github.com/api/v3/api/v4/projects/microplane-gitlab/2/merge_requests: 404 {documentation_url: https://docs.github.com/rest}, {message: Not Found} | POST https://api.github.com/api/v3/api/v4/projects/microplane-gitlab/1/merge_requests: 404 {documentation_url: https://docs.github.com/rest}, {message: Not Found} ```
Caught via newly created integration test! Error looked like: ``` [Push] 2021/03/21 16:13:49 pushing: microplane-gitlab/2 2021/03/21 16:13:49 pushing: microplane-gitlab/1 panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1498e1b] goroutine 7 [running]: github.com/Clever/microplane/push.GitlabPush(0x17084c0, 0xc00002a0b8, 0x19ba470, 0x1, 0xc000026b20, 0x11, 0xc000028240, 0x22, 0xc00002b066, 0x6, ...) /Users/nathanleiby/go/src/github.com/Clever/microplane/push/pushGitlab.go:79 +0x99b github.com/Clever/microplane/cmd.pushOneRepo(0x19ba470, 0x1, 0xc000026b20, 0x11, 0xc000028240, 0x22, 0xc00002b066, 0x6, 0x0, 0x0, ...) /Users/nathanleiby/go/src/github.com/Clever/microplane/cmd/push.go:137 +0x8fc github.com/Clever/microplane/cmd.parallelizeLimited.func1(0xc00007e640, 0x17084c0, 0xc00002a0b8, 0xc00010be00, 0x168cc08, 0x19ba470, 0x1, 0xc000026b20, 0x11, 0xc000028240, ...) /Users/nathanleiby/go/src/github.com/Clever/microplane/cmd/helpers.go:48 +0x11a created by github.com/Clever/microplane/cmd.parallelizeLimited /Users/nathanleiby/go/src/github.com/Clever/microplane/cmd/helpers.go:43 +0x1b8 ```
fixed here e6a3cda |
ghirsch1
approved these changes
Mar 22, 2021
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.
Nice refactoring, and adding the integration test looks awesome!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
JIRA
n/a
Overview
The high level goal here is to setup the provider once during
initialize. After that, all following steps will respect this
configuration.
package lib
, which now holdsProvider
abstraction (for Github or Gitlab)Repo
- allows us to pass along theProvider
configurationProvider
This is also prep work that should help simplify adding Github Enterprise support. #44
provider
andprovider-url
via flags instead of using env vars to determine (1) Github vs Gitlab and (2) whether or not a custom URL is set. SeeREADME.md
regarding Gitlab.NOTE: There's some other cleanup here, apologies for the noise. The key commits for the provider work are:
Testing