The YAML Files

I'm passionate about the world of software development, I never thought that I was going to understand it, but I'm glad that I challenged myself to learn it.
Search for a command to run...

I'm passionate about the world of software development, I never thought that I was going to understand it, but I'm glad that I challenged myself to learn it.
Well, thank you, Nazar. Long time not to see you. I hope that you're alright and thank you for commenting, it took me a while to do this article
I wrote this article after a long time, sorry, I had my struggles. But, I'll try to be more consistent
GitHub Actions is a tool integrated into Github to perform tasks related to the repository given an “event”. I must give credit to this post and its Youtube video because I was of great help in this regard. If you’re in a hurry, here’s the repo conta...
Why Testing? Testing is necessary to ensure that everything works as expected. And, to be honest, we all kinda do it when we are developing. Or am I the only one who uses a bunch of console.log, print, fmt.Println or anything like that everywhere? Fo...

Classes They are the blueprint for its instances (objects that the class produce). JavaScript has had classes since the ES5 language implementations. In there it was introduced to us the native implementations of “classes” was. Typescript extends the...

GitHub Actions is a tool integrated into Github to perform tasks related to the repository given an “event”. I must give credit to this post and its Youtube video because I was of great help in this regard. If you’re in a hurry, here’s the repo conta...

It's a programming paradigm that focuses on the use of functions as a primary building block of software. In JavaScript, functional programming is supported natively, which means that you can use it without any additional libraries or tools. (And all...

YAML is an information transfer language like JSON or XML. And it is used for its simplicity and consistency.
These YAML files end with .yml or .yaml, either of them is correct.
The indentation in YAML is essential, to make an indentation valid you need to use 2 spaces per indentation. Indentation is used instead of curly brackets {}.
You don't end the line with a ; or any other special character.
Use the # symbol to ignore whatever it is in front of this symbol until the end of the line.
# variable: string commented
valid: "not commented"
You use indentation to denote that the variables below are methods of the object. YAML is sensitive to indentation so they all need to be at the same level of indentation.
nameoftheobject:
app: some-name
port: 9000
version: 1.7
Use the - symbol to make a list, remember to indent the variables that belong to that list. But you can also avoid indentation while using lists, so don't get confused when you see them in different forms of indentation. But all elements need to have the same indentation.
microservices:
- app: some-name
port: 9000
version: 1.7
- app: other-name
port: 9002
version: 1.9
microservices:
- some-name
- other-name
- app: dog
port: 19
versions:
- 1.2
- 1.5
- 1.8
You can also use brackets as a primitive.
microservices:
- some-name
- other-name
- app: dog
port: 19
versions: [1.2, 1.5, 1.8]
true false yes no on and off, all of them are used as boolean values.
Use the | symbol to make separate lines, and use the > symbol to make a single line of the string.
multilineString: |
This string is separated
so there is no need to make a buzz
this is how it will be shown
multilineString: >
This line will be shown as
one line, no matter how long
or how many breaks do I make
Use the $ before the name of the environment variable to use it.
command: mysql -h 123.000.000 -u root $THIS_IS_A_PASSWORD -e 'SELECT 1'
Use the double curly brackets {{}}to use placeholders for templates.
app: {{ .Values.service.name }}
Use three dashes --- to separate YAML files inside the same file.
thisIsAVariable: blah-blah-blah
---
thisIsAnotherFileInside: this-is-another-file
Well, that's it for now. I hope it was useful for you. Comment if you have any other suggestions or something to add, I'll be reading you.
Follow me on Twitter, LinkedIn, Instagram, Github, Medium (For more opinion-based posts), and here on Hashnode and my Hashnode blog.
Have a nice day and until next time. Bye.