Thursday, 5 November 2020

Run Jenkins on Ubuntu

To start:

sudo service jenkins start

To stop:

sudo service jenkins stop

To restart:

sudo service jenkins restart

To check status:

sudo systemctl status jenkins 

To access: localhost:8080

use Pipe line to build git branch

  1. create a multiple scan pipe line item in Jenkins (branch sources in local format: file:///home/leo2019/play_jenkins)
  2. global tool config to add git excutable
  3. create a Jenkinsfile in the git repository

Find plugins installed

  1. go to http://localhost:8080/script
  2. past the groovy script below
  3. run the script
Jenkins.instance.pluginManager.plugins.each{
  plugin -> 
    println ("${plugin.getDisplayName()} (${plugin.getShortName()}): ${plugin.getVersion()}")
}

Install Jenkins on Docker

  1. stop jenkin if other jenkin is running
  2. Go to home directory
    mkdir jenkins_home
  3. //let folder own by jenkin. If log into container
     //and issue id command, got:  
     //uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins)
      cd jenkins_home
      sudo chown -R 1000:1000 .
  4. docker run -d -p 49001:8080 -v ~/jenkins_home:/var/jenkins_home --name jenkins jenkins/jenkins
  5. http://localhost:49001
  6. user name: admin password in: /var/lib/jenkins/secrets/initialAdminPassword

To Start container

docker container start jenkins

To Stop container

docker container stop jenkins

No comments:

Post a Comment