How My Marketing May Have Lost Me A Client

I was sitting in the owner’s lavish office observing through floor to ceiling windows everthing that was going on in the busy throughfare outside. It was a birds eye view of the human comedy that…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Simple pipelining in Jenkins CI

This is my first post about Jenkins CI. I’d played for days with Jenkins CI pipeline in order to complete my personal project, and I would like to take some notes for it.

If you are looking for using Jenkins along with Docker, you could read Deploy docker image with Jenkins

In order to make life easier, I provide a vagrant box for this post, hence, please open a folder and create a Vagrantfile with below content

You could adjust machine’s information, e.g, cpus, memory to match your current host.

Now time to kick it off

It will start bringing up machine, it’s time for a cub of coffee

Before going through a demo, let’s spend a little bit time to understand about Pipeline in Jenkins CI.

In order to work with pipeline, you need to know some basic concepts:

General speaking, it could illustrate as below:
pipeline -> stages -> stage -> steps -> agent, step

If you are searching around and seeing definition about node, I suggest that we should ignore it for now, so as not to lead into confusions

You could see following result when machine is starting.

In case you got error message about Vagrant was unable to mount VirtualBox shared folders, you have to install vagrant-vbguest plugin, or you could ignore it if you don't need to mount any files to your box

After machine finishes start up, please access to url http://192.168.33.99 with login user admin and password 123456. You would see Jenkins page.

In this post, I will create a simple pipeline to do some jobs:

Create a jenkin’s job using pipeline type

Under pipeline definition section, use below script:

Next, run build to start job’s build, after job finished, graphical result should be

First, we define a pipeline, and notify jenkins that we do not need to specify any agent, as we are going to use appropriate agent in each stages

Next, we define a list of stages by using stages {} block

As per described ealier, we plan to do 3 tasks (or stages), and they are CheckOut, ResolveDependencies, and TestUnit. That is reason for each below blocks

To checkout source from a proposed repository

Since we need composer to resolve dependencies then it needs to be downloaded before starting

When composer is ready, we will start to resolve project's dependencies

Finally, we run unit testing, however, we also need to delete workspace in order to make a clean environment for later build

TIPS:

Add a comment

Related posts:

The Curse of being a Herondale

In the world of the Shadowhunters that Cassandra Clare has created, there are a great many characters that stand out, because, of the way the books are written we have gotten the opportunity to see…

Do you need a little inspiration today?

Inspiration can get our creative juices flowing come from Memes, blogs, books, other writers, our kids or weird characters that wake us in the middle of the night. I’m talking about imaginary…

How to make a Lawyer Booking app?

As the number of mobile users is proliferating, the demand for different On-Demand services app is growing along with it. Today, most of us find it easier to complete an online task through an app…