Build Checkpoint 4

Learning Goal

I will be working as a DevOps lead this year.

At work, multiple teams work remotely in at least 3 environments. They are pre-production, production, and testing environments. It is imperative that I become fluent in git so that I can be of great use as a product owner at work. The gap between where I am currently and my target is as follows: Before I started this build journey, I could only run 4 commands in git. The target is to get to a level where I am not only fluent in it as a user, but also able to oversee developers’ commits and address issues. I do not know how different environments such as pre-prod, test, and prod work within Git, either.

By becoming fluent in Git, I mean I would have a solid understanding of the difference between workflows. The workflows are as follows:

  • Centralised workflow,
  • Feature branch workflow,
  • Gitflow workflow,
  • Forking workflow

Reflexivity and critical thinking

Some of the following screenshots were taken while I am working on the Group CPS project. Initially, we wanted the Raspberry Pi 4 to be the computation power behind the CPS. We failed early and we failed fast. This sort of basic python and command line arguments are also crucial in being a DevOps lead. When I first started, I did not even know the difference between python shell and a standard command line. Even then, on Visual Studio on my laptop, I spent a sizeable chunk of time setting the environment variables and also learning the difference between power shell and the standard command line. Since I am using anaconda package, I had to get used to the slight difference in the commands in conda as well. It all sounds quite simple when I talk like this, but in reality, when you are in the midst of it, it is not a glamorous task to be undertaking. But gradually, I started enjoying the tasks of setting the environment up on my laptop. I cannot share the code base that I get to see at work for obvious security reasons, but the tasks that I once thought was too much is now a lot more doable.

As I am illustrating the work below, you will see I am not just focusing on Git. I am also showing the python development work that I have conducted. This is because, at the end of the day, as a DevOps engineer, I am polishing my python skills as well. I may never be a full-time python developer, but having a good grasp of python is necessary to do the code review, gauge the duration of tasks and also gain the respect of my developers.

Supporting Evidence 1 – installing the correct version of TensorFlow on Raspberry Pi 4.

For my individual CPS project in semester 1, I referred to this youtube tutorial.
As you can see it demonstrates how to clone the git using an https address.
This command here is changing the mode to an executable.
We download tensorflow using that wheel file.
But before installing any tensorflow, uninstall any other version of tensorflow. I did not have any on my laptop.
The tutorial ran the uninstall command twice, once as sudo and second as non-sudo.

I tried different combo of shell and tensorflow on the github, in particular, tensorflow 2.5 and python 3.x combos, none of them worked, so I followed the exact combo the youtuber was demonstrating. Tensorflow has many versions and I had to use the specific versions the tutor is using.

Supporting Evidence 2 – text and image scraping using beautifulsoup library and bing image search library

Installing requests, beautifulsoup and decouple libraries. Decouple libraries help a developer to shield the bing API keys from the shared Git depositories. It did not work in my environment. I just used the git ignore file.
‘pip freeze’ commands outputs requirements text. Until I learned this command, I always thought the requirements text was written manually but they are not. Everyone was using this command haha.
These are bing generated API keys.
Making sure the keys are not accidentally submitted to git.
We will look at the webPages, which will give us the web results.

The reason that bing image search is useful, we can filter them by the licenses. We can also just get photos rather than getting cluttered with GIFs, adult contents, etc.

Supporting Evidence 3 – Understanding and Applying the fundamentals of Git

CD is basically like “double clicking” and getting into the folder. Repository is my project.

Git is a tool that tracks the changes in my code over time. GitHub is a website where I host all of my git repositories. GitHub makes it easy for people to work together. And organise my portfolio for my potential employers.

A repository is a project, all of my folder, coding, and everything. ‘md’ refers to ‘Mark Down’. It is basically an easy way to format this sort of text.

This Create is a placeholder text, but if I do not write anything down, it will use this as the text by default.

If I want to see the history of all the commits, I click on the 2 commits on the top left.

And each commit has a unique identifiable number. And I can also see the message.

This means the red line was deleted and the green with the plus is added.

Most linux and Mac based command lines have git installed.

But if one does not have it, the best tutorial on how to install git is the one by Atlassian.

The author of the youtube tutorial, Gwen Faraday recommends for Windows version of Git, Git Bash.

Gwen recommends Homebrew version for Mac. Most likely, though, git is already installed in most cases.

Cloning what I created on git repo for the group cps project.

The command ls -a shows all files including .git

First, use git status commands.

git status command shows the files that are modified, but not yet committed.
“Untracked files” means that git does not know about these files yet. So to get git to track the file, we need to use the “git add” command.
Most of the time, we use git add . This means add/track all the files.
“git status” command shows which files are modified.

“git commit” command commits the changes with messages to my own local repository. It is important to note that the changes are not live in the main repository yet.

For the committed changes to be live, we need to use the ssh keys. I did not know how it works forever. This is because at my work, someone generated the key for me.

ssh-keygen -t rsa -b 4096 -C “git hub email address”

The above command sets the kind of encryption, and the strength of the encryption.

This is what I got once the whole ssh creation was finished. This means the ssh-key is successfully generated.

ls | grep testkey_name is the key that I would upload to my online github interface. ‘pub’ stands for public. This means it is okay for other people to see this key.

The tutor shows a sweet tip on how to copy my file.
Pasting the key manually on github.
Failures :This method did not work for me initially. It failed at the “eval …” command.

I did a bit of googling and found this stackoverflow link:

All I had to do was to run “bash” command before running the eval command.

Once I run “bash”, then the command line interface changes and the “$” sign appears.

At one point, I lost the following:

Then, all you have to do is to run “git init” command.

Failures: “git push origin master” did not work for a while. At some point, it asked for Git username and password. I later figured out this is because I set the master with url, not ssh. The following StackOverflow page came in handy.

As you can see some origins are https, not ssh. So I removed the https addresses.
Only showing ssh remote.
Failure: Another error. As it turned out, I did not commit the repo yet at this stage.
Strangely, simple “git push” worked.
“git push origin main” worked but not “git push origin master”. I was wondering about this for a while. Later I found out the only branch in the repo is named “main”.

Application of cybernetic techniques, tools, and resources

DevOps is not a technology, it is a methodology. DevOps is a way of building, evolving, and rapidly changing systems at scale. DevOps is a practice of operations and development engineers participating together in the entire software lifecycle from design through the development process to production support. One can also say that DevOps is also characterised by operation staff making use of many of the same techniques as developers for their system.  DevOps is a software development strategy that bridges the gap between software and operations side of the company and helps us to deliver good quality software in time. This happens because of the various stages and tools involved in DevOps. The DevOps diagram is an infinite loop. Everything happens continuously. This is why it is also called ‘Continuous Integration and Continuous Development’. My team may not use all of these tools, and we will configure whatever we need.

For me to practice as a cybernetician, that is, a helmsman of this team that is delivering a packaged application, I need to learn the holistic view of how DevOps works and its tools. Git is only one of many tools used throughout the DevOps lifecycle, but it is the tool that I chose to get great at. Often I am the bridge between the developers and the operations team. The operations team would like to know the honest and realistic development timeline, and what features are possible. The development team is always pressed with time but it is great to have a real understanding and visibility as well. And sometimes, the ops team wants features that are way too costly in reality and I need to communicate back why that is not possible with the money and time we have. All this communication between the two teams needs to be evidence-based. This is why I am getting good at DevOps procedures and tools.