Tag Archives: Jenkinsfile

News from the blog 2022-08-22

Life is hard

Tony, my friend that I knew since 30 years ago has passed away.

We re-took contact after many years of losing communication, after he found my blog, knew about the recovery from my health problems, and he reached me through Twitter.

Then we met in Barcelona one last time, as I went to visit my doctors.

We had lovely moments then, and he explained me all his problems and also talked me about his success in IT helping that company. One man army, doing what an entire team would be needed to do, alone.

I had the chance to tell him goodbye. Although I never knew that it would be the last time I would see him.

Summer is a period where people don’t talk, they’re an holiday. So I didn’t want to worry after I saw that some time after he had not read my messages, although I had that feeling that something was off. And in August his son wrote me, through his phone, explaining me that Tony passed away one month ago.

He called me, unfortunately I was sleeping when he called me. I had to know from a text message.

Losing Tony is hard. He was really a good person. A good one.

He always had problems setting boundaries and people took advantage of him.

And another friend came to my mind. My advice guided him to a successful career in IT. He was an amazing person. Always willing to step up and put himself in front to help you. Some people have been hurt in life, but instead of becoming assholes they choose to be good, they choose to help others. This other friend I’m talking about committed suicide 9 years ago, I got the call telling me that this happened and that in that precise moment it was the funeral when I was at the airport waiting for my flight to Menlo Park, where I was going to interview with Facebook. During that time a girl I fell in love with had already started taking advantage of me, breaking my hearth, putting me in competence, trying to have me while she had a boyfriend. Lying to everybody to her convenience, and to me, obviously. She was really cruel, taking advantage of me in these moments I was extra vulnerable. Also, taking in count that my first love had mental problems and attempted suicide. That girl took advantage of my generosity and my honesty, my goodness… and made me suffer horribly as with her lies I though she also could commit suicide. She avoiding to be clear. Lied. Played mind games.

Hurt people hurt people.

I would had tried to save my friend, 9 years ago, if I had known he had problems. I didn’t see it coming. And I tried to leave the airport and go to the funeral but the person calling considered that I should avoid going to protect me, as I could be affected. I asked to tell me where the funeral was and they told me that would call me back, and when they called me back the funeral had finished. I was unable to say goodbye to my friend. I flied to the US to have an interview for a SDM (Software Development Manager) in the SRE (Site Reliability Engineering) Facebook that could change my life and the life of my family. I didn’t sleep and I didn’t tell the company what happened to my friend. Talking about it felt like betraying him, and I was asking myself if it would be fair: I didn’t want to get a job out of compassion and somehow getting advantage of her death somehow.

Knowing that my friend Tony has left us has left me heartbroken. I’ve cried.

And here, in Ireland, I’ve nobody to whom I can talk and explain how sad it is to have lost a beautiful soul like Tony. Fortunately I have plenty of a network support that I talk with using digital technologies and a friend of mine came and stayed with me and that help a lot.

I also remember my friend Isa. Isa was a brilliant Engineer before we well named Engineers. She had worked with punch card, she gave me some, and had to fight a big rat that was eating the cables from a supercomputer of the time, that she programmed.

In my career I’ve been very fortunate to get to know excellent women that were Engineers. And I saw some cowards bullying them, marginalizing them.

I remember an excellent Engineer, working with Unix and Nginx, being bullied by a sad person. A manager unable to do what she could to in the Terminal with one eye closed. She was so drained that every day, after work, had to take a nap to recover. I stepped up and befriend her, not allowing the bullies to target her and having her isolated. I knew that I could become a target too, but you have to decide how you act in life.

She leaved the company.

I remember my friend Isa, that was mistreat for years. In a world of men, of jealous men, being a women independent and intelligent, sharp, more clever than them, was something that some of the guys wanted to destroy.

I didn’t leave her alone.

She was brave.

One day she explained me that in a two days travel organized from the company, one colleague was nice to her and they ended sleeping together.

Next day, at the table where all the colleagues were seating they told her that it was a bet. The guy bet that he would sleep with her. All the gorillas had laugh at her believing that they would hurt her and her feelings.

She smiled and complained and complained to the male group:

– So, another day select a guy that is competent at bed. I also have the right to have fun!

And the guy that did the bet and slept with her felt humiliated.

This was my friend Isa. Brave. Clever. A good person. A character.

After few years I left the company, and at some point she got cancer.

I didn’t know. I was so busy working. I’ve been working a lot during my life.

I was fortunate that I called to say hi how things, and she explained me that she was at the hospital.

I went to visit her immediately. We had fun few minutes, and she got tired. We were so happy to see each other. She told me that the doctors told her that her death was imminent.

I saw that her flame was leaving her body. I kneel, I kissed her hand, and leaved. I called a common friend, Villa, that went to visit her the next day, and the next day she was gone.

I and my friend Villa were just in time to say goodbye.

Isa was an excellent person, from whom others took advantage.

I truly believe that she got cancer after being exposed to a toxic environment and toxic people at work for years.

About Tony I’m glad to have had the possibility to see him one last time. I was able to say goodbye, even if I didn’t know that it was a goodbye.

He kissed my hands and I could feel how much love was in here. I kissed his hand too. Something I never did before to another male.

Life is hard. Like many of you I was not the lucky one. I had to work really hard to progress in life. Being backstabbed often by lazy, jealous people. Liars. Some people choose to act dirty, shady, instead of putting effort to improve.

Some people take all their pain and become assholes, causing pain to others and being unfair to anybody.

Other people choose not to hurt others, and to improve.

All the friend I talked about were really good people. Very beautiful souls. Very beautiful human beings.

In different times of my life I was so busy working for improving my economy as a result of the selfish and abusive acting from some people that hit my economy, to help my family specially during the crisis, to pay the bills from the medicines, doctors… so busy giving my everything at work to the companies I was helping, that I didn’t talk too much to some amazing friends, and I was so busy fighting my own battles for surviving that I didn’t see it coming and they were gone. Some could not take the hits that life and other people were inflicting to them continuously, others were took away by sickness. And there was nothing I could do. I’ve been gentle and nice many times to people that they didn’t have idea on how broken I was inside.

I was being so nice to that girl that took advantage of me when I though she could be one of the ones that needed help and support, and she was really cruel, liar, manipulative and mistreated me in a moment that I could not defend myself (specially with some things that she told me, making me believe she was depressed and that could commit suicide)

Some people don’t give a shit about if you suffer, or they make you suffer, or they don’t give a shit about if they are robbing your happiness, they take take take. Some people are broken and broke others. They will never tell you how much you mean for them, how many things you bring to their lives, and they will belittle you instead to keep you small, controlled, under their control like a puppet.

Some companies will also take take take. They will not express how much you helped them. How crucial was your help. How valuable you are. They will not pay you bonus for your ideas which gave them huge profits or your manager will steal your credit and get a huge salary raise and promotion. They will not raise your salary…

My best advice is to don’t wait for others to protect you. Take care of yourself. Set boundaries. It’s a road I had to traverse myself and it’s worth it.

If people that take their life could understand how important they are for us. How much we love them and how blessed we are to have them in our lives.

And good people that get bullied and feel alone and sad, if I could lend you my strength so you could see life through my eyes. Life can be a wonderful world. If you let your inner happiness manifest, you live to your values, and you start taking responsibility of your own well being and security and you start setting boundaries.

If you protect yourself, and you don’t leave in into your life toxic people or employments, you’ll see how the right one approach to you.

And then you will see that there are also amazing people that help others, and are not waiting to take advantage of you. And if they tried you won’t allow it. In any case being able to protect yourself and being able to set boundaries that effectively prevent you from being abused from others it’s absolutely worth it.

If you stand and fight for yourself you’ll realize that you have an amazing life where you can do whatever you want!.

And you’ll get to know people that are like you: honest, brave, gentle souls. It is worth fighting. If you get to a point that you want to leave this world because of assholes mistreating you, send them to hell, care about yourself, and live your best life. Bonus points if you also can help others.

That girl that I mentioned called me old man in my face when I was grieving from my friend. She was mean and cruel and later she would come looking for me, for my unconditional love, for my kindness, one time and another, in a cycle of agony for me where I made everything to make her smile believing she was a good person that experienced some trauma, instead of a selfish dark soul. I believed she could commit suicide and she never clarified a thing. She was a liar, manipulative and secretive. That was 9 years ago. I was not old. But I lost a lot of time protecting myself and being super careful with the people I met and I didn’t allow others to enter into my circle easily. I was so protective of my damaged feelings that I avoided enjoying the company of the good people too. Bad people rob you much more than time. They may even rob your future, or your dreams of having a family.

Nowadays I look myself in the mirror and I see wrinkles under the skin in my eyes. And I know I’m aging. That so many people taking taking taking made me lose a lot of time. But I’m a good person, I’m happy, and I’ve a lot of energy. And I can contribute a lot to make the world a better place. You’ll hear from me.

My Health

The way I recovered it’s simply miraculous.

I was super disciplined with my diet and with the medicines, and my progress has been unbelievably good. I reduced many medicines, and I’m in the process of switching one daily to another one weekly. I’m also doing huge efforts to lose weight. And I’m being successful. That’s not easy as the medicines are well known to help gain weight.

My doctors were super happy. They even asked me if I would like to participate in a study that monitors the progress of extraordinary successful and disciplined people.

I said yes. Because the data they gather will help others and save lives.

Being losing weight with my current medicines is not easy, as they make gain weight. I’m hungry many times. I skip meals several times, following the advice and monitor from the doctor and I eat with intelligence, like an Engineer. Also a secondary effect of the weekly medicine is that you feel a strange and uncomfortable sensation of being full and empty at the same time. And I have to monitor myself often, to make sure the replacement from daily medicine 1 to weekly medicine 2 is not affecting adversely my health.

I’ll be successful no matter what.

Changes to the Blog

  • I updated one of my articles from 2013, with relevant information nowadays, for Enterprises moving their workloads to the Cloud for higher availability and to outsource their Operations/System Administration tasks to fully managed services.
  • I improved a bit the organization of the Categories for the Blog.
    • Added Microsoft Azure to Cloud Providers
    • Moved all the Digital Ocean content from a stand-alone Digital Ocean Category to Digital Ocean Category under Cloud Service Providers and removed the first one

Carles in the News

The New Digital World

The New Digital World, my radio program with Radio America Barcelona and streamed via Twitch is on holidays until the 5th of September.

However, I’ve continued to feed with news and a Special Summer Edition in my blog.

For personal reasons I stopped doing videos, but I keep adding relevant news, entertainment and curiosities. ASAP when my energy is back to optimal state I’ll continue recording videos for you. In any case, the radio program on the 5th of September will be streamed as usual and later uploaded to Apple, Souncloud, Spotify… by my colleagues, and to Youtube from my side for my program The New Digital World.

The Summer Edition from the 1st of August, in English:

A demo for ABK IT during pandemic

I’ve uploaded this video from Feb 2021, in the middle of the covid pandemic lockdown, when isolated at home, with the stores closed, everything closed, some Engineers were saving the day ensuring players could play their favorite video games.

I felt so proud to be selected to demo one of my Open Source projects to the rest of Activision Blizzard King IT colleagues.

I created a plugin to communicate my Open Source CTOP.py project to a Raspberry Pi 4 and turn on different LEDs depending on the CPU load.

A friend provided the voice that I recorded as MP3 for “The system is Healthy” or “CPU load is too high” :)

Firewall

Russia and Belarus

I keep blocking any IP range that connects to the blog coming from Russia or Belarus until they abandon Ukraine and stop the war.

Some bullies don’t have enough with Russia being the shame of the world in the 21st Century, killing innocent people in Ukraine, but they send threats to anybody that don’t look to another side, as you can see from this message:

I’m sorry for my good friends from Russia, that are ashamed of what their president and these kind of bullies do, and see how these kind of people are ruining Russia’s people future and their economy.

CSP’s

I keep blocking Cloud Providers after I see bots attacking/looking for exploits.

I get a lot of bots attacking and looking for vulnerabilities or trying to publish spam and I block the entire range after I double check that it belongs to a Cloud Provider/VPS or to a proxy tor network gateway.

I’m sorry for your Twitter bots and other tools that scan the blog from time to time and get dropped as the IP is part of these ranges, but at the end of the day my blog is for humans. To help Engineers. I don’t have any ads (other than my books if that counts) and I don’t make any money from it. In fact over these years it has costed me a little fortune paid to Amazon and Google Cloud.

I just help humans. Abusive bots don’t have room in this blog.

Books

My Books

I have updated Docker Combat Guide version 25, to explain in detail:

• Show usage of USER command in Dockerfile
• Explaining WORKDIR
• Explaining ARG
• Explaining ENV
• Overriding ENV variables from Command Line
• Overriding or setting ENV variables from Command Line using a file and the argument --env-file
• I have also added the article about how to create a Jenkins Docker Container based in Ubuntu 20.04 LTS with Volumes and persitence and the plugin Blue Ocean for Pipelines installed

Thanks to

Thanks to Jetbrains for renewing my Licenses for all their products based on my Open Source Work!.

Python

I’ve written a small program that uses the built-in ipaddress to validate IP Addresses and Networks.

Validate IP Addresses and Networks with CIDR in Python

Also a Docker with a Telnet server and a Python code accessing the server via telnet and executing several commands.

PHP

The videos of all the recorded talks of the 2022 Dutch PHP Conference – Online June 24th.

My life at Activision Blizzard

I recorded this at the office, during July.

Info for Junior Developers

Liz explains the starting salary, for Entry Level Engineers in the US and tips and tricks.

Humor

Thanks Chef for the humor memes sent. :)

Seems a prank TBH, but I’ve seen similar actual offers with other languages…
So true!

Very interesting reflection, credit https://twitter.com/PDLComics:

I hope a Git Merge does not trigger

News from the blog 2022-07-22

Carles in the News

For all my friends and followers, I started to translate my radio space “El nou món digital” (in Catalan) to English “The New Digital World”. I cover Science, Technology, Entertainment and Video games.

You can see the first programs I translated here:

Catalan and English programs RAB

And the script and links mentioned here:

https://blog.carlesmateo.com/2022/06/20/rab-el-nou-mon-digital-2022-06-27-ca/

Social

I’ve created an Instagram fan page for me / for the blog.

It is open for everybody.

https://www.instagram.com/blog_carlesmateo/

Videos for learning how to code

Learning How to code Python Unit Tests with pytest from the scratch, for beginners:

I added it to my series of videos:

https://blog.carlesmateo.com/learn-python-3-unit-testing/

Video for learning how to use RabbitMQ with Python in a Docker Container

https://blog.carlesmateo.com/2022/07/20/creating-a-rabbitmq-docker-container-accessed-with-python-and-pika/

Site carlesmateo.com

I use mostly this site https://blog.carlesmateo.com to centralize everything, so I’ve kept http://carlesmateo.com as a simple landing page made with my old (from 2013) ultra fast PHP Framework Catalonia Framework.

I decided to create a Jenkins Pipeline to deploy any updates to this pages and I updated it a bit at least to provide the most common information searched.

Don’t expect anything fancy at Front End level. :)

Cloud

I created a video about how to provision a Ubuntu Droplet in Digital Ocean.

It’s just for beginners, or if you used other CSP’s and you wonder how Digital Ocean user interface is.

It is really easy, to be honest. Amazon AWS should learn from them.

I also created another about how to provision using User Data Cloud Init feature:

https://blog.carlesmateo.com/2022/06/25/how-to-deploy-a-digitalocean-droplet-instance-and-use-userdata/

Books

My Books

I have updated Docker Combat Guide to show how to work with different users in the Dockerfile and accessing an interactive terminal.

I have also added how to create a Jenkins containerized.

Books I bought > CI/CD

I recommend you these books:

I’ve created a video about how to deploy jenkins in Docker, following the official documentation, in 4 minutes.

Install jenkins on Docker in ubuntu in 4 minutes

And posted an article about solving the error load key invalid format when provisioning from Jenkins with your SSH .pem Key in a variable.

https://blog.carlesmateo.com/2022/07/05/solving-linux-load-key-ssh_yourserver-invalid-format-when-provisioning-from-jenkins/

Open Source from Carles

CTOP.py

I have released a new version of CTOP, ctop.py version 0.8.9.

This version fixes few bugs, and adds better Unit Testing Code Coverage, and is integrated with jenkins (provides Jenkinsfile and a Dockerfile ready to automate the testing pipeline)

Sudo ku solver, Sudoku solver in Python, and Engineering solving problem approach

I’ve created this video explaining my experience writing a program to solve two impossible, very annoying Sudokus. :)

https://blog.carlesmateo.com/2022/04/26/working-on-a-sudoku-solver-in-python-source-code/

Commander Turtle: a small program in Python so children can learn to code by drawing

Children can learn to code and share their scripts, which are comma separated, easily.

Commander Turtle

My life at Activision Blizzard

We have released World of Warcraft Dragonflight Alpha.

In the sync meetings I lead with Wow SRE and product Team I was informed that streaming would be open. Myself I was granted to stream over twitch, but so far I didn’t want to stream video games in my engineering channels. It’s different kind of audiences IMO. Let me know if you would like to get video game streams in my streaming channels.

Lich King

Humor

If you have been in a madness of Servers of a Cluster getting irresponsible and having to cold reboot them from remote hands iDracs or similar, you know why my friends sent me this image :D

Creating Jenkins configurations for your projects

Obviously for companies is a must, but if you work in your own projects, it will be super great that you configure Jenkins, so you have continuous feedback about if something breaks.

I’ll show you how to configure Jenkins for several projects using only your main computer/laptop.

Check my past article about setting up Jenkins in Docker.

Adding a new Freestyle project

Click on top left: New item.

Then give it an appropriate name and choose Freestyle Project.

Take in count that the name given will be used as the name of the workspace, so you may want to avoid special characters.

It is very convenient to let Jenkins deal with your repository changes instead of using shell commands. So I’m going to fill this section.

I also provided credentials, so Jenkins can log to my Gitlab.

This kind of project is the most simple and we will use the same Docker Container where Jenkins resides, to run the Unit Testing of our code.

We are going to select to Build periodically.

If your Server is in Internet, you can active the Web Hooks so your Jenkins is noticed via a web connection from GitLab, GitHub or your CVS provider. As I’m strictly running this at home, Jenkins will be periodically check for changes in the repository and do nothing if there are no changes.

I’ll set H * * * * so Jenkins will try every hour.

Go down and select Add Build Step:

Select Execute shell.

Then add a basic echo command to print in the Console Output, and ls command so you see what is in the default’s directory your shell script is executing in.

Now save your project.

And go back to Dashboard.

Click inside of Neurona.cat to view Project’s Dashboard.

Click: Build Now. And then click on the Build task (Apr 5, 2021, 10:31 AM)

Click on Console Output.

You’ll see a verbose log of everything that happened.

You’ll see for example that Jenkins has put the script on the path of the git project folder that we instructed before to clone/pull.

This example doesn’t have test. Let’s see one with Unit Test.

Running Unit Testing with pytest

If we enter the project CTOP and then select Configure you’ll see the steps I did for making it do the Unite Testing.

In my case I wanted to have several steps, one per each Unit Test file.

If each one of them I’ve to enter the right directory before launching any test.

If you open the last successful build and and select Console Output you’ll see all the tests, going well.

If a test will go wrong, pytest will exit with Exit Code different of 0, and so Jenkins will detect it and show that the Build Fails.

Building a Project from Pipeline

Pipeline is the set of plugins that allow us to do Continuous Deployment.

Inform the information about your git project.

Then in your gitlab or github project create a file named Jenkinsfile.

Jenkins will look for it when it clones your repo, to build the Pipeline.

Here is my Jenkinsfile in https://gitlab.com/carles.mateo/python_combat_guide/-/blob/master/Jenkinsfile

pipeline {
    agent any
    stages {
        stage('Show Environment') {
            steps {
                echo 'Showing the environment'
                sh 'ls -hal'
            }
        }
        stage('Updating from repository') {
            steps {
                echo 'Grabbing from repository'
                withCredentials([usernamePassword(credentialsId: 'ssh-fast', usernameVariable: 'USERNAME', passwordVariable: 'USERPASS')]) {
                    script {
                        sh "sshpass -p '$USERPASS' -v ssh -o StrictHostKeyChecking=no $USERNAME@$ip_fast 'git clone https://gitlab.com/carles.mateo/python_combat_guide.git; cd python_combat_guide; git pull'"
                    }
                }
            }
        }
        stage('Build Docker Image') {
            steps {
                echo 'Building Docker Container'
                withCredentials([usernamePassword(credentialsId: 'ssh-fast', usernameVariable: 'USERNAME', passwordVariable: 'USERPASS')]) {
                    script {
                        sh "sshpass -p '$USERPASS' -v ssh -o StrictHostKeyChecking=no $USERNAME@$ip_fast 'cd python_combat_guide; docker build -t python_combat_guide .'"
                    }
                }
            }
        }
        stage('Run the Tests') {
            steps {
                echo "Running the tests from the Container"
                withCredentials([usernamePassword(credentialsId: 'ssh-fast', usernameVariable: 'USERNAME', passwordVariable: 'USERPASS')]) {
                    script {
                        sh "sshpass -p '$USERPASS' -v ssh -o StrictHostKeyChecking=no $USERNAME@$ip_fast 'cd python_combat_guide; docker run  python_combat_guide'"
                    }
                }
            }
        }
    }
}

My Jenkins Docker installation has the sshpass command, and I use it to connect via SSH, with username and Password to the server defined by ip_fast environment variable.

We defined the variable ip_fast in Manage Jenkins > Configure System.

There in Global Properties , Environment Variables I defined ip_fast:

In the Build Server I’ll make a new user and allow it to build Docker:

sudo adduser jenkins_build

sudo usermod -aG docker jenkins_build

The Credentials can be managed from Manage Jenkins > Manage Credentials.

You can see how I use all this combined in the Jenkinsfile so I don’t have to store credentials in the CVS and Jenkins (Docker Container) will connect via SSH to make the computer after ip_fast Ip, to build and run another Container. That Container will run with a command to do the Unit Testing. If something goes wrong, that is, if any program return an Exit Code different from 0, Jenkins will consider the build fail.

Take in count that $? only stores the Exit Code of the last program. So be careful if you pass multiple commands in one single line, as this may mask an error.

Separating the execution in multiple Stages helps to save time, as after a failure, execution will not continue.

Also visually is easy to see where the error is.