Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jenkins plugins will not install new modules when the new module name is contained in an existing module name #936

Open
rnelson0 opened this issue Dec 5, 2019 · 1 comment

Comments

@rnelson0
Copy link
Sponsor Member

rnelson0 commented Dec 5, 2019

In jenkins::plugin, grep is used to see if a module name exists,. For instance, an installation that already has blueocean-jira reports something like this:

Debug: Facter: fact "jenkins_plugins" has resolved to "ace-editor 1.1, antisamy-markup-formatter 1.6, apache-httpcomponents-client-4-api 4.5.10-2.0, bitbucket 1.1.11, bitbucket-build-status-notifier 1.4.1, bitbucket-pullrequest-builder 1.5.0, blueocean 1.21.0, blueocean-autofavorite 1.2.4, blueocean-bitbucket-pipeline 1.21.0, blueocean-commons 1.21.0, blueocean-config 1.21.0, blueocean-core-js 1.21.0, blueocean-dashboard 1.21.0, blueocean-display-url 2.3.0, blueocean-events 1.21.0, blueocean-git-pipeline 1.21.0, blueocean-github-pipeline 1.21.0, blueocean-i18n 1.21.0, blueocean-jira 1.21.0, blueocean-jwt 1.21.0, blueocean-personalization 1.21.0, blueocean-pipeline-api-impl 1.21.0, blueocean-pipeline-editor 1.21.0, blueocean-pipeline-scm-api 1.21.0, blueocean-rest 1.21.0, blueocean-rest-impl 1.21.0, blueocean-web 1.21.0, bouncycastle-api 2.17, branch-api 2.5.4, cloudbees-folder 6.9, command-launcher 1.4, config-file-provider 3.6.2, credentials 2.3.0, display-url-api 2.3.2, durable-task 1.30, envinject 2.3.0, envinject-api 1.7, external-monitor-job 1.7, ghprb 1.42.0, git 4.0.0, git-client 3.0.0, github 1.29.5, github-api 1.95, github-branch-source 2.5.8, jackson2-api 2.10.1, javadoc 1.5, jaxb 2.3.0.1, jdk-tool 1.4, jenkins-design-language 1.21.0, jquery-detached 1.2.1, jsch 0.1.55.1, junit 1.28, ldap 1.21, mailer 1.23, matrix-auth 2.5, matrix-project 1.14, maven-plugin 3.4, mercurial 2.8, multiple-scms 0.6, pam-auth 1.6, pipeline-build-step 2.10, pipeline-milestone-step 1.3.1, plain-credentials 1.5, promoted-builds 3.5, pubsub-light 1.13, puppet-enterprise-pipeline 1.2.3, ruby-runtime 0.13, rvm 0.6, scm-api 2.6.3, script-security 1.68, ssh-agent 1.17, ssh-credentials 1.17.3, structs 1.20, token-macro 2.10, trilead-api 1.0.4, variant 1.3, windows-slaves 1.5, workflow-api 2.37, workflow-basic-steps 2.16.1, workflow-cps 2.77, workflow-durable-task-step 2.28, workflow-job 2.36, workflow-multibranch 2.21, workflow-scm-step 2.9, workflow-step-api 2.21, workflow-support 3.3".

When adding the plugin jira, L119 checks to see if jira is in that list, and it is. Therefore, it skips the entire block that installs the plugin. You can see this in /opt/puppetlabs/puppet/cache/state/state.yaml:

Jenkins::Plugin[blueocean-jira]:
File[/var/lib/jenkins/plugins/blueocean-jira.jpi]:
File[/var/lib/jenkins/plugins/blueocean-jira.jpi.disabled]:
File[/var/lib/jenkins/plugins/blueocean-jira.jpi.pinned]:
Archive[blueocean-jira.hpi]:
File[/var/lib/jenkins/plugins/blueocean-jira.hpi.disabled]:
File[/var/lib/jenkins/plugins/blueocean-jira.hpi.pinned]:
File[/var/lib/jenkins/plugins/blueocean-jira.hpi]:
Jenkins::Plugin[jira]:

If you then delete /var/lib/jenkins/blueocean-jira*, it does install both plugins:

Jenkins::Plugin[blueocean-jira]:
File[/var/lib/jenkins/plugins/blueocean-jira.jpi]:
File[/var/lib/jenkins/plugins/blueocean-jira.jpi.disabled]:
File[/var/lib/jenkins/plugins/blueocean-jira.jpi.pinned]:
Archive[blueocean-jira.hpi]:
File[/var/lib/jenkins/plugins/blueocean-jira.hpi.disabled]:
File[/var/lib/jenkins/plugins/blueocean-jira.hpi.pinned]:
File[/var/lib/jenkins/plugins/blueocean-jira.hpi]:
Jenkins::Plugin[jira]:
File[/var/lib/jenkins/plugins/jira.jpi]:
File[/var/lib/jenkins/plugins/jira.jpi.disabled]:
File[/var/lib/jenkins/plugins/jira.jpi.pinned]:
Archive[jira.hpi]:
File[/var/lib/jenkins/plugins/jira.hpi.disabled]:
File[/var/lib/jenkins/plugins/jira.hpi.pinned]:
File[/var/lib/jenkins/plugins/jira.hpi]:

Many jenkins plugins have partial overlap (blueocean-jira and jira, blueocean-autofavorite and favorite, git and numerous git plugins) and this race condition can result in different results depending on the already-installed plugins.

A potential solution is to convert the fact from returning a string to an array, and then using in in the conditional.

@ekohl
Copy link
Member

ekohl commented Sep 3, 2020

A potential solution is to convert the fact from returning a string to an array, and then using in in the conditional.

This is IMHO the correct solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants