Working on installer.to with SCoRe Lab for GSoC 2020: Week 4

Heshan Geasman
SCoRe Lab
Published in
2 min readJun 24, 2020

My previous Medium article got published under SCoRe as https://medium.com/scorelab/working-on-installer-to-with-score-lab-for-gsoc-2020-week-3-824408cb5975!

This week I started working on creating the generator for installer scripts. We planned to use TOML files for defining the installer steps from the beginning. TOML has a very simple format and very clean when it comes to defining things like configurations with it.

[Foo]
bar = "test1"

Here we define an object called Foo and it has a property called bar which has value test1. We can use this to define installations scripts for different installation methods.

Following is how we used it for defining the installer scripts

[apt]
sh = """
echo "Installing hello"
echo "Installed hello"
"""
[yum]
sh = """
echo "Installing hello"
echo "Installed hello"
"""

Because the installation commands are multi-line, I used TOML’s multi-line string definition method which uses """.

My initial plan was to parse the file using bash scripts but my mentors said to go with Python because parsing TOML files are a lot simple in Python compared to parsing with a bash script and anyone will be able to go through the generator’s code and contribute with adding improvements to it.

Even though I’m not much familiar with Python, I took it as a challenge and started implementing it in Python. Both my mentors helped me a lot on this.

I was finally able to complete it and sent my second PR! It went through lot of iterations, and got lot of comments on the PR also. I added lot of error handling scenarios and used best practices like using loggers to give out proper logs everywhere necessary.

Now the generator can generate installer script using the TOML definitions and my next step was to use the GitHub Actions to automate the script generator process. Because we had GitHub action setuped for PR which will look at the diff and identify the modified or changed files only, I could use the same to get the list of installers my generator has to look for TOML files with each PR. Now I have to convert the existing installer scripts to the new TOML format and generate them using my generator. I will be working on this in the coming week.

--

--