gitlabatlassian-crucible

GitLab CI Pipeline wait for external tool


I want to have Crucible (CodeReview Tool) to integrate with my gitlab. So there is no direct integration other then special "smart" commit-commands for e.g. starting a review or linking to a Jira ticket.

But within another video of another tool I saw the idea for a waiting pipeline. So I stole the idea and want integrate that in Curcible:

Wihtin the pipeline I want to start polling the WebAPI of crucible for a given ReviewID and when the answer in Json is "finished", I want to succed the pipeline, else I just want to try later...

Any idea how to realize this with having a runner running forever and ever doing polling-stuff every x seconds?


Solution

  • First of all, having a job that runs for a long time or forever will occupy the runner so make sure you have enough number of static runners or use Kubernetes-based runners that will spawn a dedicated pod for every job.

    If you are okay with a long-polling job then you have to let the job to go over the default 60 minutes timeout by overriding the timeout setting inside the job specification using timeout: setting.

    Reference here: https://docs.gitlab.com/ee/ci/yaml/#timeout

    Also, you might need to check if your runners also have a timeout and remove it, since you cannot exceed runner timeouts, as quoted on that reference page:

    The job-level timeout can exceed the project-level timeout but can’t exceed the runner-specific timeout

    Once you have addressed the job timeout, then you can use a simple while-loop to do the polling to Crucible API endpoint.