gitlab-plugin | A Jenkins plugin for interfacing with GitLab | Plugin library

 by   jenkinsci Java Version: gitlab-plugin-1.7.14 License: GPL-2.0

kandi X-RAY | gitlab-plugin Summary

kandi X-RAY | gitlab-plugin Summary

gitlab-plugin is a Java library typically used in Plugin, Jenkin applications. gitlab-plugin has no vulnerabilities, it has build file available, it has a Strong Copyleft License and it has medium support. However gitlab-plugin has 13 bugs. You can download it from GitHub.

This plugin allows GitLab to trigger builds in Jenkins when code is committed or merge requests are opened/updated. It can also send build status back to GitLab.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              gitlab-plugin has a medium active ecosystem.
              It has 1420 star(s) with 603 fork(s). There are 63 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 213 open issues and 652 have been closed. On average issues are closed in 638 days. There are 13 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of gitlab-plugin is gitlab-plugin-1.7.14

            kandi-Quality Quality

              OutlinedDot
              gitlab-plugin has 13 bugs (1 blocker, 0 critical, 7 major, 5 minor) and 525 code smells.

            kandi-Security Security

              gitlab-plugin has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              gitlab-plugin code analysis shows 0 unresolved vulnerabilities.
              There are 2 security hotspots that need review.

            kandi-License License

              gitlab-plugin is licensed under the GPL-2.0 License. This license is Strong Copyleft.
              Strong Copyleft licenses enforce sharing, and you can use them when creating open source projects.

            kandi-Reuse Reuse

              gitlab-plugin releases are available to install and integrate.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              gitlab-plugin saves you 7533 person hours of effort in developing the same functionality from scratch.
              It has 15548 lines of code, 1684 functions and 194 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed gitlab-plugin and discovered the below as its top functions. This is intended to give you an instant insight into gitlab-plugin implemented functionality, and help decide if they suit your requirements.
            • Adds a hook to the GitLab server
            • Gets the api token
            • Create the actions for the given job
            • Get a client for an item
            • Handle merge requests
            • Updates the commit status of a project
            • Gets the open merge requests from a project
            • Handles a merge request
            • Initializes the stream
            • Adds the environment variables for the given run
            • Check if the merge request hook is compatible
            • Checks if the hooks are equal
            • Migrates Git triggers
            • Compares two pipelines
            • Compares two objects
            • Returns true if this push is equal to the given object
            • Compares two repositories
            • Checks if the project should be build or not
            • Commit note hook
            • Migrate GitLab connection to Jenkins
            • Returns true if the attributes are equal
            • Removes the award for the given merge request
            • Executes the push hook
            • Checks to see if we need to build a project namespace
            • Writes the status body to the response
            • Write status image
            Get all kandi verified functions for this library.

            gitlab-plugin Key Features

            No Key Features are available at this moment for gitlab-plugin.

            gitlab-plugin Examples and Code Snippets

            No Code Snippets are available at this moment for gitlab-plugin.

            Community Discussions

            QUESTION

            How to use gitlab comments to tell jenkins to do special tasks
            Asked 2020-Sep-11 at 14:16

            Today we are sending build-trigger as notes (eg comments) från gitlab merge-requests to tell jenkins start a pipeline. Since we only had one such task we have been happy enough with just checking if a trigger sent as a note reached our pipeline and then acted on that information.

            But, now we would like to add more user-requested tasks and need to inspect the comment for the type of request the user ask for.

            From the documentation at https://github.com/jenkinsci/gitlab-plugin there are no variables that carries the information from note-trigger to the pipeline. The note seems to be discarded after the comment-regex-filter in the job-configuration in the gui.

            I hope I have missed something. Otherwise we have to fetch all notes for the merge-request from gitlab to the pipeline through a rest-call.

            ...

            ANSWER

            Answered 2020-Sep-11 at 14:16

            We are doing this (only difference is we are using Bitbucket). Here is the summary:

            1. In Jenkins we have written code using (jenkins shared library).
            2. From within the application pipeline (jenkinsfile) we will make a call to the jenkins shared library method (say commentChecker()) to check the the git commit messages and understand what needs to happen.
            3. In the shared library code commentChecker() - we will first call the Bitbucket API for the branch and get all the commit messages. In your case I think you should able to call (https://docs.gitlab.com/ee/api/commits.html) api and get the details and parse through the messages.
            4. Shared library is like a common function and all your projects can all this one function to check the commits, easy to handle and make changes.

            Source https://stackoverflow.com/questions/63847802

            QUESTION

            Change kubernetes stroge class mounted value from another pod
            Asked 2020-May-31 at 21:14

            I want to publish sonarqube with kubernetes. I did successfully with official packages. But i want to use some plugins old version and some custom plugins. In local with docker-compose files, i created a fly-away container that fills the plugins directory(/opt/sonarqube/extensions/plugins) with plugins. And use that volume with sonarqube container. As a conclusion : Sonarqube extensions volume directory is created (or filled) from different container(do the job and die).

            I want to use the same path with kubernetes but couldn't do that. My flyaway container didn't fill the path.

            My kubernetes deployments files:

            1-) sonar-pvc-extensions.yml

            ...

            ANSWER

            Answered 2020-May-30 at 20:38

            Are you sure, you want to use the same directory for container volume mounts and to store the plugins. I believe this is causing a conflict. Can you try changing the volume mount directory (in deployment container spec)?

            Source https://stackoverflow.com/questions/62105986

            QUESTION

            Insert variable in parameter into parametrized build in Jenkins
            Asked 2020-Apr-14 at 14:20

            Have a Jenkins job with build parameter BRANCH. When job run manually user can choose branch from a list to deploy. List provided by git plugin.

            But this job also can be invoked by GitLab hook. In this case parameter will have a default value, because didn't receive any input.

            Is there a way to have a parameter BRANCH with relevant information? With a branch name coming from GitLab hook.

            P.S. I think it's possible by set default value to something ${BRANCH_FROM_HOOK ?: default_value} it will check presence of BRANCH_FROM_HOOK variable. Need only find a way how to put into BRANCH_FROM_HOOK variable, value of branch coming from hook. I now that gitlab plugin, who receive a hook, set into gitlab.Branch value of branch from which hook comes.

            UPDATE: What I have done to achieve this:

            • Specify git parameter:

            gitParameter defaultValue: "${env.gitlabBranch ?: "origin/master"}" but didn't as gitlabBranch is not set on the build start step.

            • Setup job parameters as it suggested on gitlab plugin page here:

              • Keep Jenkins Environment Variables
              • Keep Jenkins Build Variables
              • Override Build Parameters
            • Added to section "Groovy script":

            ...

            ANSWER

            Answered 2020-Apr-14 at 14:20

            The answer is use Generic Webhook plugin, not GitLab. And use it's feature map his variables to parameters of job:

            If your job is parameterized, and you resolve variables that have the same name as those parameters, then the plugin will populate the parameters when triggering job. That means you can, for example, use the parameters in combination with an SCM plugin, like GIT Plugin, to pick a branch.

            End.)

            Source https://stackoverflow.com/questions/61134783

            QUESTION

            GitLab: Editing the merge request description triggers a merge request hook being sent
            Asked 2019-Dec-18 at 14:12

            For my repository on GitLab I have a Merge Request Hook configured which triggers a build on a Jenkins CI machine. The hooks works as expected when a merge request is opened.

            The webhook is configured with the following triggers:

            Lately, when I edit the description of the merge requests then the hook also notifies the CI machine.
            Here is an example POST request:

            Request headers: ...

            ANSWER

            Answered 2019-Apr-02 at 12:25

            Under triggers (Settings -> integrations) perform the below:

            1. Enable push events (optional branch name - Branch is created via push events even before MR is possible)
            2. Enable MR event triggers in your project repo

            This URL will be triggered when a merge request is created/updated/merged

            In Jenkins Plugin configuration -

            1. Check "Push Events" (Any commits by way of direct Push or Creation)
            2. Un-check "Opened Merge Request Events"
            3. Check "Accepted Merge Request Events" (Any commits by way of Merge Request)

            Source https://stackoverflow.com/questions/55284986

            QUESTION

            programmatically lock GitLab branch
            Asked 2019-Nov-12 at 08:50

            Background: We'd like to lock branch for merging while deploy Jenkins job is running

            Question: Is there way to programmatically lock GitLab branch?
            e.g. To set "maintainers_can_push": false" on GitLab protected branch

            Checked so far:

            1. Haven't found any mention of such functionality at GitLab plugin.
            2. Haven't found anything on GitLab branches API page
            ...

            ANSWER

            Answered 2019-Mar-13 at 14:13

            At https://docs.gitlab.com/ee/api/branches.html#protect-repository-branch there is a link to the page https://docs.gitlab.com/ee/api/protected_branches.html devoted to API calls for listing protected branches, protect and unprotect them.

            To protect a branch call POST /projects/:id/protected_branches. For example

            Source https://stackoverflow.com/questions/55138546

            QUESTION

            Setting ansible.cfg in Jenkins job
            Asked 2019-Sep-26 at 13:10

            Actually I'm working on creating software deployment jobs which will deploy my software over Ansible roles. The Ansible roles will be executed over a central Jenkins Server to have a GUI for "everybody" who should be able to execute the software deployment.

            My Ansible roles and playbooks and so on have their own ansible.cfg which is different to standard ansible configuration under /etc/ansible/ansible.cfg, also /etc/ansible/ansible.cfg will not be changed because it will be used by different Ansible Tasks which need other options.

            Now I'm searching for a way how I can set the path to the ansible.cfg file in the Jenkins job. I've already found the Ansible docu (https://docs.ansible.com/ansible/latest/reference_appendices/config.html#ansible-configuration-settings) but I'm not able to set ANSIBLE_CONFIG in the Jenkins Job and also I don't know the "home" of the Jenkins job.

            Does anybody had the same problem and has any solution for that? Maybe by setting env vars in Jenkins Job?

            EDIT: I've also tried the way over EnvInject Plugin in Jenkins to set ANSIBLE_CONFIG for the build run. Unfortunately with no solution here. I've tried it in the two ways which are described here: How to set environment variables in Jenkins?

            That is my output in Jenkins (also tried it without the " " for the path):

            ...

            ANSWER

            Answered 2019-Sep-26 at 09:13

            From the output it looks like you are using shell command to execute ansible-playbook. You can try setting environment variable before ansible-playbook command. Below is the example.

            Source https://stackoverflow.com/questions/58112266

            QUESTION

            Jenkinsfile are not called by build
            Asked 2019-Sep-01 at 18:25

            I have Jenkins connected with GitLab, both installed by Helm Chart:

            ...

            ANSWER

            Answered 2019-Sep-01 at 18:25

            Make a mistake selecting the freestyle option.

            After delete the job and recreated with Pipeline option selected, everything works.

            Source https://stackoverflow.com/questions/57745470

            QUESTION

            Accessing GitLab JSON from Jenkins Groovy script
            Asked 2019-Jul-26 at 08:35

            In the project I'm working on, we use GitLab CE along with Jenkins for CI.

            Currently we merge changes using Jenkins job by just passing branch name as an input parameter. I want to create a job which takes merge request ID (e.g. 123) and uses GitLab URL API to get info such as e.g. source branch, target branch etc. and then does the rest (build, merge).

            I'm a total beginner (both to Jenkins and Groovy) and what I did is just:

            ...

            ANSWER

            Answered 2019-Jul-26 at 08:34

            It turned out that it was an authentication issue.
            I solved this by providing GitLab API private token in header of a request:

            Source https://stackoverflow.com/questions/57185761

            QUESTION

            How to change permission on file in Dockerfile?
            Asked 2019-May-08 at 12:10

            I have the following Dockerfile:

            ...

            ANSWER

            Answered 2019-May-08 at 11:52

            Instead of using sudo if you want to run command as root user use USER root line to switch to root and then execute your commands

            Source https://stackoverflow.com/questions/56040125

            QUESTION

            How to copy file in Docker?
            Asked 2019-May-07 at 15:07

            I have the following Dockerfile:

            ...

            ANSWER

            Answered 2019-May-07 at 14:59

            You're running wget inside the container, but then trying to COPY it from the host machine to the container. To copy from one container location to another simply use cp:

            Source https://stackoverflow.com/questions/56025001

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install gitlab-plugin

            You can optionally have your Jenkins jobs send their build status back to GitLab, where it will be displayed in the commit or merge request UI as appropriate. Use 'Publish build status to GitLab' Post-build action to send build status with the given build name back to GitLab. 'Pending' build status is sent when the build is triggered, 'Running' status is sent when the build starts and 'Success' or 'Failed' status is sent after the build is finished. Also make sure you have chosen the appropriate GitLab instance from the 'GitLab connection' dropdown menu, if you have more than one. NOTE: If you use Pipeline global libraries, or if you clone your project's Jenkinsfile from a repo different from the one that contains the relevant source code, you need to be careful about when you send project status. In short, make sure you put your gitlabCommitStatus or other similar steps after the SCM step that clones your project's source. Otherwise, you may get HTTP 400 errors, or you may find build status being sent to the wrong repo. The example below configures the GitLab connection and job triggers. It also sends build status back to GitLab.
            For Pipeline jobs, surround your build steps with the gitlabCommitStatus step like this: node() { stage('Checkout') { checkout <your-scm-config> } gitlabCommitStatus { // The result of steps within this block is what will be sent to GitLab sh 'mvn install' } }
            Or use the updateGitlabCommitStatus step to use a custom value for updating the commit status. You could use try/catch blocks or other logic to send fine-grained status of the build to GitLab. Valid statuses are defined by GitLab and documented here: https://docs.gitlab.com/ce/api/pipelines.html node() { stage('Checkout') { checkout <your-scm-config> } updateGitlabCommitStatus name: 'build', state: 'pending' // Build steps updateGitlabCommitStatus name: 'build', state: 'success' }
            Or you can mark several build stages as pending in GitLab, using the gitlabBuilds step: node() { stage('Checkout') { checkout <your-scm-config> } gitlabBuilds(builds: ["build", "test"]) { stage("build") { gitlabCommitStatus("build") { // your build steps } } stage("test") { gitlabCommitStatus("test") { // your test steps } } } } Note: If you put the gitlabBuilds block inside a node block, it will not trigger until a node is allocated. On a busy system, or one where nodes are allocated on demand, there could be a delay here, and the 'pending' status would not be sent to GitLab right away. If this is a concern, you can move the gitlabBuilds block to wrap the node block, and then the status will be sent when Jenkins starts trying to allocate a node.
            You use the "Merge When Pipeline Succeeds" option for Merge Requests in GitLab, and
            Your Declarative Pipeline jobs have more than one stage, and
            You use a gitlabCommitStatus step in each stage to send status to GitLab...
            Add a Flexible publish action
            In the Flexible publish section: Add conditional action In the Conditional action section: Set Run? to Never Select Condition for Matrix Aggregation Set Run on Parent? to Always Add GitLab actions as required
            In order to build when a new tag is pushed:.
            In the GitLab webhook configuration, add 'Tag push events'
            In the job configuration under 'Source code management': Select 'Advanced...' and add '+refs/tags/*:refs/remotes/origin/tags/*' as the Refspec You can also use 'Branch Specifier' to specify which tag need to be built (example 'refs/tags/${TAGNAME}')

            Support

            This plugin is Open Source Software, developed on a volunteer basis by users of Jenkins and GitLab. It is not formally supported by either GitLab Inc. or CloudBees Inc. GitLab performs a new major release about every six to nine months, and they are constantly fixing bugs and adding new features. As a result, we cannot support this plugin when used with GitLab versions older than N-2, where N is the current major release. At the time of this writing, the current stable release of GitLab is 11.1, so the oldest release supported by this plugin is 9.0. If you have a problem or question about using the plugin, please make sure you are using the latest version. Then create an issue in the GitHub project.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/jenkinsci/gitlab-plugin.git

          • CLI

            gh repo clone jenkinsci/gitlab-plugin

          • sshUrl

            git@github.com:jenkinsci/gitlab-plugin.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link