How to build a continuous integration strategy for your applications with Jenkins CI
This page shows you how to use the Jenkins CI tool InstantApp on your C1 server.
- You have an account and are logged into cloud.scaleway.com
- You have configured your SSH Key
Jenkins provides continuous integration services for software development.
There are five steps to deploy and configure the Jenkins InstantApp
- Create and start a new C1 server using the Jenkins InstantApp
- Configure Jenkins authentication
- Deploy Jenkins workers
- Create a Jenkins job for your application
- Upgrade Jenkins
Let’s begin by creating a new Jenkins server by using the Jenkins InstantApp. Click the “Create Server” button in the control panel.
You will land on the server-creation page where you must input basic information for your server and choose an image for your server.
After inputting your server basic information, select the Jenkins application image for your server. On the ImageHub tab, select Jenkins and click the “Create Server” button.
The server will be created with a ready to use Jenkins install.
Your Jenkins server is now started but everyone can access it. The next thing to do is to enable authentication so only authenticated users will be able to access it.
To access your Jenkins server in a browser, go to
http://<your_server_ip>:8080. You will land on the default Jenkins homepage. Click “Manage Jenkins” in the left-side menu. You land on the Jenkins management page.
On the top of this page a message notify you that the install is not secured and recommand you to setup security. Click the “Setup Security” button to begin the process.
- Select the
- Security Realm: Ensure that
Jenkins’ own user databaseis checked and unselect
Allow users to sign upto prevent user sign-up. That will use the Jenkins’s own user database and disable sign ups.
- Matrix-based security: Take care to apply the correct right for anonymous user. In my case I allow only read access for anonymous user.
- Save your changes
Back to the Jenkins server base url
http://<your_server_ip>:8080 and sign-up by filling-in the form. Once the form submitted, your account will be administrator of the Jenkins.
Now that we have a configured Jenkins server, we will spawn workers node AKA slave machines to perform our jobs. There are differents ways to add a slave node, you can check them out here.
Let’s setup a slave agent headlessly.
On the Jenkins server create a new node:
- click “Manage Jenkins” in the left-side menu
- Select “Manage nodes”
- click “New node” in the left-side menu
- Name your node
- Select “Launch slage agent via Java Web Start”
Create a new C1 server using the Jenkins worker InstantApp. It spawns a server with
git, subversion, mercurial, docker, java installed on it. Once the server is started, connect to it via ssh and execute the following command:
wget http://<your_server_ip>:8080/jnlpJars/slave.jar java -jar slave.jar -jnlpUrl http://<your_server_ip>:8080/computer/node01/slave-agent.jnlp
Your slave will be connected to Jenkins automatically to Jenkins master.
We will create our first dummy job that will perform an hello world.
On the Jenkins dashboard, click “New Item”, give it a name and select Freestyle project.
Then, you land on the page to configure your job. For this job, I only execute the
echo "Hello World!" command and set the job to run every hour.
Save your job and click on “Build Now”.
You can consult your job output by clicking the build id and “Console Output”.
To upgrade Jenkins run the following command on the server
apt-get update apt-get upgrade
Jenkins let you create and build your application with a huge flexibility. You can distribute your jobs to slave node to increase your build capacity. It also offers you the opportunity to add plugins that will help you to manage your builds. You can go deeper with the Official Jenkins documentation.
Try this tutorial on your own C1 server TRY IT
This is a companion discussion topic for the original entry at https://www.scaleway.com/docs/how-to-use-the-jenkins-instant-apps/