[DOCKER] CI / CD practice for beginners --Part2 --CI / CD tool construction

Build a CI / CD environment

This series is for super beginners who want to practice CI / CD. We hope that you will get a sense of "What is CI / CD?" When introducing the enterprise level and production level. The tools to be used are selected here, so if you want to use another tool, please check accordingly. The general content is as follows.

  1. Environment construction
  1. ** Building CI / CD tools <-I'll explain here **
  2. Preparation of development project --Register project data on GitHub --Installing Jenkins Plugin --Manual build
  3. Example of using CI / CD tool and other tools together
  4. Cooperation with VCS
  5. Cooperation with test tools
  6. Cooperation with inspection tools
  7. Realization of pipeline

Overview </ font>

-Run Jenkins container --Jenkins initial settings --Automatically notify build results using gmail --Automatic installation of JDK / Ant / Maven

Build CI / CD tools

CI / CD tools include:

  • Jenkins
  • Drone
  • CircleCI
  • AWS CodeBuild
  • Tekton

This time we will introduce `` `Jenkins```

Run Jenkins container

Execute the Jenkins container and perform the initial settings by referring to [Official] of Jenkins (https://www.jenkins.io/doc/book/installing/docker/#customizing-jenkins-with-plugins).

First, set network and volume

$ docker network create jenkins
$ docker volume create jenkins-docker-certs   //Share the Docker client TLS certificate needed to connect to the Docker daemon
$ docker volume create jenkins-data   //Used for data persistence
$ docker network ls   //There are three networks, a newly created bridge network and default
$ docker volume ls

Then run `` `jenkinsci / blueocean``` as a jenkins container

$ docker container run --name jenkins-blueocean --rm --detach \
  --network jenkins --env DOCKER_HOST=tcp://docker:2376 \
  --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 \
  --volume jenkins-data:/var/jenkins_home \
  --volume jenkins-docker-certs:/certs/client:ro \
  --publish 8080:8080 --publish 50000:50000 jenkinsci/blueocean

This will run jenkins

First login to jenkins dashboard

To enter the jenkins dashboard, type `http: // localhost: 8080 /` on your browser Enter the value when the container is executed as password Alternatively, execute the following command to confirm the initial password

$ docker exec jenkins-blueocean cat /var/jenkins_home/secrets/initialAdminPassword

Next, install the plugin and create a user. Select one of the following in Customizing Jenkins with plugins Install suggested plugins` `` (basically here)    Select plugins to install```

When creating a user, create a new user with admin privileges as shown below.

図5.png

This completes the settings for the first login.

Initial setting of jenkins

In the initial setting, the following two points are set.

-Email notification of build result --Installation of tools essential for CI realization

First, set "Email notification of build result" dashboard> Left pane ``` Manage Jenkins ``> Center pane `` System Settings >

Enter Jenkins URL` `,` `System Admin e-mail address in Jenkins Location system admin e-mail addressIs the sender of the notification email

図6.png

Set as follows in E-mail Notification After entering the test mail address, click `Test configuration`

図7.png

If Email was successfully sent is displayed after clicking, the email has arrived. If Failed to send out e-mail

javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8  https://support.google.com/mail/?p=BadCredentials q14sm9594426pjp.43 - gsmtp

~~

Is displayed, "Access to insecure apps" of Google account is `` `disabled``` (default is disabled) To enable it, please refer to here

Next, set "Installation of tools essential for CI realization" dashboard> Left pane Jenkins management` ``> Center pane Global Tools Configuration >

Enter as follows and save

図8.png

Since an Oracle account is required to install the JDK, enter the user name and password from the link (an error is displayed near "I agree to the Java SE ~~" before entering) If you don't have an account, you can create one from there

図9.png

Recommended Posts

CI / CD practice for beginners --Part2 --CI / CD tool construction
CI / CD practice for beginners --Part1 --Environment construction
CI / CD practice for beginners --Part3 --Preparation for development project
Experience CI / CD with katacoda (for beginners) --Part10 (Building Docker Images using Jenkins)
Binary Tree Memorandum for Beginners (Part 1)
Environment construction with Docker for beginners
Binary tree memorandum for beginners (Part 4 Binary heap)
Binary tree memorandum for beginners (Part 5 Binary search tree)
Binary tree memorandum for beginners (Part 2 Search for binary trees)
java practice part 1
Binary tree memorandum for beginners (Part 3 Realization using class)