Feature: Create builds directly instead of restarting old builds#73
Feature: Create builds directly instead of restarting old builds#73aknuds1 wants to merge 4 commits intodrone-plugins:v2from
Conversation
|
@aknuds1 can you look at targeting the |
|
@donny-dont Thanks, I wasn't aware. |
|
Will have to fix it up later. |
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
b702b1c to
22807c8
Compare
|
@donny-dont I pushed a revision now that's cleanly based on v2, where I retain the blocking functionality. Please have a look. Also, would you mind explaining the purpose of the v2 branch, and its relation to the master branch? |
donny-dont
left a comment
There was a problem hiding this comment.
Marking up my nits. This particular plugin is widely used so I'm not approving it without consensus from @bradrydzewski and @tboerger
| parts[0], | ||
| ) | ||
| } | ||
|
|
There was a problem hiding this comment.
I don't see any benefit for moving the else if into this block.
There was a problem hiding this comment.
I think it's far more understandable when reading and verifying the code, since it's a pain to get your head around in which exact cases the else block would originally fire. You also get the idiomatic Go error handling, with early return on an error and no corresponding else.
| github.com/drone-plugins/drone-plugin-lib v0.4.0 | ||
| github.com/drone/drone-go v1.4.0 | ||
| github.com/joho/godotenv v1.3.0 | ||
| github.com/stretchr/testify v1.4.0 |
There was a problem hiding this comment.
@tboerger do you have any preferences on go testing modules? I don't have any strong opinions on it all.
There was a problem hiding this comment.
No strong opinion on that, but isn't the standard library enough?
There was a problem hiding this comment.
I can do without it, but it does make error checking in tests far less verbose.
| &cli.BoolFlag{ | ||
| Name: "wait", | ||
| Usage: "Wait for any currently running builds to finish", | ||
| EnvVars: []string{"PLUGIN_WAIT"}, | ||
| Destination: &settings.Wait, | ||
| }, | ||
| &cli.DurationFlag{ | ||
| Name: "timeout", | ||
| Value: time.Duration(60) * time.Second, | ||
| Usage: "How long to wait on any currently running builds", | ||
| EnvVars: []string{"PLUGIN_WAIT_TIMEOUT"}, | ||
| Destination: &settings.Timeout, | ||
| }, |
There was a problem hiding this comment.
Believe @bradrydzewski 's initial ask was that wait and timeout would apply to the triggered build so should probably modify that accordingly.
There was a problem hiding this comment.
See @bradrydzewski ''s comments below at #73 (comment)
| branch string | ||
| ) | ||
|
|
||
| func parseRepoBranch(repo string) (string, string, string, error) { |
There was a problem hiding this comment.
I don't have any strong feelings on the modification to this function but maybe others do @tboerger ?
There was a problem hiding this comment.
I think it's way better to return errors from this function at least, instead of leaving to the caller to surmise an error happened, without having the reason leading up to it.
|
@donny-dont Thanks! Will look into your feedback. |
|
@aknuds1 with regards to the Also remember that |
|
The wait, block and deploy features are important as they are actively used as far as I know. |
|
The |
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
At least by me/ownCloud
Agreed, probably not many people except for me are already using it, but I think it's an important feature and other people will follow once it's released.
Yeah, I tried to make the change non-breaking... which led to having two hard to distinguish options ... but I still like it better than reusing an existing option for a different function :-\ |
|
Its my understanding that |
|
the |
|
if there are concerns about this being a breaking change ...
my recommendation would be that we deprecate and ignore |
|
Having a look at the feedback. |
@bradrydzewski For the sake of clarity, do you want for |
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
| return fmt.Errorf("unable to get last successful build for %s", entry) | ||
| } | ||
| } | ||
| fmt.Printf("deploying Drone build #%d of repo %s/%s\n", build.Number, owner, name) |
There was a problem hiding this comment.
@bradrydzewski Question: The old code, if the wait setting is enabled, will delay deploying/promoting a build until it has finished running. Considering you think the wait option is legacy, what should the new behaviour be?
|
I've re-implemented deploy logic, but not sure what to do wrt. builds that are currently running. Please see my comment. |
|
Is there any way forward with this? |
|
I also hope we can progress on this :) |
|
Thanks for your work @aknuds1 ♥ I will be using this from now also. |
|
In testing this I found a condition in which if, for whatever reason, a new build is not created (such as if the build does not match a given set of triggers — in my case Notably, the returned build ID was 0 — like the request itself worked, but that while the event was successfully triggered, there were no builds generated. Logs were: This server is a little mutant though — theres a couple patches on there that aren't in main (yet) — but it might be worth digging into. |
|
Any news on this? There is a bug associated with this to my knowledge (parameter passing, old parameters get reused instead of new ones), which can lead to timeconsuming problems. Is there a workaround for this? Will this PR be merged? |
This PR proposes a rewrite of the plugin to, instead of re-starting old builds, create builds via
Client.BuildCreate.