Skip to content

alexander-scott/zuul_job_browser

Repository files navigation

Zuul Job Browser - VSCode Plugin

How do I install the plugin?

Install from this VSCode Extension Marketplace: https://marketplace.visualstudio.com/items?itemName=alexander-scott.zuulplugin. To uninstall follow these instructions.

Requirements

  • Requires VSCode version ^1.44.0.

Limitations

  • With large amounts of Zuul configuration, the plugin does not work very well over remote SSH.

How do I effectively use the plugin?

The best way to use this framework is by creating a multi-root workspace that has all the repositories/folders than contain your job definitions. For help creating a multi-root workspace follow this link. This plugin will scan all folders that are added to the workspace and link any defined jobs in any of the folders together.

Multi-Root Workspace

After the jobs have been parsed you're good to go! To see the number of jobs that have been parsed, look to the bottom left of the window:

Status Bar Job Count

What does the plugin allow me to do?

Jump to Job defintion

Further information here. It is currently implemented for:

  • Jumping to a parent job definition in any file in the workspace (Ctrl+Click / F12).
  • Jumping to a job definition from a project template.

Jump to Job definition

Jump to Playbook from usage

This allows you to jump to the playbook from it's usage in a Job (Ctrl+Click / F12).

Jump to playbook definition

Jump to Ansible variable declaration from usage

This allows you to jump to location where the variable was defined (Ctrl+Click / F12). The logic adheres to parent/child inheritance and will jump to the lowest level that a variable has been declared.

Jump to Ansible variable definition

Show Job Definitions

Further information here. This currently allows you to:

  • See all job definitions in a file (Outline Window).
  • Quick search amongst job names.
  • Quick search amongst job names from all files in a workspace (Ctrl+T).
  • Jump quickly between the definitions.

Outline window

Search symbols

Show Job Hierarchy

Show the call hierarchy between parent and child jobs (Ctrl+Shift+H). This currently allows you to:

  • See the outgoing call hierarchy: currnt job to parent job.
  • See the incoming call hierarchy: current job to child jobs.

Job Hierarchy

Show all Job References

Further information here. This currently allows you to:

  • See all jobs that reference this job as a parent in any file in the workspace (Shift+Alt+F12).
  • Peek at these jobs.
  • Show jobs referenced in project templates.

Find references

Show Job Variables on hover

Hovers show information about the job that's below the mouse cursor. This currently allows you to see:

  • The variables of the job and all parents job.
  • Child jobs overwrite the variables of parent jobs.
  • These variables can also be seen in project templates.

Hover

Renaming all instances of a job with a single click

Further information here. This using this feature renames the job in the following places:

  • The name attribute in the main job definition.
  • All instances of this job being referenced from child jobs (through the parent attribute).
  • ALl instances of this job in all project templates.

Rename job

How does it work?

All yaml files in the Zuul.d folder are parsed to find jobs and job attributes. This light weight job hierarchy is then stored in memory and fetched when needed. There are also file watchers present to see when a valid file is Saved, Created and Deleted.

Future Features

  • Show errors and warnings -> Duplicated job names, modifying jobs marked as final, running jobs marked as abstract.
  • Code completion -> Auto complete variable names and job names