|
218 | 218 | when: |
219 | 219 | - 'kdevops_archive_demo|bool' |
220 | 220 |
|
221 | | -- name: Get current date in YYYYMMDD format |
| 221 | +- name: Check if ci.trigger file exists |
| 222 | + stat: |
| 223 | + path: "{{ topdir_path }}/ci.trigger" |
| 224 | + register: ci_trigger_file |
| 225 | + |
| 226 | +- name: Read ci.trigger file if it exists |
| 227 | + slurp: |
| 228 | + path: "{{ topdir_path }}/ci.trigger" |
| 229 | + register: ci_trigger_content |
| 230 | + when: ci_trigger_file.stat.exists |
| 231 | + |
| 232 | +- name: Set kdevops_archive_test_subject from ci.trigger |
222 | 233 | set_fact: |
223 | | - current_date: "{{ '%Y%m%d' | strftime }}" |
| 234 | + kdevops_archive_test_trigger: "{{ ci_trigger_content.content | b64decode | trim }}" |
| 235 | + when: ci_trigger_file.stat.exists |
224 | 236 |
|
225 | | -- name: Construct base directory path |
| 237 | +- name: Set kdevops_archive_test_subject in case ci.trigger is not set |
226 | 238 | set_fact: |
227 | | - kdevops_archive_base: "{{ kdevops_workflow_name }}/{{ current_user.stdout }}/{{ target_linux_tree }}/{{ current_date }}" |
| 239 | + kdevops_archive_test_trigger: "{{ target_linux_tree }}" |
| 240 | + when: not ci_trigger_file.stat.exists |
228 | 241 |
|
229 | 242 | - name: Get current date in YYYYMMDD format |
230 | 243 | set_fact: |
231 | 244 | current_date: "{{ '%Y%m%d' | strftime }}" |
232 | 245 |
|
233 | 246 | - name: Construct base directory path |
234 | 247 | set_fact: |
235 | | - kdevops_archive_base: "{{ kdevops_workflow_name }}/{{ current_user.stdout }}/{{ target_linux_tree }}/{{ current_date }}" |
| 248 | + kdevops_archive_base: "{{ kdevops_workflow_name }}/{{ current_user.stdout }}/{{ kdevops_archive_test_trigger }}/{{ current_date }}" |
236 | 249 |
|
237 | 250 | - name: Ensure base directory exists |
238 | 251 | file: |
239 | 252 | path: "{{ kdevops_results_archive_dir }}/{{ kdevops_archive_base }}" |
240 | 253 | state: directory |
241 | 254 | mode: '0755' |
242 | 255 |
|
243 | | -- name: Get current date in YYYYMMDD format |
244 | | - set_fact: |
245 | | - current_date: "{{ '%Y%m%d' | strftime }}" |
246 | | - |
247 | | -- name: Construct base directory path |
248 | | - set_fact: |
249 | | - kdevops_archive_base: "{{ kdevops_workflow_name }}/{{ current_user.stdout }}/{{ target_linux_tree }}/{{ current_date }}" |
250 | | - |
251 | 256 | - name: List all directories in base path |
252 | 257 | find: |
253 | 258 | paths: "{{ kdevops_results_archive_dir }}/{{ kdevops_archive_base }}" |
|
278 | 283 | set_fact: |
279 | 284 | kdevops_archive_test_number: "{{ next_number }}" |
280 | 285 |
|
281 | | -- name: Set complete archive prefix |
| 286 | +- name: Check if ci.subject file exists |
| 287 | + stat: |
| 288 | + path: "{{ topdir_path }}/ci.subject" |
| 289 | + register: ci_subject_file |
| 290 | + |
| 291 | +- name: Read ci.subject file if it exists |
| 292 | + slurp: |
| 293 | + path: "{{ topdir_path }}/ci.subject" |
| 294 | + register: ci_subject_content |
| 295 | + when: ci_subject_file.stat.exists |
| 296 | + |
| 297 | +- name: Set kdevops_archive_test_subject from ci.subject |
282 | 298 | set_fact: |
283 | | - kdevops_archive_prefix: "{{ kdevops_archive_base }}/{{ next_number }}/{{ target_linux_ref }}/" |
| 299 | + kdevops_archive_test_subject: "{{ ci_subject_content.content | b64decode | trim }}" |
| 300 | + when: ci_subject_file.stat.exists |
284 | 301 |
|
285 | | -- name: Set complete archive prefix |
| 302 | +- name: Set best-effort heuristic subject in case ci.subject is not set |
286 | 303 | set_fact: |
287 | | - kdevops_archive_prefix: "{{ kdevops_archive_base }}/{{ kdevops_archive_test_number }}/{{ target_linux_ref }}/" |
| 304 | + kdevops_archive_test_subject: "{{ target_linux_tree }} {{ target_linux_ref }} result #{{ kdevops_archive_test_number }}" |
| 305 | + when: not ci_subject_file.stat.exists |
| 306 | + |
| 307 | +- name: Generate git-format-patch style filename from subject |
| 308 | + set_fact: |
| 309 | + kdevops_archive_ci_subject_patchform_name: >- |
| 310 | + {{ |
| 311 | + (kdevops_archive_test_subject | lower |
| 312 | + | regex_replace('[^a-z0-9]+', '-') |
| 313 | + | regex_replace('^-+|-+$', '') |
| 314 | + | regex_replace('-+', '-') |
| 315 | + )[:52] ~ ( |
| 316 | + (kdevops_archive_test_subject | length > 52) | ternary('...', '') |
| 317 | + ) |
| 318 | + }} |
| 319 | +
|
| 320 | +- name: Set complete archive prefix with subject-based name |
| 321 | + set_fact: |
| 322 | + kdevops_archive_prefix: "{{ kdevops_archive_base }}/{{ kdevops_archive_test_number }}/{{ kdevops_archive_ci_subject_patchform_name }}/" |
288 | 323 |
|
289 | 324 | - name: Create target directory if it doesn't exist |
290 | 325 | file: |
|
312 | 347 | environment: |
313 | 348 | GIT_LFS_SKIP_SMUDGE: "0" |
314 | 349 |
|
| 350 | +- name: Check if ci.commit_extra file exists |
| 351 | + stat: |
| 352 | + path: "{{ topdir_path }}/ci.commit_extra" |
| 353 | + register: ci_commit_file |
| 354 | + |
| 355 | +- name: Read ci.commit_extra file if it exists |
| 356 | + slurp: |
| 357 | + path: "{{ topdir_path }}/ci.commit_extra" |
| 358 | + register: ci_commit_content |
| 359 | + when: ci_commit_file.stat.exists |
| 360 | + |
| 361 | +- name: Set kdevops_archive_test_subject from ci.commit_extra |
| 362 | + set_fact: |
| 363 | + kdevops_archive_test_commit: "{{ ci_commit_content.content | b64decode | trim }}" |
| 364 | + when: ci_commit_file.stat.exists |
| 365 | + |
| 366 | +- name: Set kdevops_archive_test_subject in case ci.commit_extra is not set |
| 367 | + set_fact: |
| 368 | + kdevops_archive_test_commit: "No extra test report details available." |
| 369 | + when: not ci_commit_file.stat.exists |
| 370 | + |
| 371 | +- name: Check if ci.result file exists |
| 372 | + stat: |
| 373 | + path: "{{ topdir_path }}/ci.result" |
| 374 | + register: ci_result_file |
| 375 | + |
| 376 | +- name: Read ci.result file if it exists |
| 377 | + slurp: |
| 378 | + path: "{{ topdir_path }}/ci.result" |
| 379 | + register: ci_result_content |
| 380 | + when: ci_result_file.stat.exists |
| 381 | + |
| 382 | +- name: Set kdevops_archive_ci_test_result from ci.result |
| 383 | + set_fact: |
| 384 | + kdevops_archive_ci_test_result: "{{ ci_result_content.content | b64decode | trim }}" |
| 385 | + when: ci_result_file.stat.exists |
| 386 | + |
| 387 | +- name: Set kdevops_archive_ci_test_result in case ci.result is not set |
| 388 | + set_fact: |
| 389 | + kdevops_archive_ci_test_result: "unknown" |
| 390 | + when: not ci_result_file.stat.exists |
| 391 | + |
315 | 392 | - name: Set commit message |
316 | 393 | set_fact: |
317 | 394 | commit_message: | |
318 | | - {{ kdevops_workflow_name }}: {{ target_linux_tree }} {{ target_linux_ref }} result #{{ kdevops_archive_test_number }} |
| 395 | + {{ kdevops_archive_test_trigger }}: {{ kdevops_archive_test_subject }} |
319 | 396 |
|
320 | 397 | This adds test results for: |
321 | 398 | workflow: {{ kdevops_workflow_name }} |
322 | 399 | tree: {{ target_linux_tree }} |
323 | 400 | ref: {{ target_linux_ref }} |
324 | 401 | test number: {{ kdevops_archive_test_number }} |
| 402 | + test result: {{ kdevops_archive_ci_test_result }} |
| 403 | +
|
| 404 | + Detailed test report: |
| 405 | +
|
| 406 | + {{ kdevops_archive_test_commit }} |
325 | 407 |
|
326 | 408 | - name: Commit the archive |
327 | 409 | shell: | |
|
0 commit comments