Azure devops cicd gitlab integration - azure

I am using an external private gitlab repository for code and using azure-devops for cicd pipeline. When the user checks in code to the gitlab project repository azure-devops builds and releases. It names the build as CI BUILD. How can I get username and current changeset (name of the user who just checked in his code and his changeset files name) to show with build in azure-devops?

You can click on the build record of the CI trigger in the build pipeline.
The username of the changer and commit will be displayed at the top of the record. Click commit and you will be taken to the changed file.
In the sample ,I use the github repository for code ,I think the same is true with gitlab.

Related

Tag version check between two pipelines azure devops

I have two CI pipelines in azure devops:
CI pipeline to train models
CI pipeline to score/predict/inference new data
Both of these pipelines are triggered when a PR is created on a specific branch. I have enabled "Tag Builds" on succeed with $build.BuildNumber format. I beleive if the builds are successful, they are given some tags.
I have a release pipeline, what I want to do is to check if the tag/buildNumber for 1st and 2nd CI pipelines are same or not. If not, the release pipeline should fail.
The problem is I cant find any tag information of the CI pipelines here is what I see after a build is succeeded.
I found out that. It is not possible to check if two or more tags are valid based on some logic in devops. So, we ended up using bash task and git commands to check if tags are valid (using regex).

Azure DevOps Pipines - Git Respository local directory location

I have created a Pipeline in Azure DevOps and have associated a git repository.
It is cloned to my agent, but I can't get control over in which local directory the repository is cloned to. I am working with self hosted Agent.
The next task need to use a specific file in the repository to complete the task.
The last things tha should happen in the pipline, is push back changes made in the respository.
I think what you want is WorkingDirectory, the local path on the agent where your source code files are downloaded. For example: c:\agent_work\1\s

How can I prevent PRs from changing my CI configuration?

We have an open source project in GitHub. And we use Azure DevOps pipelines for our CI.
We publish our artefacts to S3 and Maven after successful tests, so all the credentials are stored as secret variables.
It's nice that export and echo $top_secret are conveniently obfuscated with ***, but unfortunately literally any user on GitHub can create a pull request against our repo, and as part of the changes, they can edit our azure-pipelines.yml and call a curl (or similar) to read the credentials from environmental variables and send them to their own server.
In other CI providers (Travis CI) secret variables are not accessible from PR branches.
How can I prevent PRs from touching my CI configuration file and do anything with it?
How can I prevent PRs from touching my CI configuration file and do anything with it?
You CI configuration file is save in the GitHub open source and you want to restrict users from changing this file, right? Since we cannot set file permission in the GitHub. we cannot prevent PRs from touching your CI configuration file.
As a workaround, we could create classic editor pipeline in the Azure DevOps and set the CI Trigger, such as below. If users do not have permission to change the build definition, they cannot change your CI build definition.
Update1

azure devops shows 'set up build' button

I am using git service of azure devops.
I have my build pipeline setup with master branch using yml file.
And it runs & perform well.
Question is on Azure UI: Why does it show me the button 'Set up build' i already have my pipeline setup.
The reason is that the latest commit did not trigger my pipeline as we are excluding build trigger for README file changes.
(Build status links with commit id)
is there anyway to show the latest build status instead of this button.
Azure DevOps provides this quick way to set up yaml pipeline using this “Set up build” button when new repository is created. When you click this button to set up yaml pipeline and queue a new build, this button will show you the latest build's state( the build status is linked with commit-id), as below.
To your situation, as this ticket suggested, you could see the build status in the other place, such as Commits hub, Dashboad, build status badges and so on.
This happens if we commit some files which is part of exclusion in pipeline trigger, as in this particular commit there is no pipeline status is linked.

Can we setup Gitlab webhook in a Gitlab repository to trigger different Jenkins build jobs for different branches?

I'm trying to set up different build jobs in Jenkins for different branches of a Gitlab repository. I'm using Gitlab web hook to trigger the build.
Here are the steps I followed to setup a web hook for Jenkins CI in Gitlab
Go to the project
Settings --> Integrations
Under 'Project Services', I've selected 'Jenkins CI'
Now I've checked the 'Active' checkbox
Jenkins url : <jenkins url>
Project Name : <jobname_on_jenkins>
and provided credentials.
In Jenkins, I've selected the under 'Build triggers', I've selected
"Build when a change is pushed to GitLab" and provided the branch filters.
Now, In Jenkins, I've created another job with branch filter as different branch name.
Now my question is, How do i setup a web hook in Gitlab to trigger a different Jenkins job when there is a change in a specific branch. I tried providing comma separated job names for the field 'Project Name' in Gitlab web hook for Jenkins CI but it's not allowing comma separated values there.
Other details:
Gitlab version : GitLab Enterprise Edition 10.8.7-ee 075705a
Jenkins version: 2.138.3
Plugins installed on Jenkins : Gitlab, Gitlab webhook
Just use two webhook - in the field branch name specify the name of the branch

Resources