Jenkins

Jenkins adalah open-source automation server yang digunakan untuk mengautomasi task seperti building, testing, delivering atau deploying.

Install Jenkins

Jenkins bisa diinstall dengan menggunakan Docker, native (package) atau standalone dengan menggunakan Java.

Prerequisites

  • Java
  • DigitalOcean Droplet (Ubuntu 18.04, 2 gb RAM)

Install Java

  • Install openjdk-8-jdk
    sudo apt update
    sudo apt install openjdk-8-jdk -y
    java -version

    Install Jenkins

  • Download Jenkins
    wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
    sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
    sudo apt update
    sudo apt install jenkins
  • Start Jenkins
    systemctl start jenkins
    systemctl status jenkins

    Expected output:

    ‚óŹ jenkins.service - LSB: Start Jenkins at boot time
    Loaded: loaded (/etc/init.d/jenkins; generated)
    Active: active (exited) since Wed 2019-10-16 05:49:09 UTC; 1min 54s ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 0 (limit: 2362)
    CGroup: /system.slice/jenkins.service

Access Jenkins

  • Secara default Jenkins berjalan pada port 8080. Diakses melalui browser dengan memasukkan IP Droplet.
    http://[PUBLIC_IP_DROPLET]:8080
  • Jika berhasil dibuka, akan keluar tampilan unlock jenkins.
    cat /var/lib/jenkins/secrets/initialAdminPassword
  • Masukkan administrator password nya.
  • Jenkins is ready.

Test Jenkins Job

  1. Klik menu new item.
  2. Enter item name. Contoh: test_jenkins_job
  3. Klik Freestyle project
  4. Enter description. Contoh: test jenkins jobs
  5. Dibawah build section. Klik add build step -> execute with shell
  6. Karena untuk testing, masukkan command echo saja.
    echo "testing jenkins job success"
  7. Save job.
  8. Klik build now.
  9. Cek console output.
    Expected output:

    Started by user admin
    Running as SYSTEM
    Building in workspace /var/lib/jenkins/workspace/test_jenkins_job
    [test_jenkins_job] $ /bin/sh -xe /tmp/jenkins64901245446655805.sh
    echo test jenkins job success
    test jenkins job success
    Finished: SUCCESS
Last modified: October 16, 2019

Author

Comments

Write a Reply or Comment

Your email address will not be published.