From cd42e9ad3a90756a4d2b28ec921b1ceb57579d4f Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Thu, 11 Oct 2018 02:50:42 +0000 Subject: [PATCH] Documentation for delayed jobs --- doc/ci/img/pipeline_incremental_rollout.png | Bin 0 -> 4794 bytes doc/ci/pipelines.md | 13 +++++++ doc/ci/yaml/README.md | 36 ++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 doc/ci/img/pipeline_incremental_rollout.png diff --git a/doc/ci/img/pipeline_incremental_rollout.png b/doc/ci/img/pipeline_incremental_rollout.png new file mode 100644 index 0000000000000000000000000000000000000000..b3498e9a5a53d0a3852f5eabd004dc0ab37bdacd GIT binary patch literal 4794 zcmZu#XH*kRvkn4+0xtvvML{7-M2hq-p@k4ikPgzMNtYIiQbP|-1BlW=1f(Mf2n3Mc zi_&{DC1s7TFU81 zsp%-n6s%oNo?MVfE2E=h+Vy^20g3|rf@f!E7pLRWT5*oTf}7{({@v$f@~G^qmh+=p zam5z|;&J5gN3f`?ot>Q&M9)k{x~8T!DJi+TyE`r}UcB4}%%>$Orz{VVKPMik#f=fi z-Uvv;kICe^({u7LIxH;wiG-L<>86ZP%1qWXUpdK=T_Se9KWCefYBz`#dX)zbs>UVgM+J6+bYU4 zlDh`yySk>c#)b;#uuB`2W^v{Iab;`WpX&*WT?1VPE`?pyNnsI@)k!YEt7TLG0OKol zsFJ~}S^TWJBa7}Wnghn~8PN|LieC$RxAN_9M~iDB(33Zqm6^+Uww3hs!A=dUU+1}Zq_%0vt*klhKJ z2o#etEqBEK5$Hz`AlmF#61>)n@1faww+iVy%B7@G@ONl}&3eUXFF4G;5jp3DnL4#_ z<9c2j$*F05MY3(=?sqD&k`8FaHxGjo&iGb8m-owee-+MzH$GM{xPyxqq)HxzoUD>m z_7t|=0B<||0=BeY0%$qmJWq*AeXo-$=kp$@y)bEI$H0e@t8!-(m3^uEvx7|3#suW) zoJ}0gm%P7`0ct-jx?%;;kQ27x-MZU`_#Jx;3K%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iPNT866gn~rI5c?eW zhV7?~Kl>9+smP{3B25N*pOl-OR+8UoniR}hmx0}@okKO(m zgZX9*D->Miu@7cL5j#y+qS{8xXjJH`6ZoZ z_0un0AVT|?_dS>0qjo2U?Y~EP(W#iUyX>&fwq-l^vo71u?O0Y4+q&8w=WVj7Lv3O* zEqWccRlyWM>!58e`FAuOnUm4m4&(+(A$)y%@Z4FdA@ajUb~Exg?WpZnh&gq*#`>ob z9kXzZ8jMw|Q*$tIy(h3w7C-hw+&pvS!UMv%(?876Oda}YxuDum_zu7XyS6=HhL$NR4W^7)gW~`*DlyjKNM4m20*+OkT;Ce7$vvva#f;jj5i=n)jYyQ8vqI9$2 zu#_*?!5Oq_g~BAhb!@=Sn@u=KnI|)1V=z~PBJoReM#2)?Z#V50=TWm+4S-kWT5=)> z;l@c|`uw=8q-DTSdavE*`9+2sSWGRSw(Xlo1j|tZj!-RYpe$tV`XN|Ukow&2%tk@f zQZxOZj;GFoL9J2+&02eLTB zz(rWTzM)7Q%d^mc3;vFQq8K~kpStVOpV|vg{(cpN<>0fbuA_wMscnmye3Dm}@tY^- zA*R$o0TUl#kxI=izi`^s1+SXf>&$PmoRVkTxXOlDG!)gV*HaIS;a4=ibp z7?BQtklj%u-d(QEUY%F|_Oa_@-N`<#MFe(1Hj`pB=zqK6|Cts1DdsNu|Kx<(FaAfP MuBr{KP__#DFV7Tty8r+H literal 0 HcmV?d00001 diff --git a/doc/ci/pipelines.md b/doc/ci/pipelines.md index ea47d676edb..44589500eb0 100644 --- a/doc/ci/pipelines.md +++ b/doc/ci/pipelines.md @@ -193,6 +193,18 @@ stage has a job with a manual action. ![Pipelines example](img/pipelines.png) +### Delay a particular job in the pipeline graph + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21767) in GitLab 11.4. + +When you do not want to run a job immediately, you can [delay the job to run after a certain period](yaml/README.md#delayed). +This is especially useful for timed incremental rollout that new code is rolled out gradually. +For example, if you start rolling out new code and users do not experience trouble, GitLab automatically completes the deployment from 0% to 100%. +Alternatively, if you start rolling out and you noticed that a few users experience trouble with the version, +you can stop the timed incremental rollout by canceling the pipeline, and [rolling](environments.md#rolling-back-changes) it back to the stable version. + +![Pipelines example](img/pipeline_incremental_rollout.png) + ### Ordering of jobs in pipeline graphs **Regular pipeline graph** @@ -211,6 +223,7 @@ by name. The order of severity is: - pending - running - manual +- scheduled - canceled - success - skipped diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index 8b770495853..f0738252640 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -673,6 +673,42 @@ user wants to trigger an action. In other words, in order to trigger a manual action assigned to a branch that the pipeline is running for, user needs to have ability to merge to this branch. +### `when:delayed` + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21767) in GitLab 11.4. + +Delayed job are for executing scripts after a certain period. +This is useful if you want to avoid jobs entering `pending` state immediately. + +You can set the period with `start_in` key. The value of `start_in` key is an elapsed time in seconds, unless a unit is +provided. `start_key` must be less than or equal to one hour. Examples of valid values include: + +- `10 seconds` +- `30 minutes` +- `1 hour` + +When there is a delayed job in a stage, the pipeline will not progress until the delayed job has finished. +This means this keyword can also be used for inserting delays between different stages. + +The timer of a delayed job starts immediately after the previous stage has completed. +Similar to other types of jobs, a delayed job's timer will not start unless the previous stage passed. + +The following example creates a job named `timed rollout 10%` that is executed 30 minutes after the previous stage has completed: + +```yaml +timed rollout 10%: + stage: deploy + script: echo 'Rolling out 10% ...' + when: delayed + start_in: 30 minutes +``` + +You can stop the active timer of a delayed job by clicking the **Unschedule** button. +This job will never be executed in the future unless you execute the job manually. + +You can start a delayed job immediately by clicking the **Play** button. +GitLab runner will pick your job soon and start the job. + ## `environment` > **Notes:**