Skip to content

Skip build stages that have no operations

Overview

A job might not use all the sections, for example this specific job so GitLab Runner creates a section for the cache but has no output like the following:

[0Ksection_start:1561016085:restore_cache
[0Ksection_end:1561016086:restore_cache
[0Ksection_start:1561016086:download_artifacts
[0Ksection_end:1561016088:download_artifacts

This leads to show a collapsible button for an empty section like below:

Screen_Shot_2019-06-20_at_14.26.01

GitLab Runner will create a section, and execute the script and then close the section again and since there is no output of that section it will show up empty to the user.

Possible Fixes

Before we execute a stage such as upload_artifact_on_failure check beforehand if we actually need to run the stage or not. If we don't run an empty stage we wouldn't create an empty section and we would also save up on build time, since we wouldn't need to execute 1 more setp.

Edited by Steve Xuereb