A guide to creating a Jenkins job to build and publish images on Docker Hub

plastic building blocks scattered on a floor
plastic building blocks scattered on a floor
Image by Markus Spiske on Unsplash

Build jobs are at the heart of the Jenkins build process. You can think of a Jenkins job as a specific task or step in your build process. A build can involve compiling your source code, running tests, packaging it, and publishing it.

In this article, we will create a Jenkins job that:

  • Infers remote branches of a given project

By the end of this tutorial, you should have something like the following:


In this post, we will set up a private PyPI server using the pypiserver Docker image, which will be wrapped by NGINX for caching and performance.

Photo by Spencer Judd on Unsplash

What is PyPI?

The official docs:

The Python Package Index (PyPI) is a repository of software for the Python programming language.

PyPI is the official 3rd party software repository for the Python language.

To install packages from the PyPI repository, you will need a package installer. The most common and recommended one is pip.

PyPI is public, anyone can access it and download any package listed there. However, sometimes you want to create your own private repository, mainly for security reasons.

Docker Setup

To set up a PyPI server, you will need a server — it can be your own machine, your friend’s, or a…


I believe that the shell prompt shouldn’t be too cluttered. Here’s mine:


Image credit: plotplot | Shutterstock.com

In this short article, I’ll try to explain why we get the following:

$ python3
Python 3.9.0 (default, Dec 6 2020, 18:02:34)
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ~True
-2

Think about bool, you'll find that it is numeric in nature - It can hold two values, "True" and "False", and they are just ‘customized’ versions of the integers 1 and 0, that only print themselves differently.

So now it’s clear that bool is actually a subclass of int:

>>> type(True)
<class 'bool'>
>>> isinstance(True, int)
True
>>> True == 1…


In this article, we will create a minimal Spring Boot application that uses GitHub for authentication.

Photo by Park Troopers on Unsplash

What is OAuth 2.0?

OAuth is an open-source standard for access delegation. It grants applications access to users' protected resources via an authorization server.

For example, let’s suppose you’re developing a code scanning application, and you want to get access to users’ code on GitHub. Asking users for their credentials is not a realistic solution — no one will ever share sensitive data with you. This where OAuth comes in. Using the OAuth authorization mechanism, services can authorize against each other on the user’s behalf:

  1. Your application asks…


Problem: Given a positive integer, write a code to find if it is a power of two or not.

“A number is a power of two” means that it can be written as 2^x where x is an integer. For example:

  • 8 is a power of two = 2³
Image by Matt Artz on Unsplash

The immediate solution: Take the log of the given number on base 2 and if you get an integer then the number is the power of…


The simplest container setup imaginable. Start here

Building’s foundation
Building’s foundation
Photo by Mirko Blicke on Unsplash.

Let’s begin by creating a minimal Flask application:

Simple Flask application

Next, let’s write the command that will run the Gunicorn server:

The parameters are pretty much self-explanatory: We are telling Gunicorn that we want to spawn two worker processes running two threads each. We are also accepting connections from the outside and overriding Gunicorn’s default port (8000).

Our basic Dockerfile:

Dockerfile

Let’s build our image:

docker build -t flask/hello-world .

And run:

docker run -p 8003:8003 flask/hello-world

The application is now accessible since we published the port:

$ curl localhost:8003
Hello world!

Running With Local K8s via Minikube

Assuming you already have Minikube running…


Figure out which commit introduced that new bug

Binoculars facing a lake
Binoculars facing a lake
Image By Shane Hauser on Unsplash.

“git-bisect — Use binary search to find the commit that introduced a bug” — Git’s official docs

It’s best to go through a real example in order to understand this command and demonstrate how it works.

Let’s create an empty Git project and add the following commits:

git commit --allow-empty -m 'good commit 1' git commit --allow-empty -m 'good commit 2' git commit --allow-empty -m 'good commit 3' git commit --allow-empty -m 'good commit 4' git commit --allow-empty -m 'good commit 5' git commit --allow-empty -m 'good commit 6' git commit --allow-empty -m 'BAD COMMIT' git commit --allow-empty -m 'good…


A brief overview of the Unicode system, UTF, ASCII, and encoding

stuffed toys in the shape of emojis
stuffed toys in the shape of emojis
Photo By Kelvin Yan on Unsplash

Computers have their own language. They don’t understand human languages (maybe they do if you speak binary), and they don’t know anything but binary. How do we communicate with them?

As I’m typing now, the computer is not aware of any of the characters you’re seeing. Let’s consider the M character. At the lowest level, M is stored using a sequence of 0s and 1s: 01001101. Before we proceed, let’s recall two fundamental definitions:

Bit — smallest unit of storage, can only store 0 or 1
Byte — one byte = eight bits. That’s it.

Unicode

The Unicode Standard:

“The Unicode…


It is literally true that you can succeed best and quickest by helping others to succeed — Napoleon Hill

Photo By Glen Noble on Unsplash

If you’ve ever been interested in programming or anything related to and been around the net long enough, you’ve come across Stack Overflow, accidentally or on purpose.

What is Stack Overflow?

Stack Overflow is a question and answer site for professional and enthusiast programmers. It’s built and run by you as part of the Stack Exchange network of Q&A sites. With your help, we’re working together to build a library of detailed answers to every question about programming.

It was in…

Maroun Maroun

Software engineer | Music geek | Beer lover

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store