gitlab-branch-source-plugin | Jenkins-Plugin to create | Continuous Deployment library
kandi X-RAY | gitlab-branch-source-plugin Summary
kandi X-RAY | gitlab-branch-source-plugin Summary
The GitLab Branch Source Plugin allows you to create a new project based on the repository structure based on your GitLab projects. It is heavily inspired by the GitHub Branch Source Plugin, builds upon the GitLab Plugin and uses the Gitlab Java API Wrapper for communication with GitLab. The GitLab Branch Source Plugin scans your GitLab server for projects according to criteria you can specify. The only restriction is that your projects must contain a Jenkinsfile with the definition of the pipeline used to build the project. You can have different Pipeline scripts defined in project branches, or add and remove Jenkinsfiles depending on your use cases. After a project is imported, Jenkins immediately runs a job. Removing a Pipeline script from a branch or from the entire project, removes the item from the view. You can restrict imports on the GitLab Branch Source configuration page. Restrictions include regular expressions for origin branches, merge requests from the original projects or it's forks etc. Like the GitHub Branch Source Plugin this plugin creates each repository as a folder containing each branch with a Jenkinsfile in the top level directory as a different job. When the proper webhooks are configured, the GitLab Branch Source Plugins automatically detects new projects, branches and merge requests, adds new jobs accordingly and builds them. If Jenkins (or rather the user configured to communicate with GitLab) is allowed to do so, it will setup these webhooks automatically for you. When Jenkins is allowed to do so build results will be reported back to GitLab. You can choose whether only the build result (success/failure) get reported or if Jenkins reports every stage defined in your pipeline.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Handles the listener
- Handles the hooks
- Creates a new SCMS source event
- Creates a new commit request event
- Called when a build is started
- Publishes the build status of a build
- Attaches a graph listener to the graph
- Build a SCM with the specified revision
- Connect to the GitLab API
- Called when a build completes
- Accepts a merge request
- Gets a list of remote remotes for the given SCM source
- Compares the webHook for equality
- Compares two objects for equality
- Checks if this link action is equal to
- Compares objects for equality
- Compares GitLabAvatar metadata for this project
- Get the merge request head
- Replies if the given category is enabled
- Returns a list of RefSpec objects for this source
- Compares GitHeadMetadata action for equality
- Gets the branch specs
- Returns a list of connection requirements for gitlab - connection
- Compares this object to another
- Initialize icons
- Checks to see if the path is configured
gitlab-branch-source-plugin Key Features
gitlab-branch-source-plugin Examples and Code Snippets
Community Discussions
Trending Discussions on gitlab-branch-source-plugin
QUESTION
I am trying the access the values set on a job's configuration page from within my pipeline. These values are not made available as params, nor are they injected as envvars.
Setup
- Jenkins, v2.263.1
- GitLab Branch Source plugin, v1.5.3 (link)
- Multibranch pipeline job which is pointed to a Gitlab repo
- Remote Jenkinsfile Provider, v1.13 (link)
Problem
Ordinarily, one would have a Jenkinsfile in the root of the repo and therefore the scm would be associated with the repo we want to checkout and build. However, in my case the code I want to build is in a different repo to the Jenkinsfile (hence the Remote Jenkinsfile Provider plugin).
This means that I need to checkout the code I wish to build as an explicit step in the pipeline, and to do that I need to know the repo. This repo is, however, already defined in the job config.
The Branch Source plugin does export things like the branch name or merge request number/branch/target into appropriate envvars, but NOT the actual repo.
As this is a multibranch pipeline, I cannot use something like envInject either (multibranch jobs do not provide the option to 'Prepare an environment for the run' as with other jobs)
Goal
I would like to be able to access the server
, owner
and project
fields set in the job config page. Ultimately I could manage with just the project's ssh/http address even.
Is there some clever way of accessing a job's config from within the pipeline?
Thanks for any suggestions!
Reference images
...ANSWER
Answered 2021-Jan-25 at 19:37Within the gitlab branch source plugin (and the documentation) you have a lot more information, than just with the normal branch source plugin. there are environment variables for the project like GITLAB_PROJECT_GIT_SSH_URL
/GITLAB_PROJECT_GIT_HTTPS_URL
for the git source and many more. So far i did not see one for the server, but that would be parse-able our of the URLs.
Within this information, it should be fairly easy to checkout the repository and build it.
As through the process it came clear, that it is needed to also trigger the pipeline manually, and this is normally also possible with variables (not sure about the Remote File plugin). I assume your Jenkinsfile is a groovy script, which opens up a lot of possibilities. You can define variables and use some logic to determine if the env variable or the parameter is used.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install gitlab-branch-source-plugin
branch-api 2.0.8
cloudbees-folder 6.0.3
credentials 2.1.13
git 3.0.5
git-client 2.4.0
gitlab-plugin 1.4.5
scm-api 2.1.1
workflow-api 2.12
workflow-cps 2.29
workflow-job 2.10
workflow-multibranch 2.12
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page