This is a quick entry to show how the image layers works, according to docker documentation the «The order of Dockerfile instructions matter» and it is because each line in the configuration file is converted into an image layer (cached layer).
This feature allows that every layer can be reused when the image is built or executed, each layer is read-only. For example, create the next python app and the next Dockerfile:
Podman is an open source utility that can be used to create and mantain containers, and provides an good alternative to Docker.
In this entry I’m going to show how to execute some basic commands using a Java project. All source code is published in my GitHub repository.
Virtual machine management commands
Let’s take a look to the commands with the help parameter, I think they are very descriptive:
$ podman machine --help
Manage a virtual machine
Description:
Manage a virtual machine. Virtual machines are used to run Podman.
Usage:
podman.exe machine [command]
Available Commands:
info Display machine host info
init Initialize a virtual machine
inspect Inspect an existing machine
list List machines
rm Remove an existing machine
set Sets a virtual machine setting
ssh SSH into an existing machine
start Start an existing machine
stop Stop an existing machine
The bind mountsin a short is way to set a mount point from the host to the container, it means the files are accesible from the file system where the container is launched, for example it could be useful to mount the source code for a web site into the container and do some code changes in the UI and view them inmediatly without build again the Docker image.
Cool right?
Well for Java projects is not so cool, because when the source code is changed it must be compiled and packaged again to be executed or deployed, but the bind mounts could be useful too when there are some external files like configuration properties, input and output files to read, etc. So, if you are working on development environment or in your local machine, perhaps you would have to consider use the bind mounts to get access easily to the files when you are coding or testing new features.
In this entry I’m going to show how to apply in a Maven Java project. All code can be downloaded from my GitHub repository.
This is a quick entry to show how to use GitHub actions with Sonarcloud account to analyze a single maven project.
1. Install the Sonarcloud application from GiHub Marketplace, go to the market and search sonarcloud and select Configure access > Configure > Repository Access and add your repository to be analized and save it.
A common task in software development is the versioning of the code, in some maven projects I’ve used the maven-scm-plugin to automate the versioning and publish the tags, in my previous post I’ve explained how to configure the pom.xml in a Java project.
In this post I’m going to show how to use the same plugin with a Jenkins Pipeline, the script has a tree steps:
checkout, to get the code from a Git repository
delete tag, to delete tag in the repository
tagging, to publish a new version of code and create a new tag
I found a great tip in GitHub to compact a VHD file without Hyper-V tools and it works great. The Dynamic VHD don’t reduce their size even if the files were deleted from the hard drive, to fix it the «compact» operation is needed. This is included into the Hyper-V tools but this is only available in Windows 10 Pro.
The Compact operation is used to optimize the files. This operation reclaims unused blocks as well as rearranges the blocks to be more efficiently packed, which reduces the size of a virtual hard disk file.
In this post I’m going to show how to execute a bash script into the remote server using a Jenkins Pipeline Step using the sshPublisher plugin, in my previous post I’d showed the other way to configure without plugin.
Setup server autentication
1. Create a new key pair, login with service user for jenkins and create new key pair without passhrase (leave it in blank or you can set if you want secure the private key):
# using the service user
sudo su -s /bin/bash jenkins
# create key pair
ssh-keygen -f ~/.ssh/id_pipessh -t rsa
out:
$ ssh-keygen -f ~/.ssh/id_pipessh -t rsa
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/003084781/.ssh/id_pipessh
Your public key has been saved in /c/Users/003084781/.ssh/id_pipessh.pub
The key fingerprint is:
SHA256:rPIPQ8a74wwumZ7TrtXOXfKcWbcSBgUhgqRnSY9Evf4 GMX+003084781@IBM-PF398HP4
The key's randomart image is:
+---[RSA 3072]----+
| o=o. . oo |
| +.+.. . . |
| . = .. . |
| o ... . |
| .+ S . |
| +.o o |
| ++ *.. ..... |
| =+.B.=E= +.. . |
| .+=o.Boo = .. |
+----[SHA256]-----+
The private key (‘id_pipessh‘) and the public key (‘id_pipessh.pub‘) are created into ~/.ssh
I’ve upgraded my Sonarqube server from the 6.4 to 7.8 version, the last than support MySQL database, according to documentation, the Nodejs > 6.0 is required to analyse Javascript code.
But I didn’t know, until my Jenkins jobs failed. The error is clear, I need to install Nodejs:
org.sonarsource.nodejs.NodeCommandException: Error when running: 'node -v'. Is Node.js available during analysis?
I’ve installed Sonarqube over Red Hat Enterprise Linux 7 (RHEL), the process to install Nodejs is very simple. If the repository is enabled only have to execute this commands in terminal and check the version.