Jenkins: How to Sync Local Repository with GitLab / Trigger from GitLab
If you want to update your code in the local repository from git (gitlab, github, gitorious), you need to run git pull into your repository. If you want to do this by Jenkins, you can create a job that can perform this action. There may be easier way to solve it but you can follow the instruction below:
Jenkins > New Item > Freestyle Project > "OK"
Build > Build Steps > Execute Windows Batch Command> Enter your command and save it
Install GitLab Hook PluginJenkins > Manage Jenkins > Manage Plugins > Find Correct Plugin > Install it
Create Deploy Keys on GitLab
GitLab > Your Project Page > Settings > Deploy Keys > Click 'New Deploy Key'
Be sure that you are changing your project settings!
Create Deploy Keys and Services on GitLabGitLab > Your Project Page > Settings > Services > Click 'GitLab CI'
Enter token, run the following command and get the private_token:
curl http://gitlab-url/api/v3/session --data 'email@example.com&password=pass'
set the url with your job in Jenkins: http://your_ci_url/jobs/your_job_you_want_to_trigger
Now if there is a new push to your project on GitLab, it will send a trigger to Jenkins to run the job specified, then it does its jobs and enjoy it :)