In this post, I am going to create an automatic build trigger via Jenkins Jobs. Basically, after pushing a new piece of code to the target repository/branch, Jenkins will create a new build package from the updated source code. If Jenkins has not been installed yet in your environment, I had explained “How to install Jenkins” in one of the previous articles. If you want to read it, you can access it from here.Continue reading Automatic Build From the GitHub Repository via Jenkins
2 months ago, I decided to use ubuntu OS. Windows is easier than ubuntu (for now) but the storage problem started to be an unmanageable problem for me on Windows. For now, I would say everything is perfect. (Expect permission problems.)
After Ubuntu, some installations and configurations might look different or hard. Because of that, I decided to write a blog about those topics. It is like a note for me in the future 🙂 First topic is Ubuntu. This week, I am going to write about the following topics.
- How to install Jenkins on Ubuntu,
- How to get build after every GitHub commit,
- How to publish build to FTP via Jenkins.
If you don’t have Java on your system, you have to install Java before Jenkins installation. For Java installation, you have to run following commands on your Ubuntu terminal.
sudo apt update sudo apt install openjdk-8-jdk
After installation to check your Java installation, you can run the following command.
After completing Java installation, everything is ready for Jenkins installation. Firstly we have to add the Jenkins repository key to Ubuntu. For this, please run the following command.
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
After it, we have to run the following command to add the Jenkins repository.
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
After the repository adding operation, we should run the following command for the update package list.
sudo apt-get update
To complete a Jenkins installation, you have run the following command.
sudo apt install jenkins
Now, Jenkins is installed on Ubuntu. To control the installation, you can run the following command on your terminal screen.
systemctl status jenkins
Also you can use the following commands too.
systemctl restart jenkins systemctl stop jenkins systemctl start jenkins
After seeing the Jenkins status on terminal, let’s complete configuration. To access the Jenkins, you can use the following url. It is the default Jenkins url.
On the first visit, you see Unlock Jenkins title on your page. To pass this screen, you have run the following code and proof you are a system administrator.
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
This command returns us an alphanumeric password on terminal. This command returns us an alphanumeric password on the terminal. We copy this password and paste it to Jenkins page. After clicking the Continue button on this page, we see Get Started page. In this page you can choose suggested plugins or you can choose your plugins. I chose suggested plugins and continued my installation. After this step, you might wait 1 – 2 mins for installation.
After successful installation on this page, registration screens receive us. On this screen, we are going to create a Jenkins user. We have to fill all the fields on this page and continue to Save and Continue button for this.
Last 2 steps before seeing Dashboard! After registration, we see the instance configuration screen. I am installing Jenkins to my OS. Because of that, I am going to use the default url on my install. (http://localhost:8080) I did not change anything on this screen and clicked Save and Finish button.
Last screen just for information. Jenkins is ready to use. You can click Start using Jenkins and login with your username / password.
In this post we installed Jenkins to Ubuntu. In the next post, we are going to add one item to Jenkins and configure builds via GitHub account.
See you on the next post.
Hello my friends,
I started use Sonarqube in my projects. In this post, I will try to tell Sonarqube in windows computer.
What will we examine in this post?
- What is Sonarqube?
- How to install Sonarqube?
- How to create a new project in Sonarqube trenbolone australia?
- How to scan .NET project with Sonarqube?
- What is the mean of results titles in report?
First topic is What is Sonarqube. Sonarqube is static code analysis tool. It’s open source and It is support 20+ language. Let’s start examine the Sonarqube.
Now, we are starting second topic. Firstly, we will download Sonarqube tool in this link for second topic.
We will extract setup file from zip, when download finished. The setup files are in the bin folder.
We will use StartSonar.bat file for the install. Location for StartSonar.bat is as follows.
Sonarqube will be ready for use, when the installation finished. If you see the field marked with yellow text, It’s mean your application installation finished. The screenshot is as follows.
Default address is http://localhost:9000 for Sonarqube. Start page screenshot is as follows. Now, we can login our application. Firstly we are click log in button for this. This button is right side on the header.
Default username and password are admin for login. Now, we can start create a new project in sonarqube. Firstly, we are click Create new project button in our Projects page.
We need to input project key ad display name for create a new project. My area is as follows.
Last step before analysis, We will create a token for scan. I am usually use default values in this step. The screenshot is as follows.
Now, we will choose main language and download files. Sonarqube will use this files for scan.
After downloaded package, we will add package path in environment variable list. This step is as follows.
Finally, Sonarqube is ready for scan. Firstly, we will open example project folder in command prompt screen, after then we are copy first command from dashboard page and run in command prompt. The screenshot is as follows.
We will open Developer command prompt, when first command finished. We will run second command in this windowd. (Developer command prompt.)
After finished second step, we will turn back to command prompt for finally step. Now, we are copy third code from dashboard page and run. Sonarqube will open results in our screen, when scan finished. My results are as follows.
Scanning finished. Now we will examine results as follows 6 title.
Quality Gate: Sonarqube have some quality gates for projects. This quality gates is consist of some metrics. I used default Sonarqube quality gate. You can create a new quality gate or change available quality gates. Quality gate is important for project because developers will write high quality code for pass the this gate. My default quality gate metrics is as follows.
Bugs: You can see code error in this project under this title. If you click 40 (It’s for my project), you can see code errors. For example my bugs are as follows.
If we click any bug, what can we see?
For example, I clicked first code error;
- This bug is in wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css file.
- This bug created 21 hours ago.
- This bug’s effort is 1 minutes.
- This bug didn’t assign any user yet. You can click not assigned and assign any people.
Vulnerabilities: This title about security and as important as bugs. My example project didn’t have error of this category but, this detail page as like as bugs detail page.
Code Smells: This title is about maintenance and legibility. We have a 23 code smells and we need 3 hours for solved this.
If we have a look example code smell detail;
- This code smell is in Pages/Index.cshtml.cs file.
- This code smell level is Critical.
- This code smell effort is 5 minutes.
- This code smell created 21 hours ago.
Coverage: This category is about tests. We didn’t write test for our test project. If we write test, we can see rate in the project.
Duplications: This category is about ratio reused rows to total rows. Result for my example project is as follows.
See you next posts.
Good works 🙂