YAML stands for Yet Ain’t Markup Language. If you have a configuration file and you want to make it easier to understand to humans then it is better to use YAML.
YAML is a substitution of XML and JSON. It is the case as well as space-sensitive(we can add spaces wherever we want).
It supports various data types(lists, arrays, etc,) as well as popular programming languages(python, java, ruby, etc,).
Points to Remember about
- YAML is not a programming language.
- It is a very simple, text-based language is used for exchanging data between computers and people.
- It matches user expectations as it is human-friendly and works very well with other programming languages.
YAML is used by the automated tool to create an automation process. Used for Kubernetes resources and deployments.
- It is portable between different programming languages
- Easy to implement
- Includes data consistent model
- It uses python like indentation to indicate nesting
- Easy to add to source control just like GitHub.
- It is one of the most popular languages which is human-readable and very easy to understand.
According to the example, a person is an object, we can make multiple sub-objects inside the object.
name, hobbies, and highest qualifications are the list,
age, gender is the subclasses.
YAML File in Concourse
There is not much difference between the YAML and YAML Files. The difference is only in writing the syntax. Save YAML files with .yaml or .yml extension.
Let us understand the above example:-
Every YAML starts with ‘—‘, it specifies the start of the File.
- Jobs are the set of various tasks or steps. They run parallelly. Jobs contain two lists(-name and -task) where -name: specifies the name of the job(it can be any name of your choice) and
- task:, is a step that specifies all tasks we perform in the pipeline. Inside the job task like configuration, adding images, etc.
- Below -name, there is public: true, which means allowing outsiders to view the pipeline builds.
- config:, is a task that denotes what type of container to use, which commands to use, and which worker will run the configuration.
- As docker-compose runs only on Linux, that’s why we use platform: Linux in the above syntax.
image_resource: it tells the container what type of image is used for the pipeline as an output in the concourse build dashboard.
It is the container in the docker-hub that pulls the image for the pipeline.