Improve project creation with programmable project templates
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Release notes
Problem to solve
As a Platform Engineer, I want a project bootstrapping method that sets up a new, production-ready, immediately deployable microservice project with all the bells-and-whistles required in my company, so the developers I serve can focus on the business logic.
As a Software Engineer, I want a project creation wizard with a few inputs that results in a new, production-ready, immediately deployable microservice project with all the bells-and-whistles required in my company, so I don't have to learn how to write or edit GitLab pipelines or any other infrastructure and security concepts my company follows, but I can focus on writing the business logic.
The code templates functionality of Backstage provides a great example why our project templates are very much not enough. This functionality is summarized from the platform engineers, adoption point of view in this video: https://youtu.be/TZ6-SpoFVeY?t=474
Current solutions:
- Use Backstage
- Use a project management project as described in idea 3 below without any support for such a concept from GitLab.
Proposal
Use pipelines to run automation that results in a fully configure project. In both cases, the project creation consists of the following steps:
- pick a template
- provide the required and optional inputs
- hit submit / run the automation
- redirect to the newly configured project
MVC iterations
v1 user story
The platform engineer:
- Creates a new, empty project (let's refer to this project as the "wizard project")
- Creates a
.gitlab/gitlab-wizard.yml
and writes a CI component within - Includes the wizard to
.gitlab-ci.yml
- Registers the project as a group or instance level project template
The Development team lead:
- Opens the new project creation page (https://gitlab.com/projects/new)
- Selects "Create from template"
- Sees the list of templates and wizards (it's a single list as we use the same registration that templates do, but the actions differ)
- show an "empty state" banner at the top of the list of no wizards are found
- The wizards offer two actions:
- Learn more: opens the project created by the platform engineer, just like "Preview" does for dumb templates
- Use wizard: to be explained in the following steps
- Clicks "Use wizard"
- GitLab renders a form using the
inputs
of the CI component defined in.gitlab/gitlab-wizard.yml
- path: https://gitlab.com/projects/new?project=path/to/project#use_wizard or https://gitlab.com/projects/new#use_wizard=path/to/project (whichever is easier to implement)
- User fills out the form
- User submits the form by clicking "Run wizard"
- GitLab starts a pipeline (actually, the user starts the pipeline) in the wizard project (on the main branch) (pipeline API)
- caveat: use needs to have at least "Developer" role in the wizard project to kick-off a pipeline
- GitLab redirects the user to the pipeline to follow progress
v2 - Auditability
Goal: make usage auditable, support troubleshooting
- Add syntax to mark an input as
sensitive
to CI components- Not in scope: it might be a good idea to automatically mask the sensitive values in the pipeline; this is out of scope for this issue
Minor changes are made in the Development team lead's experience starting after they hit the "Run wizard" button:
- User submits the form by clicking "Run wizard"
- GitLab opens an issue in the wizard project with all the details:
- title: Wizard run by user X at 2024-11-14 13:24
- description:
- who started it (gitlab handle + human name)
- when
- what were the inputs provided, omit the
sensitive
attributes - what was the git sha of the wizard project
- GitLab starts a pipeline (actually, the user starts the pipeline) in the wizard project (on the main branch)
- As the pipeline got created, GitLab updates the description of the issue, and appends a link to the pipeline
- GitLab redirects the user to the issue created
v3 - Flexible wizard
Goal: enable multi-page wizard forms that take inputs based on other inputs, etc
The platform engineer
- Adds
.gitlab/gitlab-wizard-form.json
to the wizard project - Writes a form definition using JSON forms. It's their responsibility to ensure that the form always ends up with valid inputs for the wizard CI component
The Development team's experience changes when they click "Use wizard":
- Clicks "Use wizard"
- GitLab renders a form using the JSON forms
- User fills out the form
Note: In the end we should be able to generate a form with AND without a .gitlab/gitlab-wizard-form.json
being present.
v4 - Remove support for dumb templates
Goal: simplify GitLab by removing superseded features
- GitLab creates a CI component that takes a single input (let's call it
project_slug
), and forks the project where it's run underproject_slug
- GitLab deprecates the current dumb templates, and recommends users to migrate them to wizards
- GitLab changes the "new stuff"
➕ menu (to the left of the user profile image)- adds "Run wizard" item under "In GitLab" as the first option
- GitLab changes the new project creation page "Create from template"
➡️ "Create with wizard" - Dumb templates remain in the list, but use the "Learn more" and "Use wizard"
- When a dumb template is selected (that's better called a wizard without
.gitlab/gitlab-wizard.yml
) GitLab shows an error page to explain the user how to migrate the template by adding the CI component from step 1, or how to fork the project without keeping the upstream relationship (what dumb templates actually do).
Alternatively, GitLab could do magic and pretend that the CI component from step 1 is to be used, but magic is dangerous. Let's leave magic to wizards!
This approach allows our users to migrate their templates with minimal work, and improve the templates as we can educate them about the feature.
(The attentive reader might have noticed that the wizards are more powerful than just being able to create projects. They allow platform engineers to codify any regularly needed actions into a wizard. That's why we don't call them project wizards, but simply wizards.)
Intended users
- Delaney (Development Team Lead) - benefits from it through usage
- Sasha (Software Developer) - benefits from it through usage
- Priyanka (Platform Engineer) - benefits from it through writing the templates
Feature Usage Metrics
- Number of projects created with programmable templates
This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.