Pipeline in GitLab

#1

Hi guys,

In my buddybuild configuration there is a nice feature: whenever I create a Merge Request on GitLab a new build is triggered on BuddyBuild (that’s easy to achieve with bitrise too) and the Merge Request shows a link to the build as “pipeline” and the Merge buttons switches to “Merge when pipeline succeeds” (see attached picture).
That’s really cool and it’s something I’m trying to achieve with Bitrise as well.

Is there any way you can help me with this matter?
I’ve been trying different configurations of webhooks but with no success.

Thanks for your help,
Alessandro

09

0 Likes

#2

Hi @Wolf,

Do you use gitlab.com or self-hosted?

0 Likes

#3

Hi Viktor,

I use the self-hosted solution, I’m the same guy of this topic


:grin:

0 Likes

#4

Got it - for self hosted GitLab right now we don’t have a built in status report, but you can use the new GitLab Status reporter step ( GitLab status step v0.9.0 released ) to send back the build’s status to any (including self hosted) GitLab instance.

Let me know how it goes or if you’d have any questions! :slight_smile:

0 Likes

#5

That looks like the one, thanks, but I can’t get it to work! :hushed:
Most likely some mistaken configuration: it complains about the missing commit’s hash but I’m not sure what it expects there.

0 Likes

#6

The other doubt is at what priority to put it in the steps list of the workflow. I set it right after Bitrise.io Cache:Pull, is that right?

0 Likes

#7

You should add it as the last step to the build @Wolf, as it will report the build’s status when it runs. So if you run it e.g. before your tests, it’ll report the status before the tests, and if the tests fail it won’t report that error. If you add it as the last step in the workflow then it’ll report the status at the very end, including all previous steps :wink:

0 Likes

#8

@kdobmayer I’d say we should add the run_if to this step too, to be skipped if there was no commit hash. WDYT?

0 Likes

#9

In the meantime @Wolf the workaround for manual builds explained here should work for this step too: https://github.com/bitrise-steplib/steps-github-status/issues/9#issuecomment-366006363

0 Likes

#10

Ah, now I got how it works!
So the status says something about the pipeline basically reporting if it was successful or if any errors occurred, but it doesn’t show anything while it’s running the job and it can’t directly set and update that “merge when pipeline succeed” button, is that right?

Anyway, I moved it to the bottom of the steps list but it stil complains about the missing commit hash. All the other steps succeeded.
Right now the value is $BITRISE_GIT_COMMIT, same value used in the “Git clone repository step”'s configuration so I guess it has a value…

0 Likes

#11

ah sorry, didn’t see your last message, my bad.
So if I got it right that’s happening only because I’m running the build manually, not as a result of a trigger.
I’ll try to setup a trigger then, let’s see how it goes in that case :slight_smile:

0 Likes

#12

I think that’s not an independent functionality, if the CI system reports “success” for the build gitlab will auto merge it. I might be wrong, but AFAIK that’s how it works. Maybe a “in progress” report is also required… In that case you can add a second step to the very start of the build, and set it to report pending or running right when the build starts (https://github.com/bitrise-steplib/steps-gitlab-status/blob/a1c84e8b375d84c4fb42729325ac1d0f94dbc607/step.yml#L62).

0 Likes

#13

Exactly. A git commit hash is required for status reporting, and that’s only passed from the bitrise.io server to the builder if the build is triggered via a webhook OR you specify the commit when you manually start the build (switch to Advanced mode in the build start popup -> you can set the commit there).

0 Likes

#14

Yeah, I got it to work!
It was not working because I set a wrong value in the status field, I didn’t notice the description that explicitly told what values to use :smiley:

Great, it seems ok now.
Thanks for your help!

1 Like

#15

Glad to hear it worked @Wolf! :wink:

I created a task to improve the input, probably to switch from simple input field to a dropdown :slight_smile:

0 Likes

#16

Yeah, that would help :slight_smile:
Or, if you wanted to keep it simple, using bold font for the keywords would do the trick. :wink:

1 Like

#17

got it, thanks for the feedback - added as a note to the related task :wink:

0 Likes

#18

Hi @Wolf,

We released a new version for GitLab status step (0.9.2). We made the step skippable, which means the step not failing anymore if the commit hash is not specified, but shows a warning message: “GitLab requires a commit hash for build status reporting”.

Thank you for your feedback!

1 Like

#19

Hi guys,

there seems to be an issue with the latest version of the plugin (0.95), it doesn’t update the pipeline status anymore on our instance of Gitlab.
Most likely it’s something that happened on version 0.93, that has the most relevant changes, 0.94/95 are pretty small releases.
Version 0.92 works like a charm.
The error is a 404, but my guess is that is sending the wrong request to the API endpoint.
We took a look on the gitlab logs and those 404 don’t show up.

Log of 0.95 says:

±-----------------------------------------------------------------------------+

| (0) gitlab-status |
±-----------------------------------------------------------------------------+
| id: gitlab-status |
| version: 0.9.5 |
| collection: https://github.com/bitrise-io/bitrise-steplib.git |
| toolkit: go |
| time: 2018-05-28T06:40:58-07:00 |
±-----------------------------------------------------------------------------+
| |
config:

What are your thoughts about it?

Thanks,
Alessandro

0 Likes

#20

Hi @mobiledev,

As this doesn’t seem to be related to the discussion here, can you please fill out a #issues:build-issues report? Questions are tracked & handled differently, not as bugs - for bugreports please use the #issues:build-issues or #issues:steps-and-tool-issues category! :slight_smile:

0 Likes