Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [glassfish-dev] (no subject)

This is related to the jenkins-kubernetes-plugin.

  agent {
    kubernetes {
      label "${env.label}"

When agent { kubernetes is used this defines a new "inline" pod template directly from the Jenkinsfile.
Since this is multi-branch there is N version of the Jenkinsfile in a repository, one of each branch and PR, thus there is N version of the pom template.

IIRC the plugin is/was keying the generated pod templates by their label, so one had to specify a unique label inside the Jenkinsfile to make sure each branch would get their own unique pod template that corresponds to the definition inside their respective Jenkinsfile. I always thought this was a bug and that was a little obscure, I don't know if that is still needed.

From https://github.com/jenkinsci/kubernetes-plugin/blob/master/README.md

"label The label of the pod. Can be set to a unique value to avoid conflicts across builds, or omitted and POD_LABEL will be defined inside the step."

Thanks,
Romain


On 3/27/20 9:11 AM, arjan tijms wrote:
Hi All,

The Jenkinsfile in the Glassfish repo dynamically sets the label for a job:

// the label is unique and identifies the pod descriptor and its resulting pods
// without this, the agent could be using a pod created from a different descriptor
env.label = "glassfish-ci-pod-${UUID.randomUUID().toString()}"

Normally labels are static, and Jenkins will only find agents with this exact label. 

I'm trying to run the Jenkinsfile on my local Kubernetes cluster, however I'm somewhat stuck on this dynamic label:

----
Obtained Jenkinsfile from b1ab2f11a1a236eb9d6063c488757e2afabdddea
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] podTemplate (hide)
[Pipeline] {
[Pipeline] node

Still waiting to schedule task
‘Jenkins’ doesn’t have label ‘glassfish-ci-pod-076a168e-46e6-499c-bcf6-10ad71e5853a’
----

Does anyone know how this dynamic label works, and/or can take a look at how the Kubernetes cloud setup at https://ci.eclipse.org/glassfish/ is done?

And example from what that Jenkins logs is:

Push event to branch master
Connecting to https://api.github.com using glassfish-bot/****** (GitHub bot)
Obtained Jenkinsfile from b1ab2f11a1a236eb9d6063c488757e2afabdddea
Running in Durability level: PERFORMANCE_OPTIMIZED
[Pipeline] Start of Pipeline
[Pipeline] podTemplate
[Pipeline] {
[Pipeline] node
Still waiting to schedule task
‘glassfish-ci-pod-e33d1b42-21bd-48be-928e-4225e0e099e7-wtr-jbmm8’ is offline
Agent glassfish-ci-pod-e33d1b42-21bd-48be-928e-4225e0e099e7-wtr-jbmm8 is provisioned from template Kubernetes Pod Template
---
apiVersion: "v1"
kind: "Pod"
metadata:
  annotations:
    buildUrl: "http://jenkins-ui.glassfish.svc.cluster.local/glassfish/job/glassfish/job/master/104/"
  labels:
    jenkins: "slave"
    jenkins/label: "glassfish-ci-pod-e33d1b42-21bd-48be-928e-4225e0e099e7"
  name: "glassfish-ci-pod-e33d1b42-21bd-48be-928e-4225e0e099e7-wtr-jbmm8"
spec:
  containers:
  - args:
    - "cat"
    env:
    - name: "MAVEN_OPTS"
      value: "-Duser.home=/home/jenkins"
    - name: "MVN_EXTRA"
      value: "--batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
    image: "ee4jglassfish/ci:tini-jdk-8.181"
    imagePullPolicy: "Always"
    name: "glassfish-ci"
    resources:

Kind regards,
Arjan Tijms


_______________________________________________
glassfish-dev mailing list
glassfish-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://urldefense.com/v3/__https://www.eclipse.org/mailman/listinfo/glassfish-dev__;!!GqivPVa7Brio!Os5AZ7gg1F14x4fNRwIXG_12GaRazvdlca1ejqSMqtAK9jem3uztMQ8rrPs_IGsHBtEe$ 


Back to the top