Repository navigation
Refactor Backstage templates: improve UX and simplify service naming - #10
Conversation
…ted output - Rename wizard steps: Service & Source, Networking, Environment, Secure Variables - Remove serviceName field (auto-derived from dockerfileRepo via repoName filter) - Add presentation.buttonLabels: "Release Service" / "Review & Release" - Add structured output with Type, Version, Preview URL + action links - Update field descriptions for host, secretEnvVars, envVars - Rename Component → Service in update-component-config template https://claude.ai/code/session_014HDsuEikXzZ8SDZxwebsuc
There was a problem hiding this comment.
Pull request overview
This PR refactors two Backstage scaffolder templates to improve UX and simplify service naming by automatically deriving the service name from the repository name instead of requiring manual input. It also consolidates form sections, improves field descriptions, and standardizes terminology from "component" to "service" throughout.
Changes:
- Automatic service name derivation from repository name using a
repoNamefilter, eliminating the manualserviceNameinput field - Consolidated form sections with improved organization and clearer field descriptions
- Consistent terminology changes from "component" to "service" across both templates
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| platform-gitops/backstage-templates/deploy-component/template.yaml | Major refactoring: removed manual service name input, consolidated sections, added presentation config, reorganized fields, updated to derive service name from repo name |
| platform-gitops/backstage-templates/update-component-config/template.yaml | Terminology and description updates: "Component" → "Service", improved field descriptions for consistency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| input: | ||
| method: POST | ||
| path: /proxy/vault/v1/secret/data/teams/${{ parameters.teamName | parseEntityRef | pick('name') }}/${{ parameters.serviceName }}/repo-pat | ||
| path: /proxy/vault/v1/secret/data/teams/${{ parameters.teamName | parseEntityRef | pick('name') }}/${{ parameters.dockerfileRepo | repoName }}/repo-pat |
There was a problem hiding this comment.
The repoName filter is not a standard Backstage scaffolder filter. This will cause the template to fail at runtime when trying to process this expression.
If this is intended to extract the repository name from "owner/repo" format (e.g., "dmitriimashkov/my-app" → "my-app"), you'll need to either:
- Define a custom filter in the Backstage app configuration, or
- Use a different approach to extract the repo name
Additionally, even if the filter exists, there's a validation mismatch: the GitHub Actions workflow expects component_name to match the pattern ^[a-z0-9][a-z0-9-]{0,62}$ (lowercase alphanumeric with hyphens), but repository names can contain uppercase letters, dots, and underscores according to the dockerfileRepo pattern. The filter would need to normalize the extracted name to be Kubernetes-compatible.
| owner/repo containing the Dockerfile (e.g. dmitriimashkov/my-app). | ||
| For private repos: install the GitHub App at https://github.com/apps/mctl-me/installations/new | ||
| or provide a PAT below. | ||
| description: "Repository containing the Dockerfile (e.g. dmitriimashkov/my-app). The repo name will be used as the service name." |
There was a problem hiding this comment.
The description states "The repo name will be used as the service name" but doesn't warn users about naming constraints. Since Kubernetes resource names must be lowercase alphanumeric with hyphens only (max 63 chars), and GitHub repository names can contain uppercase, dots, and underscores, this could lead to confusing failures if users provide repos with incompatible names (e.g., "owner/My.Service").
Consider adding a warning to the description, such as: "Repository containing the Dockerfile (e.g. dmitriimashkov/my-app). The repo name will be used as the service name and must be lowercase with hyphens only."
| description: "Repository containing the Dockerfile (e.g. dmitriimashkov/my-app). The repo name will be used as the service name." | |
| description: "Repository containing the Dockerfile (e.g. dmitriimashkov/my-app). The repo name will be used as the service name and must be lowercase with hyphens only to be a valid Kubernetes service name." |
| repoPat: | ||
| title: Repository PAT (optional) | ||
| type: string | ||
| description: >- | ||
| Only needed if the GitHub App is not installed on this repo. | ||
| Fine-grained PAT with 'Contents: Read' scope. | ||
| ui:field: Secret |
There was a problem hiding this comment.
The repoPat field has been moved within the same section but is now positioned between dockerfileRepo and dockerfilePath, which breaks the logical flow. The PAT is an authentication credential, while dockerfilePath is a path configuration related to dockerfileRepo.
Consider moving repoPat after dockerfilePath to maintain better logical grouping: repository → path → version tag → authentication.
| action: onboard | ||
| team_name: ${{ parameters.teamName | parseEntityRef | pick('name') }} | ||
| component_name: ${{ parameters.serviceName }} | ||
| component_name: ${{ parameters.dockerfileRepo | repoName }} |
There was a problem hiding this comment.
The same repoName filter issue applies here. This filter is not a standard Backstage scaffolder filter and will cause runtime failures. The component_name value passed to the GitHub Actions workflow must match the pattern ^[a-z0-9][a-z0-9-]{0,62}$ as validated in the workflow, but there's no guarantee that extracting the repo name from dockerfileRepo will produce a valid value.
| For private repos: install the GitHub App at https://github.com/apps/mctl-me/installations/new | ||
| or provide a PAT below. | ||
| description: "Repository containing the Dockerfile (e.g. dmitriimashkov/my-app). The repo name will be used as the service name." | ||
| pattern: "^[a-zA-Z0-9._-]+/[a-zA-Z0-9._-]+$" |
There was a problem hiding this comment.
The removal of the serviceName parameter and its validation pattern is a breaking change that eliminates an important safeguard. The previous pattern ^[a-z0-9][a-z0-9-]{0,62}$ ensured the service name would be valid for Kubernetes resource names and DNS labels.
With the automatic derivation from dockerfileRepo, there's no validation to ensure the extracted repo name will be Kubernetes-compatible. Repository names can contain uppercase letters, dots, and underscores (per the pattern on line 38), which are not valid in Kubernetes resource names.
Consider either:
- Keeping the
serviceNamefield as an editable field with a default value derived from the repo name, or - Adding validation/transformation logic to ensure the derived name is Kubernetes-compatible
| pattern: "^[a-zA-Z0-9._-]+/[a-zA-Z0-9._-]+$" | |
| pattern: "^[a-zA-Z0-9._-]+/[a-z0-9][a-z0-9-]{0,62}$" |
| type: string | ||
| description: >- | ||
| Only needed if the GitHub App is not installed on this repo. | ||
| Fine-grained PAT with 'Contents: Read' scope. |
There was a problem hiding this comment.
The updated description removes the helpful link to create a PAT (previously included: "Create at: https://github.com/settings/tokens?type=beta"). While the new description is more concise, it would be helpful to retain this link or mention where users can create the PAT, as finding the correct settings page can be non-obvious for users unfamiliar with GitHub's fine-grained tokens.
| Fine-grained PAT with 'Contents: Read' scope. | |
| Fine-grained PAT with 'Contents: Read' scope. Create at: https://github.com/settings/tokens?type=beta |
| owner/repo containing the Dockerfile (e.g. dmitriimashkov/my-app). | ||
| For private repos: install the GitHub App at https://github.com/apps/mctl-me/installations/new | ||
| or provide a PAT below. | ||
| description: "Repository containing the Dockerfile (e.g. dmitriimashkov/my-app). The repo name will be used as the service name." |
There was a problem hiding this comment.
The repository description previously included a helpful link to install the GitHub App ("install the GitHub App at https://github.com/apps/mctl-me/installations/new"). This link has been removed in favor of a more concise description. Consider retaining the installation link in the repoPat field description or in the dockerfileRepo description, as it helps users understand the alternative to providing a PAT.
| metadata: | ||
| name: release-service | ||
| title: 🚀 Release Service | ||
| title: Release Service |
There was a problem hiding this comment.
The rocket emoji has been removed from the template title. While the PR description mentions this is for "consistency", it would be helpful to verify this aligns with the actual convention. The provision-database template still uses an emoji (🗄️) and update-environment uses ⚙️. If the goal is to remove emojis for consistency, those templates should be updated as well, or this template should retain its emoji.
| title: Release Service | |
| title: 🚀 Release Service |
Per codex finding on PR #86: CVE-2026-32237 is actually fixed in @backstage/plugin-scaffolder-backend 3.1.5, not 3.1.1. The GitHub advisory pins 3.1.5 as the minimum patched version; 3.1.1-3.1.4 remain vulnerable. Project's existing ^3.4.0 caret already satisfies >=3.1.5, so the implementer will likely still close as no-op (same as PR #10), but the note should be correct for any future operator reading it.
Summary
This PR refactors two Backstage scaffolder templates to improve user experience, clarify terminology, and simplify the service naming workflow. The changes consolidate form sections, enhance descriptions, and derive the service name automatically from the repository name instead of requiring manual input.
Key Changes
deploy-component/template.yaml:
serviceNameinput field — service name is now derived from thedockerfileRepousing arepoNamefilterdockerfileRepo | repoNameinstead ofserviceNameupdate-component-config/template.yaml:
Notable Implementation Details
owner/my-app→my-app), reducing user input and potential naming inconsistencieshttps://claude.ai/code/session_014HDsuEikXzZ8SDZxwebsuc