define jenkins agent jnlp container memory specs via pipeline

161 views Asked by At

Team,

I need to create a custom jnlp jenkins-agent container with custom memory spec. is there a way i can define it in pipeline? I already created template for it but don't know how to tell jenkins to use. if i change the default spec it will effect all jobs, I just want my pipeline to use that container.

requirement is to override the DEFAULT jenkins JNLP pod spec

12:31
11:05:29      name: "ui"
11:05:29      resources:
11:05:29        limits:
11:05:29          memory: "8Gi"
11:05:29          cpu: "8"
11:05:29        requests:
11:05:29          memory: "4Gi"
11:05:29          cpu: "4"
11:05:29      volumeMounts:
11:05:29      - mountPath: "/home/jenkins/agent"
11:05:29        name: "workspace-volume"
11:05:29        readOnly: false
11:05:29    - env:
11:05:29      - name: "JENKINS_SECRET"
11:05:29        value: "********"
11:05:29      - name: "JENKINS_TUNNEL"
11:05:29        value: "product-sre-deployments-svc-slave.jenkins-master-ns.svc.cluster.local:50000"
11:05:29      - name: "JENKINS_AGENT_NAME"
11:05:29        value: "product-btt-ui-ci-teamstuffprod-jcb2f"
11:05:29      - name: "JENKINS_NAME"
11:05:29        value: "product-btt-ui-ci-teamstuffprod-jcb2f"
11:05:29      - name: "JENKINS_AGENT_WORKDIR"
11:05:29        value: "/home/jenkins/agent"
11:05:29      - name: "JENKINS_URL"
11:05:29        value: "http://product-sre-deployments-svc.jenkins-master-ns.svc.cluster.local:8080/product-sre-deployments/"
11:05:29      image: "jenkins/inbound-agent:3107.v665000b_51092-5"
11:05:29      name: "jnlp"
11:05:29      resources:
11:05:29        requests:
11:05:29          memory: "256Mi"
11:05:29          cpu: "100m"
12:28

so if you observe above.. the bottom lines are jnlp. these are not defined in pipeline..this container is default from jenkins.

12:29
11:05:29      name: "jnlp"
11:05:29      resources:
11:05:29        requests:
11:05:29          memory: "256Mi"
11:05:29          cpu: "100m"

my pipeline is below

pipeline {
  agent {
    label 'ui'
  }
  parameters {
    string(
.
.
.
    )
  }

0

There are 0 answers