Jenkins build happening on master instead of slave

84 views
Skip to first unread message

Gil Comeau

unread,
Jul 17, 2018, 5:05:45 PM7/17/18
to jenkins...@googlegroups.com

I have been working on an android OS build automation through Jenkins and the repository is massive and the build itself takes a fair amount of time. Therefore, I need to run on my slave that has much more power and threads available for the build and not fill the masters disk space up to the point where the other devs can't use it.

 

When I had my first build generated it deployed to the master, I checked the configuration and reviewed the best practices from Jenkins.

 

https://wiki.jenkins.io/display/JENKINS/Jenkins+Best+Practices

 

If you have a more complex security setup that allows some users to only configure jobs, but not administer Jenkins, you need to prevent them from running builds on the master node, otherwise they have unrestricted access into the JENKINS_HOME directory. You can do this by setting the executor count to zero. Instead, make sure all jobs run on slaves. This ensures that the jenkins master can scale to support many more jobs, and it also protects builds from modifying potentially sensitive data on $JENKINS_HOME accidentally/maliciously. If you need some jobs to run on the master (e.g. backups of Jenkins itself), use the Job Restrictions Plugin to limit which jobs can be executed there.

 

I noticed that we had two executors available on the master and as per the best practices this should be set to zero if you never want to build on the master. I set this down to zero and retried my build.

 

Master Server Executors

 

To my surprise it's still building on the master. Below is my Jenkinsfile that implicitly says to build on my slave.

 

pipeline {

    agent {label 'van-droid'}

 

    stages {

        stage('Build') {

            steps {

        echo 'Building..'

        sh 'make clean'

        sh 'export USE_CCACHE=1'

        sh 'export CCACHE_DIR=/nvme/.ccache'

        sh './FFTools/make.sh'

             }

        }

    }

}

 

Anyone have any idea what's going on?

Slide

unread,
Jul 17, 2018, 5:12:14 PM7/17/18
to jenkins...@googlegroups.com
Just wondering, but what makes you believe it is running on the master? 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1678d08c9aed4ea283ee384c857f0b45%40storefront.com.
For more options, visit https://groups.google.com/d/optout.

Gil Comeau

unread,
Jul 17, 2018, 6:18:31 PM7/17/18
to jenkins...@googlegroups.com

The git repo is being downloaded there and not to the workspace on my slave. It’s killing the disk space on my master server, causing everyone else’s builds to stop. Is that expected behavior?

Reinhold Füreder

unread,
Jul 18, 2018, 2:08:40 AM7/18/18
to jenkins...@googlegroups.com

Hi Gil!

 

Naïve/small hint: Is the git repo the one with the “Jenkinsfile”, i.e. the Jenkins pipeline definition? That must be available on the master AFAIK; however I think for (at least?) git there is the option of “lightweight checkout” which says:

If selected, try to obtain the Pipeline script contents directly from the SCM without performing a full checkout. The advantage of this mode is its efficiency; however, you will not get any changelogs or polling based on the SCM. (If you use checkout scm during the build, this will populate the changelog and initialize polling.) Also build parameters will not be substituted into SCM configuration in this mode. Only selected SCM plugins support this mode.

(from Pipeline: Groovy)

 

HTH Reinhold

Reply all
Reply to author
Forward
0 new messages