<p>If you are using Gitlab merely as a source code repository, and you are triggering the jobs when there are changes to the repository.</p>

<p>The <a href="https://plugins.jenkins.io/gitlab-plugin" rel="nofollow noreferrer">Jenkins Gitlab plugin</a> documentations states:</p>

<blockquote>
  <p>This plugin is a build trigger that allows GitLab to trigger Jenkins builds when code is pushed or a merge request is created. Configuration done on a per-job basis.</p>
</blockquote>

<p>So, you can trigger the builds. But to answer your question:</p>

<blockquote>
  <p>I put all the commands in Shell to execute. Can I store those commands in GitLab and execute from jenkins?</p>
</blockquote>

<p>The answer is <strong>yes</strong>, but there is some leeway. It depends on how you've configured the jobs. If they are freestyle jobs, have them execute a shell command running the script in your repository. You can do this via the web-interface the Jenkins job editor.</p>

<p>However, I wouldn't recommend this as best practice. Instead, I would recommend having a pipeline description in the repository. See <a href="https://github.com/jenkinsci/gitlab-plugin#jenkins-job-configuration" rel="nofollow noreferrer">the plugin docs on github</a> for more details on configuration.</p>

CC BY-SA 4.0
2018-12-03T11:33:22.367Z
2018-12-03T11:33:22.367Z
Bruce Becker
<p>I have configured Jenkins Build Jobs and Deployment Jobs from using Jenkins shell. But I put all the commands in Shell to execute. Can I store those commands in GitLab and execute from jenkins?</p>

<jenkins><git><gitlab><github><shell-script>
Run scripts which are stored in GitLab from Jenkins
Janith
# Run scripts which are stored in GitLab from Jenkins

(Asked by: username_0 on 2018-12-03)

I have configured Jenkins Build Jobs and Deployment Jobs from using Jenkins shell. But I put all the commands in Shell to execute. Can I store those commands in GitLab and execute from jenkins?

**Tags:** jenkins, git, gitlab, github, shell-script


---

## 1 answers

### Answer by username_1 on 2018-12-03. Score: 1 | Accepted answer

If you are using Gitlab merely as a source code repository, and you are triggering the jobs when there are changes to the repository.

The [Jenkins Gitlab plugin](https://plugins.jenkins.io/gitlab-plugin) documentations states:

> This plugin is a build trigger that allows GitLab to trigger Jenkins builds when code is pushed or a merge request is created. Configuration done on a per-job basis.

So, you can trigger the builds. But to answer your question:

> I put all the commands in Shell to execute. Can I store those commands in GitLab and execute from jenkins?

The answer is **yes**, but there is some leeway. It depends on how you've configured the jobs. If they are freestyle jobs, have them execute a shell command running the script in your repository. You can do this via the web-interface the Jenkins job editor.

However, I wouldn't recommend this as best practice. Instead, I would recommend having a pipeline description in the repository. See [the plugin docs on github](https://github.com/jenkinsci/gitlab-plugin#jenkins-job-configuration) for more details on configuration.


---

