Skip to main content
In this lesson you will learn how to use a custom transformer to translate source CI/CD runner labels into equivalent GitHub Actions runners and to centralize environment variable mappings. This is useful when migrating pipelines (for example, from Jenkins) that reference self-hosted agents or custom labels so they run on GitHub-hosted runners like ubuntu-latest.
A blue-to-teal gradient presentation slide with the title "Custom Transformer — runner variables" centered. A small "© Copyright KodeKloud" appears in the bottom-left.
What the transformer provides
  • A runner helper to map a source runner label to one or more GitHub Actions runner labels.
  • env helpers to centralize environment variables or map them to repository secrets.
Common runner mapping examples Example mappings (Ruby syntax):
  • First parameter: source CI/CD runner label (string).
  • Second parameter: GitHub Actions label(s), either a string or an array of strings.
Dry-run the importer to preview generated workflows Run a one-time dry-run of the importer to produce the converted workflow files (trimmed output shown):
Original converted workflow (example) Some jobs in the converted workflow may still reference self-hosted runner labels and agent-specific labels, for example:
Update the transformer to map runners and envs To replace source labels with GitHub-hosted runners and to centralize environment variables, add mappings at the top of your transformer file (for example ss-pipeline-transformer.rb). Example transformer mappings:
When writing the mapping lines, ensure correct Ruby syntax (commas between parameters). For instance: runner "us-west-1-ubuntu-22", "ubuntu-latest".
Re-run the dry-run with your custom transformer After saving the transformer, run the dry-run again to regenerate the workflow with the mapped runners and centralized env entries:
Resulting workflow (example) The importer will now emit workflows using the mapped runners and the transformed environment variable entries:
Next steps and references
  • Review all runner mappings in your transformer to ensure coverage for every agent label used in source pipelines.
  • Use env to centralize common variables and secret("...") to map values to repository secrets.
Links and references

Watch Video