When integrating Bamboo with Gitlab, if branch build plans are enabled, gitlab will always show "CI build pending". I followed all the steps required for the integration. Thanks.
Designs
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related or that one is blocking others.
Learn more.
I already contacted the Atlassian support, which told me that the REST function used to lookup the build status only works for the master plan, not for any branch plan:
Upon further checking, the /rest/api/latest/result endpoint only display latest results from the main plans and not branch plans.
@frederickplante proposed to iterate over all branch plan names: I'm not sure if this is a good idea. Depending on your project a Bamboo plan can easily have 30 or more branch plans which would require up to 31 HTTP request cycle to determine the status. Given that bamboo tends to be utterly slow some times I'm not sure if this is a really good & viable option.
@bentolor I totally agree that looping through each branch is not the right way to deal with this issue. The thing is that with the set of REST endpoints that Bamboo has (for now), I was not able to find another solution. If you find another way to make it work, feel free to share it with us!
So - it turns out that my experience with the Atlassian customer support this time was as devastating unhelpful and a total waste of time, as it always used to be. It's really time for us to move on to TeamCity...
I opened a new ticket at https://jira.atlassian.com/browse/BAM-16121. You could vote there. But honestly: It will make no difference at all. My painfully long watchlist of unresolved tickets affecting us never, ever saw a single "Fixed" status. Typically it will rot there for a little bit of time (let's say... 7-10 years) and then Atlassian will set it to WONTFIX irrespective of any number of votes, watchers, level of business impact or amount of complaining comments.
So I must agree with Frederick: If we want this crap to work with Gitlab, currently the only way is to manually loop and query all plans associated with the build plan key. This won't work either very satisfyingly, because depending on the count of branch plans and the current mood of Bamboo, this will regularly exceed Gitlab's patience.
Maybe this could be made possible by adding an option in the bamboo service configuration screen. Something like "Enable branch plan scan". With this, users that are not really using branch plans won't be affected by a behavior change (if the change is actually implemented in Gitlab).
The basic instructions for setting up Bamboo CI still includes setting up revision labeling, right? If so you can locate builds for a given label (in this case the revision ID) with this REST URI:
I've debugged this a bit more. I think the simple answer is that the build_info link just needs the build_key added to the endpoint. Instead of /rest/api/latest/result?label=#{sha1} we need /rest/api/latest/result/#{build_key}?label=#{sha1}. This seems to give me the build results I expect.
@dblessing This does not work for me: Given my master build plan key is PME-CI, the endpoint will return an empty result unless I change the build key to the exact branch key for the particular branch/commit i.e. PME-CI59.
Wow, the Bamboo API is...fun. I may have found an endpoint that will work - /rest/api/latest/result/#{build_key}/branch/#{branch_name}?label=#{sha1}. I found this at https://docs.atlassian.com/bamboo/REST/5.9.2/
@frederickplante@bentolor and others - Can you please test the small fix in !975 (closed) ? I tested locally with Bamboo version 5.9.1 build 5914 and build status works as expected.
The good news is that I've also gained some ideas on how to improve the triggering of builds. I'll work on that soon.
Thank you @dblessing, for your effort! The modified URL seems to mark indeed a breakthrough: It does return build results for the given Commit Hash even for branch plan results.
But: The URL only works from the Browser if I'm logged in as a user. If I add a trailing ?os_authType=basic parameter and my credentials via HTTP Basic, it works for all cases as expected.
Test environment: Bamboo 5.7.2 with Crowd Authentification.
@marache I think your route won't work properly for automatic created feature branches by Bamboo either according to the feedback I got from Atlassian:
Upon further checking, the /rest/api/latest/result endpoint only display latest results from the main plans and not branch plans.
@marache This is strange: I have 5.9.4 and this is definitely not working for me. A valid Git-SHA built on Bamboo in an automatic created branch plan reports no valid build result:
So I would conclude that the solution that both MR ( !975 (closed) and !2562 (closed) ) give a better solution than the existing one, the later MR being more recent would merge quietly...
How can we get this to someone attention from gitlab ?
I opened another support request at Atlassian in the rather irrational hope they can help to clarify, why the REST endpoint /rest/api/latest/result is working in branch plans for @marache but not in our installation.
It seems I've have an answer for @bentolor I've just noticed that Changesets are not associated to the first build of an automatically created branch. Further builds (triggered by commits) will get associated to changesets and be queryable by the API.
I can confirm @marache assumption backed by the feedback from the Atlassian Support:
Hi Benjamin,
Thank you for the information. From the attached screenshots I see that this is the first build for this branch plan. This is the behavior for the first build to avoid the case displaying a large number of commits when you build for the first time from a repository with a large history.
The commit id that you see in the screenshot you sent that starts with 9c8ab0 is the commit id that is used for the first build, but this commit id will not be added to the Commits tab.
The following builds that bamboo will make for this branch will contain all the commits
that were made between the previous and current build. When you use the REST API to
request the results byChangeset you will get results if the changeset is listed in the Commits tab, otherwise the result will be empty.
Cheers, _____
To summarize
Using labels would allow to link to the Bamboo result even on the first push. But there is no shortcut API to retrieve the result
Using the SHA1 endpoint will work, but never for the first push/creation of a branch
Nevertheless the change that it will work at least for some cases is better than for no cases.
GitLab is moving all development for both GitLab Community Edition
and Enterprise Edition into a single codebase. The current
gitlab-ce repository will become a read-only mirror, without any
proprietary code. All development is moved to the current
gitlab-ee repository, which we will rename to just gitlab in the
coming weeks. As part of this migration, issues will be moved to the
current gitlab-ee project.
If you have any questions about all of this, please ask them in our
dedicated FAQ issue.
Using "gitlab" and "gitlab-ce" would be confusing, so we decided to
rename gitlab-ce to gitlab-foss to make the purpose of this FOSS
repository more clear
I created a merge requests for CE, and this got closed. What do I
need to do?
Everything in the ee/ directory is proprietary. Everything else is
free and open source software. If your merge request does not change
anything in the ee/ directory, the process of contributing changes
is the same as when using the gitlab-ce repository.
Will you accept merge requests on the gitlab-ce/gitlab-foss project
after it has been renamed?
No. Merge requests submitted to this project will be closed automatically.
Will I still be able to view old issues and merge requests in
gitlab-ce/gitlab-foss?
Yes.
How will this affect users of GitLab CE using Omnibus?
No changes will be necessary, as the packages built remain the same.
How will this affect users of GitLab CE that build from source?
Once the project has been renamed, you will need to change your Git
remotes to use this new URL. GitLab will take care of redirecting Git
operations so there is no hard deadline, but we recommend doing this
as soon as the projects have been renamed.
Where can I see a timeline of the remaining steps?