Hello! Today, we’ll explore how to leverage Backstage Scaffolder, a core component of platform engineering, to “spin up standard projects with security guardrails.”
We’ll share how to manage, through code, not just “copying code,” but who creates it, for what purpose, and in compliance with which security policies. π οΈ

1. Anatomy of a Template π¦΄
A Backstage template is broadly divided into Metadata (name, description), Parameters (user input), Steps (execution stages), and Output (result guidance).
YAML
# 1. Defining the template's identity
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
name: standard-python-service
title: "π‘οΈ λ³΄μ νμ€ Python Flask μλΉμ€"
description: "KISA 보μ κ°μ΄λλΌμΈκ³Ό CI/CD μ€μΊμ΄ λ΄μ₯λ νμ€ API μλ²λ₯Ό μμ±ν©λλ€."
tags: [standard, security, python]
spec:
owner: platform-team
type: service
# 2. 'Questionnaire' to receive input from the user
parameters:
- title: "κΈ°λ³Έ μ 보"
required: [component_id, owner]
properties:
component_id:
title: "μλΉμ€ μ΄λ¦"
type: string
description: "μμ±ν νλ‘μ νΈμ μ΄λ¦ (μλ¬Έ/μ«μ/-)"
owner:
title: "λ΄λΉ ν"
type: string
ui:field: OwnerPicker # Select Backstage registration group
- title: "μ μ₯μ μ€μ "
required: [repoUrl]
properties:
repoUrl:
title: "GitHub μμΉ"
type: string
ui:field: RepoUrlPicker # Select repository creation location
ui:options:
allowedHosts: [github.com]
# 3. The 'automation process' where the real magic happens
steps:
- id: fetch-base
name: "νμ€ μ€μΌλ ν€ κ°μ Έμ€κΈ°"
action: fetch:template
input:
url: ./skeleton # Template source folder
values:
name: ${{ parameters.component_id }}
owner: ${{ parameters.owner }}
- id: publish
name: "GitHub μ μ₯μ μμ± λ° νΈμ"
action: publish:github
input:
allowedHosts: ['github.com']
description: "Created by Backstage Scaffolder"
repoUrl: ${{ parameters.repoUrl }}
- id: register
name: "μΉ΄νλ‘κ·Έ μλ λ±λ‘"
action: catalog:register
input:
repoContentsUrl: ${{ steps['publish'].output.remoteUrl }}
catalogInfoPath: '/catalog-info.yaml'
# 4. Results to show the user after completion
output:
links:
- title: "μμ±λ GitHub μ μ₯μ 보기"
url: ${{ steps['publish'].output.remoteUrl }}
2. Detailed Code Explanation for Each Core Step π
π Parameters: The Art of Data Input
The information users input is not just plain text. Using ui:field calls advanced components integrated with the Backstage system.
- OwnerPicker: Real-time search and selection of teams registered in the organizational chart. π₯
- RepoUrlPicker: Selects an authorized GitHub organization and instantly determines the repository name.
π Steps: The Core Engine of Automation
- fetch:template: This is the most crucial step. It copies files from the ./skeleton folder and ‘substitutes’ variables like ${{ values.name }} with the actual values entered by the user.
- publish:github: More than just uploading code, it creates a new repository via the GitHub API and makes an initial commit. π°οΈ
- catalog:register: Ensures the newly created service immediately appears in the Backstage management list (Catalog), preventing “shadow IT.”
3. The Heart of the Project: The Skeleton Folder π¦΄
What’s inside the ./skeleton folder that the template references? It’s the standard specification.
./skeleton/catalog-info.yaml (Example) This file is created along with the project and acts as the service’s ‘identity card’.
YAML
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: ${{ values.name | dump }}
description: "μ΄ μλΉμ€λ νμ€ ν
νλ¦ΏμΌλ‘ μλ μμ±λμμ΅λλ€."
spec:
type: service
lifecycle: experimental
owner: ${{ values.owner | dump }} # The team entered during creation is automatically assigned as the owner!
Tip: By using ${{ values.owner }} here, ownership management is automatically handled upon creation. π‘οΈ
4. The Results This Blueprint Delivers π
Executing this template provides developers with the following deliverables within one minute:
- GitHub Repository: A repository with a standard code structure and CI/CD (GitHub Actions) setup completed. π
- Security Settings: Starts with security scan configurations like Trivy or Snyk included by default. π
- Management Automation: Registered in the Backstage Catalog, allowing immediate verification of dependency graphs and documentation (TechDocs). π‘
π₯ Conclusion: Why Manage with Code?
If developers manually write catalog-info.yaml and configure GitHub settings, typos or omitted security settings are common. However, with a Scaffolder blueprint, “organizational standard policies” become the “starting point of the project”.
Now, apply this code to your Backstage! Your platform engineering journey will become even more robust. π
Leave a Reply