-
Bug
-
Resolution: Not A Defect
-
Major
-
None
-
Running in Kubernetes on Debian Stretch nodes
Using the jenkins/jenkins:lts-alpine docker image
Installed plugins:
Bitbucket Branch Source Plugin (cloudbees-bitbucket-branch-source): 2.4.2
Kubernetes Credentials Plugin (kubernetes-credentials): 0.4.0
REST API for Blue Ocean (blueocean-rest): 1.13.2
Autofavorite for Blue Ocean (blueocean-autofavorite): 1.2.3
Pipeline: API (workflow-api): 2.33
Kubernetes plugin (kubernetes): 1.14.8
Pipeline: Nodes and Processes (workflow-durable-task-step): 2.29
Pipeline implementation for Blue Ocean (blueocean-pipeline-api-impl): 1.13.2
Matrix Project Plugin (matrix-project): 1.14
i18n for Blue Ocean (blueocean-i18n): 1.13.2
Common API for Blue Ocean (blueocean-commons): 1.13.2
Credentials Binding Plugin (credentials-binding): 1.18
Personalization for Blue Ocean (blueocean-personalization): 1.13.2
MapDB API Plugin (mapdb-api): 1.0.9.0
Pipeline SCM API for Blue Ocean (blueocean-pipeline-scm-api): 1.13.2
LDAP Plugin (ldap): 1.20
Git client plugin (git-client): 2.7.6
Config API for Blue Ocean (blueocean-config): 1.13.2
Credentials Plugin (credentials): 2.1.18
Pipeline: Shared Groovy Libraries (workflow-cps-global-lib): 2.13
Git plugin (git): 3.9.3
AnsiColor (ansicolor): 0.6.2
GitHub plugin (github): 1.29.4
Pipeline: GitHub Groovy Libraries (pipeline-github-lib): 1.0
Docker Commons Plugin (docker-commons): 1.13
JUnit Plugin (junit): 1.27
Pipeline: REST API Plugin (pipeline-rest-api): 2.10
REST Implementation for Blue Ocean (blueocean-rest-impl): 1.13.2
Subversion Plug-in (subversion): 2.12.1
Pipeline: Stage View Plugin (pipeline-stage-view): 2.10
SSH Slaves plugin (ssh-slaves): 1.29.4
Folders Plugin (cloudbees-folder): 6.7
Server Sent Events (SSE) Gateway Plugin (sse-gateway): 1.17
OWASP Markup Formatter Plugin (antisamy-markup-formatter): 1.5
Variant Plugin (variant): 1.2
Pipeline: Groovy (workflow-cps): 2.64
JavaScript GUI Lib: Moment.js bundle plugin (momentjs): 1.1.1
Bitbucket Pipeline for Blue Ocean (blueocean-bitbucket-pipeline): 1.13.2
Git Pipeline for Blue Ocean (blueocean-git-pipeline): 1.13.2
Script Security Plugin (script-security): 1.54
Plain Credentials Plugin (plain-credentials): 1.5
Command Agent Launcher Plugin (command-launcher): 1.3
Events API for Blue Ocean (blueocean-events): 1.13.2
Display URL for Blue Ocean (blueocean-display-url): 2.2.0
Lockable Resources plugin (lockable-resources): 2.4
SSH Credentials Plugin (ssh-credentials): 1.15
GIT server Plugin (git-server): 1.7
Pipeline: Build Step (pipeline-build-step): 2.7
GitHub API Plugin (github-api): 1.95
Blue Ocean (blueocean): 1.13.2
Matrix Authorization Strategy Plugin (matrix-auth): 2.3
Blue Ocean Core JS (blueocean-core-js): 1.13.2
Web for Blue Ocean (blueocean-web): 1.13.2
PAM Authentication plugin (pam-auth): 1.4
JIRA plugin (jira): 3.0.5
Blue Ocean Pipeline Editor (blueocean-pipeline-editor): 1.13.2
Pipeline: Input Step (pipeline-input-step): 2.9
Pipeline: SCM Step (workflow-scm-step): 2.7
Pipeline Graph Analysis Plugin (pipeline-graph-analysis): 1.9
JIRA Integration for Blue Ocean (blueocean-jira): 1.13.2
bouncycastle API Plugin (bouncycastle-api): 2.17
Pipeline: Job (workflow-job): 2.32
JSch dependency plugin (jsch): 0.1.55
Resource Disposer Plugin (resource-disposer): 0.12
Token Macro Plugin (token-macro): 2.7
GitHub Pipeline for Blue Ocean (blueocean-github-pipeline): 1.13.2
Pipeline: Stage Tags Metadata (pipeline-stage-tags-metadata): 1.3.6
HTML Publisher plugin (htmlpublisher): 1.18
Apache HttpComponents Client 4.x API Plugin (apache-httpcomponents-client-4-api): 4.5.5-3.0
Pub-Sub "light" Bus (pubsub-light): 1.12
Mercurial plugin (mercurial): 2.5
Gradle Plugin (gradle): 1.30
Build Timeout (build-timeout): 1.19
Jackson 2 API Plugin (jackson2-api): 2.9.8
Pipeline: Model API (pipeline-model-api): 1.3.6
Handy Uri Templates 2.x API Plugin (handy-uri-templates-2-api): 2.1.7-1.0
Pipeline: Stage Step (pipeline-stage-step): 2.3
GitHub Authentication plugin (github-oauth): 0.31
Pipeline: Declarative Extension Points API (pipeline-model-extensions): 1.3.6
JavaScript GUI Lib: Handlebars bundle plugin (handlebars): 1.1.1
Design Language (jenkins-design-language): 1.13.2
Ant Plugin (ant): 1.9
Pipeline: Declarative (pipeline-model-definition): 1.3.6
Branch API Plugin (branch-api): 2.1.2
JavaScript GUI Lib: ACE Editor bundle plugin (ace-editor): 1.1
CloudBees AWS Credentials Plugin (aws-credentials): 1.26
Docker Pipeline (docker-workflow): 1.17
JDK Tool Plugin (jdk-tool): 1.2
Pipeline: Milestone Step (pipeline-milestone-step): 1.3.1
Pipeline: Supporting APIs (workflow-support): 3.2
Favorite (favorite): 2.3.2
Pipeline: Step API (workflow-step-api): 2.19
SCM API Plugin (scm-api): 2.3.0
Pipeline: Declarative Agent API (pipeline-model-declarative-agent): 1.1.1
JavaScript GUI Lib: jQuery bundles (jQuery and jQuery UI) plugin (jquery-detached): 1.2.1
GitHub Branch Source Plugin (github-branch-source): 2.4.2
Workspace Cleanup Plugin (ws-cleanup): 0.37
Dashboard for Blue Ocean (blueocean-dashboard): 1.13.2
Display URL API (display-url-api): 2.3.0
Pipeline (workflow-aggregator): 2.6
Structs Plugin (structs): 1.17
Amazon Web Services SDK (aws-java-sdk): 1.11.457
Timestamper (timestamper): 1.9
Pipeline: Multibranch (workflow-multibranch): 2.21
Notification plugin (notification): 1.13
Pipeline: Basic Steps (workflow-basic-steps): 2.14
JWT for Blue Ocean (blueocean-jwt): 1.13.2
Durable Task Plugin (durable-task): 1.29
Authentication Tokens API Plugin (authentication-tokens): 1.3
Mailer Plugin (mailer): 1.23
Running in Kubernetes on Debian Stretch nodes Using the jenkins/jenkins:lts-alpine docker image Installed plugins: Bitbucket Branch Source Plugin (cloudbees-bitbucket-branch-source): 2.4.2 Kubernetes Credentials Plugin (kubernetes-credentials): 0.4.0 REST API for Blue Ocean (blueocean-rest): 1.13.2 Autofavorite for Blue Ocean (blueocean-autofavorite): 1.2.3 Pipeline: API (workflow-api): 2.33 Kubernetes plugin (kubernetes): 1.14.8 Pipeline: Nodes and Processes (workflow-durable-task-step): 2.29 Pipeline implementation for Blue Ocean (blueocean-pipeline-api-impl): 1.13.2 Matrix Project Plugin (matrix-project): 1.14 i18n for Blue Ocean (blueocean-i18n): 1.13.2 Common API for Blue Ocean (blueocean-commons): 1.13.2 Credentials Binding Plugin (credentials-binding): 1.18 Personalization for Blue Ocean (blueocean-personalization): 1.13.2 MapDB API Plugin (mapdb-api): 1.0.9.0 Pipeline SCM API for Blue Ocean (blueocean-pipeline-scm-api): 1.13.2 LDAP Plugin (ldap): 1.20 Git client plugin (git-client): 2.7.6 Config API for Blue Ocean (blueocean-config): 1.13.2 Credentials Plugin (credentials): 2.1.18 Pipeline: Shared Groovy Libraries (workflow-cps-global-lib): 2.13 Git plugin (git): 3.9.3 AnsiColor (ansicolor): 0.6.2 GitHub plugin (github): 1.29.4 Pipeline: GitHub Groovy Libraries (pipeline-github-lib): 1.0 Docker Commons Plugin (docker-commons): 1.13 JUnit Plugin (junit): 1.27 Pipeline: REST API Plugin (pipeline-rest-api): 2.10 REST Implementation for Blue Ocean (blueocean-rest-impl): 1.13.2 Subversion Plug-in (subversion): 2.12.1 Pipeline: Stage View Plugin (pipeline-stage-view): 2.10 SSH Slaves plugin (ssh-slaves): 1.29.4 Folders Plugin (cloudbees-folder): 6.7 Server Sent Events (SSE) Gateway Plugin (sse-gateway): 1.17 OWASP Markup Formatter Plugin (antisamy-markup-formatter): 1.5 Variant Plugin (variant): 1.2 Pipeline: Groovy (workflow-cps): 2.64 JavaScript GUI Lib: Moment.js bundle plugin (momentjs): 1.1.1 Bitbucket Pipeline for Blue Ocean (blueocean-bitbucket-pipeline): 1.13.2 Git Pipeline for Blue Ocean (blueocean-git-pipeline): 1.13.2 Script Security Plugin (script-security): 1.54 Plain Credentials Plugin (plain-credentials): 1.5 Command Agent Launcher Plugin (command-launcher): 1.3 Events API for Blue Ocean (blueocean-events): 1.13.2 Display URL for Blue Ocean (blueocean-display-url): 2.2.0 Lockable Resources plugin (lockable-resources): 2.4 SSH Credentials Plugin (ssh-credentials): 1.15 GIT server Plugin (git-server): 1.7 Pipeline: Build Step (pipeline-build-step): 2.7 GitHub API Plugin (github-api): 1.95 Blue Ocean (blueocean): 1.13.2 Matrix Authorization Strategy Plugin (matrix-auth): 2.3 Blue Ocean Core JS (blueocean-core-js): 1.13.2 Web for Blue Ocean (blueocean-web): 1.13.2 PAM Authentication plugin (pam-auth): 1.4 JIRA plugin (jira): 3.0.5 Blue Ocean Pipeline Editor (blueocean-pipeline-editor): 1.13.2 Pipeline: Input Step (pipeline-input-step): 2.9 Pipeline: SCM Step (workflow-scm-step): 2.7 Pipeline Graph Analysis Plugin (pipeline-graph-analysis): 1.9 JIRA Integration for Blue Ocean (blueocean-jira): 1.13.2 bouncycastle API Plugin (bouncycastle-api): 2.17 Pipeline: Job (workflow-job): 2.32 JSch dependency plugin (jsch): 0.1.55 Resource Disposer Plugin (resource-disposer): 0.12 Token Macro Plugin (token-macro): 2.7 GitHub Pipeline for Blue Ocean (blueocean-github-pipeline): 1.13.2 Pipeline: Stage Tags Metadata (pipeline-stage-tags-metadata): 1.3.6 HTML Publisher plugin (htmlpublisher): 1.18 Apache HttpComponents Client 4.x API Plugin (apache-httpcomponents-client-4-api): 4.5.5-3.0 Pub-Sub "light" Bus (pubsub-light): 1.12 Mercurial plugin (mercurial): 2.5 Gradle Plugin (gradle): 1.30 Build Timeout (build-timeout): 1.19 Jackson 2 API Plugin (jackson2-api): 2.9.8 Pipeline: Model API (pipeline-model-api): 1.3.6 Handy Uri Templates 2.x API Plugin (handy-uri-templates-2-api): 2.1.7-1.0 Pipeline: Stage Step (pipeline-stage-step): 2.3 GitHub Authentication plugin (github-oauth): 0.31 Pipeline: Declarative Extension Points API (pipeline-model-extensions): 1.3.6 JavaScript GUI Lib: Handlebars bundle plugin (handlebars): 1.1.1 Design Language (jenkins-design-language): 1.13.2 Ant Plugin (ant): 1.9 Pipeline: Declarative (pipeline-model-definition): 1.3.6 Branch API Plugin (branch-api): 2.1.2 JavaScript GUI Lib: ACE Editor bundle plugin (ace-editor): 1.1 CloudBees AWS Credentials Plugin (aws-credentials): 1.26 Docker Pipeline (docker-workflow): 1.17 JDK Tool Plugin (jdk-tool): 1.2 Pipeline: Milestone Step (pipeline-milestone-step): 1.3.1 Pipeline: Supporting APIs (workflow-support): 3.2 Favorite (favorite): 2.3.2 Pipeline: Step API (workflow-step-api): 2.19 SCM API Plugin (scm-api): 2.3.0 Pipeline: Declarative Agent API (pipeline-model-declarative-agent): 1.1.1 JavaScript GUI Lib: jQuery bundles (jQuery and jQuery UI) plugin (jquery-detached): 1.2.1 GitHub Branch Source Plugin (github-branch-source): 2.4.2 Workspace Cleanup Plugin (ws-cleanup): 0.37 Dashboard for Blue Ocean (blueocean-dashboard): 1.13.2 Display URL API (display-url-api): 2.3.0 Pipeline (workflow-aggregator): 2.6 Structs Plugin (structs): 1.17 Amazon Web Services SDK (aws-java-sdk): 1.11.457 Timestamper (timestamper): 1.9 Pipeline: Multibranch (workflow-multibranch): 2.21 Notification plugin (notification): 1.13 Pipeline: Basic Steps (workflow-basic-steps): 2.14 JWT for Blue Ocean (blueocean-jwt): 1.13.2 Durable Task Plugin (durable-task): 1.29 Authentication Tokens API Plugin (authentication-tokens): 1.3 Mailer Plugin (mailer): 1.23
We are running Jenkins in kubernetes and using the Kubernetes plugin(https://github.com/jenkinsci/kubernetes-plugin) to start agents for each build.
It seems like there is some kind of reuse of the pod yaml that is declared in the Jenkinsfile.
This can be reproduced with these steps and this example Jenkinsfile:
def getYaml() { return """ apiVersion: v1 kind: Pod metadata: annotations: iam.amazonaws.com/role: redacted labels: branch: ${env.BRANCH_NAME.take(63)} build-number: ${env.BUILD_NUMBER} spec: tolerations: - key: "builder" operator: "Equal" value: "nvme" effect: "NoSchedule" nodeSelector: kops.k8s.io/instancegroup: redacted containers: - name: jnlp image: 'redacted:3.4.0' args: ['\$(JENKINS_SECRET)', '\$(JENKINS_NAME)'] workingDir: /workdir volumeMounts: - mountPath: /home/jenkins/ephemeral name: ephemeral - mountPath: /home/jenkins/shared-cache name: shared-cache - mountPath: /workdir name: workspace-volume resources: requests: memory: "8192Mi" cpu: "4000m" limits: memory: "16384Mi" cpu: "8000m" volumes: - name: ephemeral hostPath: path: /media/ephemeral type: Directory - name: shared-cache nfs: server: redacted path: / """ }pipeline { agent { kubernetes { label 'jnlp' defaultContainer 'jnlp' yaml getYaml() } } options { timestamps () timeout(time: 1, unit: 'HOURS') disableConcurrentBuilds() } triggers { pollSCM('') // Enabling being build on Push } environment { } stages { stage('Shipit') { steps { withCredentials([ string(credentialsId: 'NPM_TOKEN', variable: 'NPM_TOKEN'), ]) { ansiColor('xterm') { script { sh 'echo stuff' } } } } } } }
1. Have a multibranch pipeline setup with a Jenkinsfile in the repository
2. Create a branch called branch-a in your git repository
3. Create a branch called branch-b in your git repository
4. Edit the pod yaml in branch-a an commit to branch-a
5. Push branch-a upstream, this will trigger a build
6. Wait for the agent to start for the build
7. Push branch-b upstream, this will trigger a build. Now the branch-a and branch-b builds are running in parallel
8. Notice that the pod yaml in the second build is identical to the pod yaml in the first build even though you made no changes to branch-b
jenkins is reusing your agent because they both are using the same label jnlp