How to get all TeamCity builds triggered by a specific git repository? - TeamCity Rest API - teamcity

I'm trying to list all TC (TeamCity) builds/projects triggered by a specific Bitbucket repo (And do it for every repo we have).
What is the best way to do it with TC Rest API?

Related

GitLab Pipeline trigger: rerun latest tagged pipeline

We have an app (let’s call it the main repo) on GitLab CE, that has a production build & deploy pipeline, which is only triggered when a tag is deployed. This is achieved in .gitlab-ci.yml via:
only:
- /^v.*$/
except:
- branches
We also have two other (let’s call them side) repositories (e.g. translations and utils). What I’d like to achieve is to rerun the latest (semver) tag’s pipeline of main, when either of those other side repositories’ master branches receives a push. A small detail is that one of the repositories is on GitHub, but I’d be happy to get them working on GitLab first and then work from there.
I presume I’d need to use the GitLab API to trigger the pipeline. What I’ve currently set up for the side repo on GitLab is a webhook integration for push events:
https://gitlab.com/api/v4/projects/{{ID}}/ref/master/trigger/pipeline?token={{TOKEN}}, where ID is the ID of the main project and TOKEN a deploy token for it.
However, this will only trigger a master pipeline for our main repo. How could I get this to (also) rerun the latest tag’s pipeline (or the latest tagged pipeline)?
Secondly, how would I go about triggering this on GitHub?
Either you can create new pipeline specifying ref which can be branches or tags, so in this case you need to know the exact tag value https://docs.gitlab.com/ee/api/pipelines.html#create-a-new-pipeline
Or you can retry already the executed pipeline by providing its id which you can get from https://docs.gitlab.com/ee/api/pipelines.html#list-project-pipelines by sorting by id and filtering by ref but it'll give you the last pipeline with a tag /^v.*$/ which may not match with the specific version you need.

Trigger Teamcity build from bitbucket cloud on pull request

I have been trying to trigger a build on TC on PR but the refs I have access to TC doesnt include refs/pull or refs/pull-request. Is this a Bitbucket cloud thing? Given that being the case how do I trigger build specifically on pull request?
There is a Bitbucket PR plugin for TeamCity: https://github.com/ArcBees/teamcity-plugins/wiki/Configuring-Bitbucket-Pull-Requests-Plugin
Bitbucket doesn't seem to offer access to pull requests the same way github does, but the plugin does the trick for us.

BitBucket & Bamboo - check pull request doesn't break build on destination branch

I currently have my BitBucket set up to follow the Git flow model (https://datasift.github.io/gitflow/IntroducingGitFlow.html) and have my Bamboo CI running against the develop branch.
What I want to know is if I can set up BitBucket to only approve and/or merge a pull request from a feature branch if that merge would not break the build on the develop branch.
So if we have a pull request to merge branch feature/amazing-new/feature the pull request will only be closed and the branch merged in to develop if Bamboo can do the merge and build successfully.
I've had a look around and only seen answers that refer to build plans that run against the feature branch itself and the BitBucket docs only have paragraph covering builds and pull requests: https://confluence.atlassian.com/bitbucketserver/checks-for-merging-pull-requests-776640039.html
Bamboo can be configured to build merge result: https://confluence.atlassian.com/bamboo/using-plan-branches-289276872.html#Usingplanbranches-Branchupdater
When new commit in feature branch detected it will merge feature branch to master in working copy, build and send result to Bitbucket. At Bitbucket side you can configure pull request settings to not allow PR merge if there're broken builds.

Setting up continues Integration on TFS with GitLab as Repo

I need to configure CI pipeline in my TFS with source repo in GitLab, I have updated the Trigger section as below and checked in the code, but the build was not triggered, is there any configuration required in the GitLab repo? Please advice hot to achieve this.
I would troubleshoot your problem by checking the following in this order:
when triggering the build manually, does the source code downloading from the GitLab repository successfully work?
if yes, then:
did you created and pushed the develop branch on the repository?
You need to publish your locally created 'develop' branch on the remote repository, e.g. >git push -u origin develop
if no, then there are issues on the "Services" entry you created on TFS for accessing your GitLab repository:
check whether you are using HTTPS in the URL;
to enable HTTPS access to your repository, remember to set a password on your GitLab account, then use that password along with your username (email address) on the "Services" endpoint set up on TFS;
p.s. also, check which 'Connection' is selected in the Repository section of your build definition: it should be the one pointing to your GitLab repo :-)
I have changed the Poling interval to 180 seconds and it worked.

API Management with GIT and Octopus - Git PUSH / Git PULL

Following on from this post of mine:
API Management with GIT
I have an API management instance running. I know API management has its own GIT repository.
I can successfully clone, change and push changes up to my API management GIT repository.
I am also running Octopus deploy and am trying to use this:
Git Push
and this:
Git Pull
To pull my code from my companies GIT repository and push to the APIM GIT repository.
The thing is, these to plugins fail immediately with an issue not being able to find file paths on the Octopus server. Also, these were written in 2014.
Is there a recommended better way to pull from your companies repo and push to APIM repository? Also, if I am pulling to Octopus, where does the code get stored before it is pushed to APIM?
In the end, I think this plug in is out of date. I ended up writing my own PowerShell GIT bash and it works a treat.
I get the APIM json code from my companies source control then push it ti the APIM GIT repository and publish it using PowerShell.
For anyone who has this issue in the future.
The cause is most likely you are trying to use the GitPull step from the octopus server, while the code behind the step makes reference to this parameter $OctopusParameters['Octopus.Tentacle.Agent.ApplicationDirectoryPath'].
This parameter seems to return an empty value. I have not tried running from a Deployment Target.
The git clone directory could be another parameter/variable specified
I am raising this with the Octopus team.

Resources