Skip to content

Rerun job with variables for manual jobs

Briley Sandlin requested to merge 361237-used-custom-variables into master

What does this MR do and why?

Resolves #361237 (closed)

This MR allows users to rerun manual jobs with updated variables.

This feature introduces GraphQL to the job app.

Notes

  • This is the first MR of an epic around job app improvements. As such, the code is not super clean. There is still a lot to do. At this point, we want to go ahead and release this feature and then retroactively go back and clean things up. I will make comments about specific updates to help address some of the chaos in the current state.
  • In a recent MR as part of the UI improvements, "retry" has been reworded to "run again" to be more clear that the job was initially successful. Those updates are also reflected in the new GraphQL features in this MR.
  • Fred pointed out to me that the 'retryable' property on the GraphQL CiJob is not baked in with user permissions like the 'retry_path' in the REST job. We do have 'userPermissions' on the CiJob, but I want to be more iterative about switching some of this data out.
  • In testing locally, I noticed that some controls were still available after a job has been erased. While we do have data around erased jobs in the REST job, it doesn't appear that we have that data in the CiJob. I am going to discuss this with @avielle
  • Looks like we need to update the wording of the empty state for re-running jobs with variables. The copy is currently "This job requires manual intervention to start. Before starting this job, you can add variables below for last-minute configuration changes." cc @avielle ?

Screenshots or screen recordings

Sidebar before Sidebar after
sidebar_before sidebar_after
Empty state before Empty state after
empty_state_before empty_state_after

How to set up and validate locally

  • Enable the feature flag Feature.enable(:graphql_job_app)
  • Set up a manual job in your editor. Assuming your have 2 variables, varOne and varTwo, you can use this:
manual_job:
  script:
    - echo "$varOne" "$varTwo"
  when: manual
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  • Navigate to the manual job after running a pipeline.
  • You should see an empty state with the legacy manual variable form and a Trigger button (empty state before screenshot). Enter some variables and trigger the job.
  • After the job runs, instead of a blue rerun button, you should see a dropdown. From here, go through the flow of the designs and make sure the feature behaves as expected.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Dan MH

Merge request reports