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

Default jenkins.war path wrong since 2.332.1 #427

Closed
dbnicholson opened this issue Apr 5, 2022 · 8 comments · Fixed by #520, #622 or #624
Closed

Default jenkins.war path wrong since 2.332.1 #427

dbnicholson opened this issue Apr 5, 2022 · 8 comments · Fixed by #520, #622 or #624
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@dbnicholson
Copy link

Jenkins and plugins versions report

Environment

Jenkins: 2.332.1
OS: Linux - 5.10.0-13-cloud-amd64

ace-editor:1.1
amazon-ecr:1.7
ansicolor:1.0.1
antisamy-markup-formatter:2.7
apache-httpcomponents-client-4-api:4.5.13-1.0
authentication-tokens:1.4
aws-credentials:191.vcb_f183ce58b_9
aws-java-sdk-ec2:1.12.163-315.v2b_716ec8e4df
aws-java-sdk-ecr:1.12.163-315.v2b_716ec8e4df
aws-java-sdk-minimal:1.12.163-315.v2b_716ec8e4df
bootstrap4-api:4.6.0-3
bootstrap5-api:5.1.3-6
bouncycastle-api:2.25
branch-api:2.1044.v2c007e51b_87f
build-name-setter:2.2.0
buildresult-trigger:0.17
caffeine-api:2.9.2-29.v717aac953ff3
checks-api:1.7.2
cloudbees-folder:6.714.v79e858ef76a_2
cobertura:1.17
code-coverage-api:2.0.4
command-launcher:1.6
credentials:1087.v16065d268466
credentials-binding:1.27.1
data-tables-api:1.11.4-4
description-setter:1.10
display-url-api:2.3.6
docker-commons:1.19
docker-java-api:3.1.5.2
docker-plugin:1.2.6
docker-workflow:1.28
durable-task:495.v29cd95ec10f2
ec2:1.68
echarts-api:5.3.0-2
email-ext:2.87
extended-read-permission:3.2
font-awesome-api:6.0.0-1
forensics-api:1.12.0
ghprb:1.42.2
git:4.11.0
git-client:3.11.0
git-server:1.10
github:1.34.3
github-api:1.301-378.v9807bd746da5
greenballs:1.15.1
handlebars:3.0.8
hashicorp-vault-pipeline:1.3
hashicorp-vault-plugin:336.v182c0fbaaeb7
jackson2-api:2.13.2-260.v43d711474c77
javax-activation-api:1.2.0-2
javax-mail-api:1.6.2-5
jaxb:2.3.0
jdk-tool:1.0
jquery3-api:3.6.0-2
jsch:0.1.55.2
junit:1.58
ldap:2.8
lockable-resources:2.14
mailer:408.vd726a_1130320
matrix-auth:3.1
matrix-project:758.v7a_ea_491852f3
momentjs:1.1.1
node-iterator-api:1.5.1
okhttp-api:4.9.3-105.vb96869f8ac3a
parameterized-trigger:2.44
pipeline-build-step:2.16
pipeline-graph-analysis:188.v3a01e7973f2c
pipeline-input-step:446.vf27b_0b_83500e
pipeline-milestone-step:100.v60a_03cd446e1
pipeline-model-api:2.2075.vce74e77b_ce40
pipeline-model-definition:2.2075.vce74e77b_ce40
pipeline-model-extensions:2.2075.vce74e77b_ce40
pipeline-rest-api:2.23
pipeline-stage-step:291.vf0a8a7aeeb50
pipeline-stage-tags-metadata:2.2075.vce74e77b_ce40
pipeline-stage-view:2.23
pipeline-utility-steps:2.12.0
plain-credentials:1.8
plugin-util-api:2.16.0
popper-api:1.16.1-2
popper2-api:2.11.4-1
scm-api:595.vd5a_df5eb_0e39
script-security:1145.vb_cf6cf6ed960
snakeyaml-api:1.29.1
ssh-agent:1.24.1
ssh-credentials:1.19
ssh-slaves:1.806.v2253cedd3295
sshd:3.1.0
structs:308.v852b473a2b8c
token-macro:285.vff7645a_56ff0
trilead-api:1.0.13
variant:1.4
windows-slaves:1.0
workflow-aggregator:2.7
workflow-api:1143.v2d42f1e9dea_5
workflow-basic-steps:941.vdfe1b_a_132c64
workflow-cps:2683.vd0a_8f6a_1c263
workflow-cps-global-lib:564.ve62a_4eb_b_e039
workflow-durable-task-step:1128.v8c259d125340
workflow-job:1174.vdcb_d054cf74a_
workflow-multibranch:711.vdfef37cda_816
workflow-scm-step:2.13
workflow-step-api:622.vb_8e7c15b_c95a_
workflow-support:815.vd60466279fc8

Paste the output here

What Operating System are you using (both controller, and any agents involved in the problem)?

Linux

Reproduction steps

  1. Run jenkins-plugin-manager without --war specified.

Expected Results

jenkins-plugin-manager finds jenkins.war at the default path and is able to get the Jenkins version from it.

Actual Results

jenkins.war isn't found and the Jenkins version can't be determined from it:

No war entered. Will use default of /usr/share/jenkins/jenkins.war
Unable to open /usr/share/jenkins/jenkins.war
Unable to get Jenkins version from the WAR file /usr/share/jenkins/jenkins.war

Anything else?

The default jenkins.war path on Linux changed from /usr/share/jenkins/jenkins.war to /usr/share/java/jenkins.war in jenkinsci/packaging#266. Per JENKINS-41218, that's 2.332.1 and 2.335.

@dbnicholson dbnicholson added the bug Something isn't working label Apr 5, 2022
@timja
Copy link
Member

timja commented Apr 5, 2022

Hmm requires docker images to move as well:
https://github.com/jenkinsci/docker/blob/master/17/debian/bullseye/hotspot/Dockerfile#L87-L88

The defaults were built based around the docker images.

@MarkEWaite MarkEWaite added the good first issue Good for newcomers label Jan 27, 2023
@Jagrutiti
Copy link
Contributor

Hey,

I am on Windows 11. The following command worked for me:

 java -jar C:/Users/tiwar/open-source/jenkins-plugin-manager-2.12.9.jar --plugin-file C:/Users/tiwar/open-source/plugins.txt --plugins delivery-pipeline-plugin:1.3.2 deployit-plugin

I added Jenkins.war at "C:\ProgramData\Jenkins" it worked fine.

How do I resolve this issue for Linux?

@Jagrutiti
Copy link
Contributor

Do I have to update the path to /usr/share/java/jenkins.war in Settings.java?

@MarkEWaite
Copy link
Contributor

I think that we want a list of valid locations for the jenkins.war file and search the list in case the first entry in the list is not found. That will allow us to retain compatibility with existing users and acknowledge that there are multiple locations where the jenkins.war can be found if it is not found in the first location that is checked.

@Jagrutiti
Copy link
Contributor

This would be my approach:

In a static file named DefaultPathsForWarFile.txt I shall add all the possible paths?

Then, I will read the file. Loop through each path until the file is found. If the file is found return the path else return null.

Does this sound good to you?

If yes, where shall I implement it? In bundlesPlugins() or in getJenkinsVersionFromWar()?

@MarkEWaite
Copy link
Contributor

An external file seems more complicated than necessary, especially because then that file needs to be copied into the jar file as a resource and accessed from the jar file as a resource.

I think you could declare an array of String in the Java class that implements getJenkinsVersionFromWar() so that the Java class includes the list of possible locations for the war file.

@muhammedSabbah
Copy link

Dear @MarkEWaite,

Can I provide another approach instead of list of valid location to be added hard coded?

if yes, I hope my approach will be correct.

Steps

  • Location of Jenkins war file has gotten by System.getenv("JENKINS_HOME").
  • Based on the location which is returned from first step. it will be good to find war file.

Do you find this solution sounds good or not ?

@MarkEWaite
Copy link
Contributor

  • Location of Jenkins war file has gotten by System.getenv("JENKINS_HOME").

I don't think that will have the result that you want. The JENKINS_HOME directory does not include a copy of the war file, at least not in my installation that was done with the deb package as described in "Installing Jenkins".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment