gitlab-ci: setup every day builds

送分小仙女□ 提交于 2019-12-11 06:08:27

问题


Really do not understand how I can setup daily scheduler in gitlab . I have simple application and I need automatically build it every day at 8.00 morning. I tried with Following https://gitlab.com/help/ci/triggers/README.md , but i do not understand how can I run this crone job?

30 0 * * * curl --request POST --form token=TOKEN --form ref=master https://gitlab.example.com/api/v3/projects/9/trigger/builds

This is also unacceptable http://cloudlady911.com/index.php/2016/11/02/how-to-schedule-a-job-in-gitlab-8-13/

because I must manually run it from pipeline.

Any solutions?


回答1:


Whether you craft a script or just run cURL directly, you can trigger jobs in conjunction with cron. The example below triggers a job on the master branch of project with ID 9 every night at 00:30:

30 0 * * * curl --request POST --form token=TOKEN --form ref=master https://gitlab.example.com/api/v3/projects/9/trigger/builds

This triggers script in your .gitlab-ci.yml. The assumption is you have ur deployment script prepared in this file. So it will execute stages step by step and if ur step is deployment, it will deploy your application.




回答2:


Now you can setup schedules in gitlab natively to run any pipeline each day.



来源:https://stackoverflow.com/questions/42627464/gitlab-ci-setup-every-day-builds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!