GitLab Web UI Sometimes Does Not Have Pipeline Variables Available To Render

Summary

The GitLab Web UI sometimes does not have pipeline variables available to render.

Steps to reproduce

GitLab web UI sometimes does not render pipeline variables.

Go to "CI/CD > Pipelines" and click the "run" button. The UI shows "Run for branch name or tag", defaulting to the default branch.

  • If the pipeline defines variables, these are shown in form list. Sometimes these variables are not rendered (a reload usually fixes this).

  • This can also happen when switching the value for "Run for branch name or tag".

What is the current bug behavior?

The UI does not keep polling the backend:

The first time #with_reactive_cache is called, a background job is enqueued and with_reactive_cache returns nil. The background job calls #calculate_reactive_cache and stores its return value.

See our documentation on how reactive caching works.

What is the expected correct behavior?

The UI should continue to keep polling the backend until the data becomes available.

Proposal / More Details on a possible fix

Taking a look at app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue it looks good. backOff is used where we continue fetching for the variables until we get the result we need for 5 seconds. If we don't get the result we need we stop the cycle.

I would recommend we raise an error in the process if we reach an error

Relevant logs and/or screenshots

Instead of the expected 200 response, since the value is nil, a 204 response is provided.

example:

204 — — [Text][OK][CACHE ??]

The HTTP 204 No Content success status response code indicates that a request has succeeded, but that the client doesn't need to navigate away from its current page.

Output of checks

This bug happens on GitLab.com

Possible fixes

app/controllers/projects/pipelines_controller.rb#L206:

...
        result.nil? ? head(:no_content) : render(json: result)
...

list_config_variables_service.rb#L21::

...
      with_reactive_cache(sha) { |result| result }
...
Edited by James Heimbuck