Automating pipelines

As previously explained, we are going to need several tools to automate our pipeline for our example. For this, we are going to use the following:

  • A GitHub repository for our code: We can push our code to a repository and create a merge that automatically launches the build and test
  • Gradle or Maven to build our project
  • Junit, Postman, and Newman to test the automation
  • Docker to deploy into containersJenkins to act as our automation server for CI and CD

First, we are going to push our code to a repository. To do this, we are going to use GitHub. Create an account if you haven't already.

Open a terminal and go to the root folder of our application. For our convenience, we are going to push the repository from our machine, so we are going to initialize our project as a repository. In the command line, execute the following:

$ git init

The output of the command will look as follows:

Initialized empty Git repository in /Users/alberto/TRABAJO/REPOSITORIES/banking-app/.git/

Then we are going to add all our files to a new local repository, as shown in the following code:

$ git add –A

Now we are going to commit our code locally, as shown in the following code:

$ git commit -m initial

The output of our local commit will print the following initial lines:

[master (root-commit) 5cc5f44] initial  40 files changed, 1221 insertions(+)

To push our code, we then need to create a repository in our GitHub account. We can create a new repository by going to the Repositories section, clicking on the green Create Repository button, and filling in the name and description of the repository, as shown in the following screenshot:

Creating a GitHub repository

We now have the URL of our repository—for example, https://github.com/$YOUR_GITHUB_USER/bank-app. The result of the repository that we created will look like the following screenshot:

GitHub repository

As per the instructions given in GitHub, we now need to push our code to the repository using the command line:

$ git remote add origin https://github.com/lasalazarr/banking-app.git

Then, we will push our changes from the local repository to our GitHub repository, as shown in the following code:

$ git push -u origin master
Now we can review our code on our GitHub account repository and, as recommended, add a README file to explain the purpose of the application.

In the next section, we are going to look at the concept of a CI server before continuing with our exercise.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.244.250