REST API for gitlab CI? - gitlab

I have set up a CI pipeline, and it is working well. However, I still have to go to a web interface and click buttons - is there an API for this functionality, specifically the CI part? I know there is a REST interface to gitlab as such, but I still haven't spotted the parts that handle CI - does it exist?

You can refer to the full API documentation.
You should more specifically be interested on the sections regarding jobs and pipelines

Related

Netsuite - SuiteCloud Development Framework - GitHub Integration - CI/CD

We are improving our CI/CD process and we understand that we need to use GitHub (or similar) for a better version control..
We would like to integrate SuiteCloud with Github to upload ALL our objects in order to track an monitor any changes. Also, we are planning to use branches to deploy code in our instances. Ex: Master = Production. Dev Branch = Sandbox1, Homologation = Sandbox2.
So... is possible to do it? And how? Any experiences to be shared?
Since SDF manipulates text (xml) files their management is no different than for any other git based CI/CD process.
Netsuite has java and node based CLI tools that can be incorporated in Git Actions for automated deployments.
You'll have some fun if you want to automate testing as that can be problematic with any live database.

How to add test result attachments during Azure Devops build or release via a C# application?

I'm wanting to add some test case attachments during a build or release but I'm struggling to find a valid approach to do this. I'm not using MSTest.
I tried creating a custom build/release task but I've found the azure-devops-node-api package to be flaky at best, and seemingly lacking contributors.
This is what I would hope to do...
Use C# if possible
Have the code/task available for either a build or release across multiple repositories and projects (same organization) without code duplication
Automatically authenticate with the currently running build/release without needing PAT tokens or any other form of authentication
Access to both Azure File Storage and Azure Devops
Works with any build or release agent
Is this achievable? I've seen odd articles in various places but nothing like whats described above. For example this shows promise in terms of validating the current build/release in a C# application however it is 4 years old now and doesn't explain how to integrate with a pipeline.
Can anyone help?
Thanks,
I've always leveraged mstest, so within the runner we've had access in c# to the TestContext that supports adding the attachements directly to the test result.
It looks like the API is exposed for adding attachments to the runs though, so I would think you can create something either in c# or in powershell that accomplishes what you are asking. You will likely need to make sure the agent phase has access to the OAuth token.
POST https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/Results/{testCaseResultId}/attachments?api-version=5.1-preview.1

Difference between GitLab CI and GitHub Actions Beta

What is the difference between GitLab CI and GitHub Actions Beta?
Both talk about devops/automation from Git repo
GitHub copied a lot of Gitlab`s features, including CI (similar configuration and price). Actions looks like GitLab CI/CD but there are some differences between them.
GitLab CI/CD has integration with Pages, issues, packages registry, it has environments dashboard, review support, manual pipelines, multi-project pipelines, support a lot of different reports (such as Container scanning report), good API, ability to use your own runner, and a lot of other features. Also, it is open source.
You can see more full comparsion here
GitHub Actions - simple CI; GitLab CI/CD - configurable and powerful open-source CI/CD with integrations with different software and unique features.
As the commenter said above, it's basically just each company's answer to CI/CD. There are minor differences but the basic premise is the same.
You can see a side-by-side comparison from a third party at https://knapsackpro.com/ci_comparisons/github-actions/vs/gitlab-ci.

How to change pipeline badge name

As the standard pipeline badge from GitLab looks like this
you can tell pretty well that those are not really distinguishable.
Is there a way to change the pipeline text manually or programmatically to something else for each badge?
Btw, the badges were added with those links
https://gitlab.com/my-group/my-repository/badges/master/pipeline.svg
https://gitlab.com/my-group/my-repository/badges/dev/pipeline.svg
Additional facts:
The pipeline runs locally on my computer
My repo is private
I know it is a bit of an old post, but I was looking for the same and found that it is available now since GitLab 13.1.
The text for a badge can be customized to differentiate between multiple coverage jobs that run in the same pipeline. Customize the badge text and width by adding the key_text=custom_text and key_width=custom_key_width parameters to the URL:
https://gitlab.com/gitlab-org/gitlab/badges/main/coverage.svg?job=karma&key_text=Frontend+Coverage&key_width=130
The example is for the Coverage badge but this also works for Pipelines, so in your case:
https://gitlab.com/my-group/my-repository/badges/master/pipeline.svg?key_text=master&key_width=50
https://gitlab.com/my-group/my-repository/badges/dev/pipeline.svg?key_text=dev&key_width=50
(Found this via https://microfluidics.utoronto.ca/gitlab/help/ci/pipelines/settings.md#custom-badge-text)
There are multiple ways how you can achieve custom pipeline badges in GitLab.
One way could be to use Shields.io which provide a way to generate dynamic badges for your Gitlab repository via a jsonfile.But if your repository is private (only accessible from internal network) then you will get an inaccessible message in your badges.
Otherwise, if your build uses python Docker images or any other python installation with dependencies, you can simply install the anybadge package and generate svg badges to be used in the project from the artifacts directly.
It would be good in future that GitLab offers us more cleaner way to customize the badges, but for now I think those are the workaround solutions.

Transfer Gitlab Issues to Youtrack

We use Youtrack for our developers, and we have GitLab CE with repos. In several projects we allow external users to post issues in GitLab and I need copy of them in YouTrack. At least initial copy on posting.
Can't find any solution on web. So I guess we need to make our own, but with way is better?
YouTrack project workflows requesting some GitLab API url?
Webhooks? I don't see any web hook receiver on YouTrack side. Is there any web
hook Should U make some thing in the middle?
There're no webhooks available in YouTrack indeed, so your options would be either to use some external service that would copy information from GitLab to YouTrack, or create a workflow that would request GitLab for new issues every once in awhile.

Resources