Create an empty versatile template for CI
### Release notes
<!-- What is the problem and solution you're proposing? This content sets the overall vision for the feature and serves as the release notes that will populate in various places, including the [release post blog](https://about.gitlab.com/releases/categories/releases/) and [Gitlab project releases](https://gitlab.com/gitlab-org/gitlab/-/releases). " -->
### Problem to solve
When a first-time user starts writing their first pipeline configuration they see an empty blank page with no guidance on how to proceed. GitLab has robust capabilities for pipeline authoring however those are not exposed through our UI. It's very difficult to get started, especially for novice CI users. The path to the first green pipeline isn't easy.
### Intended users
<!-- Who will use this feature? If known, include any of the following: types of users (e.g. Developer), personas, or specific company roles (e.g. Release Manager). It's okay to write "Unknown" and fill this field in later.
Personas are described at https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/
* [Cameron (Compliance Manager)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#cameron-compliance-manager)
* [Parker (Product Manager)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#parker-product-manager)
* [Delaney (Development Team Lead)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#delaney-development-team-lead)
* [Presley (Product Designer)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#presley-product-designer)
* [Sasha (Software Developer)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#sasha-software-developer)
* [Devon (DevOps Engineer)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#devon-devops-engineer)
* [Sidney (Systems Administrator)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#sidney-systems-administrator)
* [Sam (Security Analyst)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#sam-security-analyst)
* [Rachel (Release Manager)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#rachel-release-manager)
* [Alex (Security Operations Engineer)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#alex-security-operations-engineer)
* [Simone (Software Engineer in Test)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#simone-software-engineer-in-test)
* [Allison (Application Ops)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#allison-application-ops)
* [Priyanka (Platform Engineer)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#priyanka-platform-engineer)
* [Dana (Data Analyst)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#dana-data-analyst)
-->
### User experience goal
Provide a basic default template that drives the most pipeline usage. **Make it easy to see the pipeline in action by providing a versatile configuration that will run successfully the first time.**
### Proposal
We should provide new users with a template which drives users to adopt CI/CD. This epic will describe a test plan that builds complexity into the default template to see how best to drive pipeline usage and educate the user on the value of CI/CD.
That template would appear in the Pipeline Editor by default for users who don't have a CI configuration, so they can get started easier.
#### Template Name: Getting started
```
# This is a sample GitLab CI/CD configuration file
# It should run without any modifications, and shows
# a basic CI/CD workflow when added to a project.
stages: # List of stages for jobs, and their order of execution
- build
- test
- deploy
# The default docker image for jobs to use.
image: alpine
# Global defaults apply to all jobs
# See: https://docs.gitlab.com/ee/ci/yaml/#variables
default:
before_script:
- echo "this command runs before every job"
retry: 2 # If a job fails, automatically retry it up to two times.
# CI/CD variables defined at the global level are available to all jobs.
# See https://docs.gitlab.com/ee/ci/yaml/#variables
variables:
DEPLOY_APP: true
DEPLOY_PATH: "example/path"
# Jobs load in a docker container with the docker image specified above, but it
# can be specified in the job too. The script commands run as CLI commands
# within the container.
check_dependencies: # This is a job. The name does not need to be predefined.
stage: build # Specify which stage the job runs in.
script: # Run the following CLI commands in the container.
- echo "This job checks dependencies."
build_code:
stage: build
image: busybox # Use a different image than the one defined globally.
script:
- echo "Compiling the code..."
- echo "The compiled artifact" > compiled.txt
artifacts:
paths:
- compiled.txt # upload this file as artifact
unit_tests: # Jobs in this test stage only run after jobs in the build stage
stage: test # complete successfully.
script:
- echo "Running unit tests..."
- echo "Code coverage is 90%"
coverage: '/Code coverage: \d+%/' # Collect code coverage results from the job's log.
integration_tests:
stage: test
script:
- echo "This job tests something. It will only run when all jobs in the"
- echo "build stage are complete."
- echo "tests_run 254" > metrics.txt
artifacts:
reports:
metrics: metrics.txt # Display these metrics in the merge request.
system_tests: # This demonstrates a job failure, unless the last line is uncommented.
stage: test
script: # Artifacts from jobs in previous stages are automatically
- cat compiled.txt # downloaded and accessible.
- echo "Run system tests... which will fail!"
- exit 1
# allow_failure: true # Uncomment to allow the job to fail without stopping the pipeline.
deploy_app: # Conditionally run this job based on variables values.
stage: deploy
rules:
- if: '$RUN_SYSTEM_TESTS == "true"' # This job only runs if the variable = "true".
script:
- echo "Deploy to $DEPLOY_PATH" # Use variables within CLI script commands
# Other jobs with more advanced features: needs, rules, variables, include, etc.
# ...
```
### Further details
We can enhance that feature and provide smart suggestion in a snippet for different examples such as rules: e.g. run this comment for merge request on master branch only and provide the relevant if statement. (probably out of scope for MVC).
### Documentation
<!-- See the Feature Change Documentation Workflow https://docs.gitlab.com/ee/development/documentation/workflow.html#for-a-product-change
* Add all known Documentation Requirements in this section. See https://docs.gitlab.com/ee/development/documentation/feature-change-workflow.html#documentation-requirements
* If this feature requires changing permissions, update the permissions document. See https://docs.gitlab.com/ee/user/permissions.html -->
### What does success look like, and how can we measure that?
<!--
Define both the success metrics and acceptance criteria. Note that success metrics indicate the desired business outcomes, while acceptance criteria indicate when the solution is working correctly. If there is no way to measure success, link to an issue that will implement a way to measure this.
Create tracking issue using the the Snowplow event tracking template. See https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/issue_templates/Snowplow%20event%20tracking.md
-->
### What is the type of buyer?
<!-- What is the buyer persona for this feature? See https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/buyer-persona/
In which enterprise tier should this feature go? See https://about.gitlab.com/handbook/product/pricing/#four-tiers -->
### Links / references
<!-- Label reminders - you should have one of each of the following labels if you can figure out the correct ones -->
/cc @nadia_sotnikova
epic