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

lab ci wait #240

Closed
temp opened this issue Nov 7, 2018 · 19 comments
Closed

lab ci wait #240

temp opened this issue Nov 7, 2018 · 19 comments
Milestone

Comments

@temp
Copy link

temp commented Nov 7, 2018

I don't know wether or not this is possible, but it would be nice to have a ci command that simpy waits for the current pipeline to finish and then exits with status code 0 for success, and 1 for failure.
This would allow scripting of several pipelines that need to be run in a specific order. I know you can trigger builds inside a pipeline, but we need it the other way - like a listener.

This would allow something like this:

cd /whatever/docker-base
lab ci create
lab ci wait
cd /whatever/docker-project-that-uses-docker-base
# or maybe
lab ci create --wait
cd /whatever/another-docker-project-that-uses-docker-base
# or maybe
lab ci create
lab ci trace --exit-on-finish
...
@zaquestion
Copy link
Owner

I'm pretty sure we can pull this off! Thanks for including your usecase as well, that goes a long way in integrating your idea into lab as a whole and provide a tangible workflow to justify implementation.

That said, have you looked at multi-project pipelines in GitLab? This may fit your usecase more elegantly that the feature would?? https://docs.gitlab.com/ee/ci/multi_project_pipelines.html -- Let me know!

@temp
Copy link
Author

temp commented Nov 8, 2018

Yes, I looked at multi project pipelines, but they don't support our use case.
We don't need a trigger from upstream, but a listen from downstream.
Like in my example a base docker image.
Now for example 10 projects use this base docker image, and every time the base docker image is built, I want the 10 project docker images to be rebuild. But I don't want to add trigger code for each project in the base docker repository...

@zaquestion zaquestion added this to the 0.15.0 milestone Nov 9, 2018
zaquestion added a commit that referenced this issue Dec 28, 2018
To address #261 & through the use of `--wait` hopefully #240
zaquestion added a commit that referenced this issue Dec 28, 2018
To address #261 & through the use of `--wait` hopefully #240
zaquestion added a commit that referenced this issue Dec 28, 2018
To address #261 & through the use of `--wait` hopefully #240
zaquestion added a commit that referenced this issue Jan 8, 2019
To address #261 & through the use of `--wait` hopefully #240
zaquestion added a commit that referenced this issue Jan 8, 2019
To address #261 & through the use of `--wait` hopefully #240
zaquestion added a commit that referenced this issue Jan 8, 2019
To address #261 & through the use of `--wait` hopefully #240
@zaquestion
Copy link
Owner

@temp lab ci status --wait was added in 0.15.0 please let me know if this works for your purpose and reopen if needed.

@temp
Copy link
Author

temp commented Feb 11, 2019

Looking good!
Maybe the spam-factor can be reduced by waiting a second between status-check while --wait'ing? Or add something like --quiet?

@temp
Copy link
Author

temp commented Feb 11, 2019

Ah, some weirdness remains ;-)
I have a status --wait running, and it's still printing running messages, but a status on a second console reveals:

± lab ci status
Stage:   Name              - Status
...
Pipeline Status: failed

Maybe the wait is already done, but he's still busy printing?

@temp
Copy link
Author

temp commented Feb 11, 2019

Wow, it kept running, and Mac OS just complained about no app memory left...
Here's what it said:
bildschirmfoto 2019-02-11 um 11 34 24
:-D

(yes, I have enabled unlimited scrollback lines...)

@zaquestion
Copy link
Owner

Oh my!

@zaquestion zaquestion reopened this Feb 12, 2019
@zaquestion
Copy link
Owner

@temp Not sure what you may have ran into, but at least in my own usage of this:

lab ci trigger some/other/project ...
lab ci status --wait # no way to actually specify project.

Going to fix that, have you been able to gather any more info on what you may have ran into? Is it possible that you also needed to specify a separate pipeline?

@temp
Copy link
Author

temp commented Aug 1, 2019

@zaquestion I started it from within my git-directory - then you don't need to specifiy the project!
And then the described behaviour occurs.

@zaquestion
Copy link
Owner

Ah, nice work around! I'll add the additional means as well soon

@claytonrcarter
Copy link
Collaborator

I've also encountered this. lab ci status --wait doesn't ever seem to return. As I read the code (you know my Go ain't great), it looks like it never actually retrieves an updated list of CI jobs and just loops over the first list it received ... which makes sense why it would never update! :)

@zaquestion
Copy link
Owner

Yep @claytonrcarter is right, my code was just bunk 😊

@bmeneg
Copy link
Collaborator

bmeneg commented Jun 22, 2021

@temp not sure if it's still a problem for you, but it should've been fixed with PR #361.
Please, feel free to let me know if it's not solved or if any other issue appear.

@bmeneg bmeneg closed this as completed Jun 22, 2021
@temp
Copy link
Author

temp commented Jun 28, 2021

@bmeneguele works fine now! 👍
it would be awesome to be able to specify the wait-seconds, but this is really nice-to-have... ;-)

@bmeneg
Copy link
Collaborator

bmeneg commented Jun 28, 2021

@bmeneguele works fine now! 👍

I'm glad to hear that :)

it would be awesome to be able to specify the wait-seconds, but this is really nice-to-have... ;-)

Hmm... a timeout behavior? That's something to think about indeed.
Why don't you open a new issue with this suggestion so we can check it more "formally"?
It should be easy to make it happen.

@temp
Copy link
Author

temp commented Jun 28, 2021

Hmm... a timeout behavior? That's something to think about indeed.

Oh, no, I meant the wait time between 2 polls. Have seen the 1-second-wait in the sources. But for long running pipelines it would be ok to poll 5-15 seconds, to avoid hammering. Like I said, it's only a nice to have.

@temp
Copy link
Author

temp commented Jun 28, 2021

Here is the snippet:

// don't spam the api TOO much
time.Sleep(1 * time.Second)

@claytonrcarter
Copy link
Collaborator

Yup, when I fixed this feature, I picked 1s out of thin air! Adding a flag to configure the polling interval would be a trivial change; a great first issue/PR.

@bmeneg
Copy link
Collaborator

bmeneg commented Jun 29, 2021

Ahh, got it!
Yes! for sure it would be a really nice "first issue".

zaquestion added a commit that referenced this issue Jun 29, 2021
Per discussion in #240, lets just bump up the interval, totally open to putting it behind a flag, but in the context of waiting for a an entire pipeline to finish, 1s is clearly a bit too aggressive.
zaquestion added a commit that referenced this issue Jun 30, 2021
chore: (ci status) #240 bump up default wait interval
zampierilucas pushed a commit to zampierilucas/lab that referenced this issue Jul 6, 2021
Per discussion in zaquestion#240, lets just bump up the interval, totally open to putting it behind a flag, but in the context of waiting for a an entire pipeline to finish, 1s is clearly a bit too aggressive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants