gitlab-ci: setup every day builds

2019-07-31 10:33发布

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?

2条回答
够拽才男人
2楼-- · 2019-07-31 11:10

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.

查看更多
Luminary・发光体
3楼-- · 2019-07-31 11:26

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

查看更多
登录 后发表回答