3

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?

1

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 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 for more details on configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.