@ckeditor/ckeditor5-dev-ci 40.0.1 → 40.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,9 +31,34 @@ const processJobStatuses = require( '../lib/process-job-statuses' );
31
31
  //
32
32
  // Job A triggers Job B, and Job C has no dependencies. When all jobs are done, we would like to execute Notifier.
33
33
  //
34
- // The Notifier job should also be executed when Job A ends with an error. In such a case, Job B is still blocked.
34
+ // The notifier job should also be executed when Job A ends with an error. In such a case, Job B is still blocked.
35
35
  // Hence, we need to iterate over all jobs and verify if their dependencies ended with an error to unlock
36
36
  // executing the final part of the workflow.
37
+ //
38
+ // When using an approval-based job, the notifier will be waiting for all jobs by default. Finally, it leads to the timeout error.
39
+ // See: https://github.com/ckeditor/ckeditor5/issues/16403.
40
+ //
41
+ // By defining the `--ignore` option, you can skip waiting for particular jobs.
42
+ // You can also specify jobs to ignore
43
+ //
44
+ // Let's consider the example below:
45
+ // ┌─────┐ ┌─────┐
46
+ // │Job A├────►│Job B├──────────┐
47
+ // └─────┘ └─────┘ ▼
48
+ // ┌────────┐
49
+ // │Notifier│
50
+ // └────────┘
51
+ // ┌─────┐ ▲
52
+ // │Job C├──────────────────────┘
53
+ // └─────┘ |
54
+ // ┌─────┐ ┌─────┐ |
55
+ // │Job D├────►│Job E├──────────┘
56
+ // └─────┘ └─────┘
57
+ //
58
+ // The assumption is that "Job D" is the approval job. To ignore it and its children, you can execute
59
+ // the notifier like this:
60
+ //
61
+ // $ ckeditor5-dev-ci-circle-workflow-notifier --ignore "Job D" --ignore "Job E"
37
62
 
38
63
  const {
39
64
  /**
@@ -46,7 +71,7 @@ const {
46
71
  CIRCLE_JOB
47
72
  } = process.env;
48
73
 
49
- const { task } = parseArguments( process.argv.slice( 2 ) );
74
+ const { task, ignore } = parseArguments( process.argv.slice( 2 ) );
50
75
 
51
76
  waitForOtherJobsAndSendNotification()
52
77
  .catch( err => {
@@ -56,11 +81,12 @@ waitForOtherJobsAndSendNotification()
56
81
  } );
57
82
 
58
83
  async function waitForOtherJobsAndSendNotification() {
59
- const jobs = processJobStatuses(
60
- await getOtherJobsData()
61
- );
84
+ const jobs = processJobStatuses( await getOtherJobsData() )
85
+ .filter( job => !ignore.includes( job.name ) );
62
86
 
63
87
  const workflowFinished = jobs.every( job => [ 'success', 'failed', 'failed_parent' ].includes( job.status ) );
88
+
89
+ // If any ignored job failed, all of its children will be marked as 'failed_parent', and thus will not trigger this check.
64
90
  const anyJobsFailed = jobs.some( job => job.status === 'failed' );
65
91
 
66
92
  if ( !workflowFinished ) {
@@ -93,17 +119,28 @@ async function getOtherJobsData() {
93
119
  * @param {Array.<String>} args
94
120
  * @returns {Object} result
95
121
  * @returns {String} result.task
122
+ * @returns {Array<String>} result.ignore
96
123
  */
97
124
  function parseArguments( args ) {
98
125
  const config = {
99
126
  string: [
100
- 'task'
127
+ 'task',
128
+ 'ignore'
101
129
  ],
102
130
 
103
131
  default: {
104
- task: 'yarn ckeditor5-dev-ci-notify-circle-status'
132
+ task: 'yarn ckeditor5-dev-ci-notify-circle-status',
133
+ ignore: []
105
134
  }
106
135
  };
107
136
 
108
- return minimist( args, config );
137
+ let { task, ignore } = minimist( args, config );
138
+
139
+ if ( typeof ignore === 'string' ) {
140
+ ignore = [ ignore ];
141
+ }
142
+
143
+ ignore = ignore.flatMap( item => item.split( ',' ) );
144
+
145
+ return { task, ignore };
109
146
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-dev-ci",
3
- "version": "40.0.1",
3
+ "version": "40.2.0",
4
4
  "description": "Utils used on various Continuous Integration services.",
5
5
  "keywords": [],
6
6
  "dependencies": {