Creating Job templates using the Job as Code plugin
Use the Job as Code (JAC) plugin to create build job templates by defining build workflows in JSON or YAML configuration files stored in your source code repository.
- Install the latest Job as Code plugin from the plugin portal.
- Ensure that a JSON or YAML configuration file, such as
builder.json, exists in the source code repository. - Verify that the source code repository is configured and accessible from the DevOps Build environment.
The Job as Code (JAC) plugin enables you to create and maintain build job templates as configuration files instead of manually configuring build steps through the DevOps Build user interface. By storing workflow definitions alongside source code in Git, JAC provides a single source of truth for build automation.
JAC supports configuration files stored anywhere within a source code repository. During build execution, the plugin retrieves the configuration file from the branch that triggered the build and dynamically generates the workflow defined in the file.
A configuration file can define steps such as:
- Create stamp
- Populate workspace
- Change log
- Shell script
- Status assignment
- Cleanup
Using JAC provides the following benefits:
- Version control: Build workflow definitions are stored with the source code and tracked through Git.
- Self-service configuration: Developers can modify build pipelines by updating configuration files without requiring administrative access to the CI tool.
- Branch-specific workflows: Different branches can use their own JSON or YAML configuration files, allowing build steps to be customized or skipped for specific branches.
- Consistency: Build processes are defined once and executed consistently across environments.
- On the left navigational panel, click .
- Click Create.
- In the Create a Job dialog box, type a name for the job in the Name field.
- From the Teams list, select a team to manage the workflow.
- Click Save.
-
Click the Steps tab to add steps to the job.
- Click Save.
The job template is created and uses the workflow defined in the specified JSON or YAML configuration file. When a push or pull request triggers a build, the system dynamically generates and executes the configured workflow.