Scaffolder Jenkins Client Actions logo

Backstage Scaffolder jenkins client actions Plugin

Created by robertonav20

Scaffolder Jenkins client actions bring Jenkins job management into your Backstage templates. Instead of clicking around in Jenkins, you can create or change jobs as part of a normal template run. It fits teams that run a self hosted Backstage and want Jenkins to be part of the same paved path.

The plugin exposes actions that cover common tasks. You can create a job from a known config. You can copy an existing job. You can enable or disable a job. You can destroy a job when it is no longer needed. You can trigger a build to verify things right away. These actions run inside Scaffolder so every new service can leave the template with a ready Jenkins setup.

Typical use cases are simple. Spin up a pipeline when a new repo is created. Clone a golden job to keep standards across teams. Turn off a risky job during a change freeze, then turn it back on. Retire legacy jobs during a migration. Kick off a first build to smoke test the setup.

The result is less drift and fewer manual steps. Platform teams get consistent naming and layout. Developers get a faster pull request to pipeline path. You keep Jenkins where it works best while letting Backstage own the flow.

Installation Instructions

These instructions apply to self-hosted Backstage only.

Install the backend module

  1. Add the Scaffolder Jenkins module to your backend
Copy
yarn --cwd packages/backend add @backstage-community/plugin-scaffolder-backend-module-jenkins
  1. Register the module in your backend entry point

Edit packages/backend/src/index.ts

Copy
import { createBackend } from '@backstage/backend-defaults';

const backend = createBackend();

// other feature additions

backend.add(
  import('@backstage-community/plugin-scaffolder-backend-module-jenkins'),
);

backend.start();

Configure Jenkins access

Add credentials to your app config

app-config.yaml

Copy
jenkins:
  baseUrl: ${JENKINS_SERVER_URL}
  username: ${JENKINS_USERNAME}
  apiKey: ${JENKINS_API_KEY}

You can keep these values in environment variables in your runtime config

app-config.local.yaml

Copy
jenkins:
  baseUrl: https://jenkins.example.com
  username: backstage-bot
  apiKey: ${JENKINS_API_KEY}

Use the Scaffolder actions in a template

Create a new template in your repo

catalog templates debug-jenkins.yaml

Copy
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: debug-jenkins
  title: debug-jenkins
  description: Template for debugging
  tags:
    - debug
spec:
  owner: user
  type: debug
  steps:
    - id: template
      name: Jenkins create job
      action: jenkins:job:create
      input:
        configPath: /path/to/config.xml
        jobName: test-project-one
        folderName: test-folder

Commit the template as you usually do for your Backstage instance
Reference it from your Scaffolder catalog if needed

Examples for each action

Create job with inline XML

Copy
- id: jenkins-job-create
  name: Jenkins Job Create
  action: jenkins:job:create
  input:
    jobName: first-job
    jobXml: |
      <flow-definition plugin="workflow-job@1447.v559b_c710cd2e">
        <!-- Jenkins XML omitted -->
      </flow-definition>

Create job from a file in your skeleton

Copy
- id: jenkins-job-create
  name: Jenkins Job Create
  action: jenkins:job:create
  input:
    jobName: first-job
    folderName: folder
    folderPath: config/job.xml

Build a job

Copy
- id: jenkins-job-build
  name: Jenkins Job Build
  action: jenkins:job:build
  input:
    jobName: first-job
    jobParameters: some-value

Copy a job

Copy
- id: jenkins-job-copy
  name: Jenkins Job Copy
  action: jenkins:job:copy
  input:
    sourceJobName: source-job
    targetJobName: target-job

Destroy a job

Copy
- id: jenkins-job-destroy
  name: Jenkins Job Destroy
  action: jenkins:job:destroy
  input:
    jobName: first-job

Disable a job

Copy
- id: jenkins-job-disable
  name: Jenkins Job Disable
  action: jenkins:job:disable
  input:
    jobName: first-job

Enable a job

Copy
- id: jenkins-job-enable
  name: Jenkins Job Enable
  action: jenkins:job:enable
  input:
    jobName: first-job

Note that no output is produced by these actions.

Changelog

This changelog is produced from commits made to the Scaffolder Jenkins Client Actions plugin since a year ago, and based on the code located here. It may not contain information about all commits. Releases and version bumps are intentionally omitted. This changelog is generated by AI.

Features

  • Add Jenkins scaffolder actions. Build. Copy. Create. Create with file. Destroy. Disable. Enable. These actions can target a specific server using a serverUrl input. #2903 merged 4 months ago
  • Add first Jenkins scaffolder action to create a job during scaffolding. #1481 merged 12 months ago

Maintenance

  • Remove the private flag so the package is usable. #1721 merged 12 months ago
  • Release the module under the Jenkins workspace for consistency. #1768 merged 12 months ago

Breaking changes

  • None

Set up Backstage in minutes with Roadie