# Initiate a
stacks branch with a basic pipeline
As described in Concepts of a stack, we start by creating a stack. Create a
stacks branch containing our stack directory that we will call
stack-sample and put a hello world pipeline template in it. Then add a description of our stack in a .cycloid.yml file.
Follow those steps to apply all changes described in this step
Each stack have to contain a .cycloid.yml file, which describes global information about a stack such as the name, the icon, ansible/terraform paths...
A pipeline is composed of 2 files: a pipeline template file (
pipeline.yml) and an example of variables file (
variables.sample.yml) that are used for the templating using the
groups: - name: overview jobs: - unittest resources: - name: git_code type: git source: uri: ((code_git_public_repository)) branch: ((code_git_branch)) jobs: - name: unittest max_in_flight: 1 build_logs_to_retain: 10 plan: - do: - get: git_code trigger: true - task: test config: platform: linux image_resource: type: docker-image source: repository: cycloid/cycloid-toolkit tag: latest run: path: /bin/bash args: - -ec - | echo "Testing the application" ls code inputs: - name: git_code path: code
A pipeline is the result of configuring Jobs and Resources together. In our example we defined a resource of type
git_code and a job named
Each job have to be part of a
group, it will create group view on Cycloid console to display pipeline jobs.
git_code: is a resource to define a Git repository. This resource will trigger the job to test the code when the repository is updated.
unittest: is a job. It describes steps needed to complete a job. In our case we need to get our website source code, then run tests. Usual steps are:
getstep: Fetches a resource, making it available to subsequent tasks via the given name.
putstep: Pushes to the given Resource. For example, for the git resource, a push would
git commit/pushinto the repository.
taskstep: Executes a Task with inline configuration.
Resources and tasks are based on Docker images. It's really flexible and allows you to provide your own environment or required tools. If you are interested in implementing your own resource, please follow https://concourse-ci.org/implementing-resource-types.html documentation.
get the source code of our website using the
git_code resource (see line 20), then runs a
task to test our website source code. (L22). This test actually just list files but you usually should put the real commands to test your application source code.
outputs are volumes exposed to/from a task with others steps. In our case we say that our task requires the content of the
git_code resource as
input in the directory
# Variables sample
The variables sample file is used as an example when you create a project using Cycloid's dashboard.
env: ($ environment $) project: ($ project $) customer: ($ organization_canonical $) # Code repo configuration code_git_public_repository: https://github.com/cycloid-community-catalog/docs-step-by-step-stack.git code_git_branch: code
The format of this file is pretty simple,
pipeline_variable_name: content. But there is 2 specificities:
- The first 3 lines are Cycloid special variables automatically provided when you create a project.
- The line 6 contains a regular string variable, in our case the url of the git repository to use for our website source code.