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

Improve the CLI output when the plugin is already present in the directory #610

Open
AayushSaini101 opened this issue Nov 11, 2023 · 9 comments · May be fixed by #611
Open

Improve the CLI output when the plugin is already present in the directory #610

AayushSaini101 opened this issue Nov 11, 2023 · 9 comments · May be fixed by #611
Labels
enhancement New feature or request

Comments

@AayushSaini101
Copy link

AayushSaini101 commented Nov 11, 2023

What feature do you want to see added?

Currently, during the verbose, we cannot get any kind of logs that show whether the plugin is already present in the directory or not.

Current Scenario:
See in this comment: #610 (comment)

Excepted Behaviour:
The verbose should tell the plugin is already present or not in the directory. If the version is different still shows the plugin is already present with this version

@AayushSaini101 AayushSaini101 added the enhancement New feature or request label Nov 11, 2023
@MarkEWaite
Copy link
Contributor

MarkEWaite commented Nov 11, 2023

The --verbose command line argument seems like the place to add such a change. It already reports when a plugin file is being installed. This addition would report when a plugin file already exists.

I think that adding output about existing plugin files to the default (without --verbose) would be a worse experience for most users. Most users don't want progress information reported unless they request it. They request it with the --verbose argument.

@krisstern
Copy link
Member

Do check if you will need to account for the case when you have an update

@AayushSaini101
Copy link
Author

@MarkEWaite @krisstern but after executing using --verbose command

sudo java -jar jenkins-plugin-manager-2.12.13.jar --war /opt/homebrew/opt/jenkins/libexec/jenkins.war --plugin-download-directory /Users/aaayush/.jenkins/plugins --plugins delivery-pipeline-plugin:1.3.2 deployit-plugin --verbose

I am getting a very large log as output

image

@MarkEWaite
Copy link
Contributor

I am getting a very large log as output

Yes, that's expected and desirable. When a user wants more information from the output, they request --verbose and receive additional details about what is happening inside the plugin installation manager tool. I don't think that the tool should treat the existence of a plugin file differently than an upgrade of a plugin file. In non-verbose mode, the tool is mostly silent. In verbose mode, the tool describes many different parts of its operation in the output.

@AayushSaini101
Copy link
Author

@MarkEWaite Using the --verbose argument the tool is showing the plugin is already exist :). Can we add statement in this mode

@MarkEWaite
Copy link
Contributor

MarkEWaite commented Nov 11, 2023

@MarkEWaite Using the --verbose argument the tool is showing the plugin is already exist :). Can we add statement in this mode

I don't see any statement in the output of my --verbose that the plugin file has already been downloaded or already exists. Yes, I think that it would be fine to state that the plugin file already exists when running --verbose.

Using the plugins.txt file:

bouncycastle-api:2.27
instance-identity:185.v303dc7c645f9

and the file README with these contents:

#!/bin/bash

# Exploring plugin installation manager tool command line options
#
# https://github.com/jenkinsci/plugin-installation-manager-tool/issues/610

JENKINS_WAR_VERSION=2.431
JENKINS_WAR=jenkins-${JENKINS_WAR_VERSION}.war
PLUGIN_MANAGER_VERSION=2.12.13
PLUGIN_MANAGER_JAR=jenkins-plugin-manager-${PLUGIN_MANAGER_VERSION}.jar

if [ ! -f ../$PLUGIN_MANAGER_JAR ]; then
  wget https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/${PLUGIN_MANAGER_VERSION}/$PLUGIN_MANAGER_JAR
  mv $PLUGIN_MANAGER_JAR ..
fi
if [ ! -d plugins ]; then
  mkdir plugins
fi
java -jar ../$PLUGIN_MANAGER_JAR --jenkins-version $JENKINS_WAR_VERSION --latest false --plugin-download-directory plugins --plugin-file plugins.txt --verbose

if [ ! -f ../$JENKINS_WAR ]; then
  wget https://get.jenkins.io/war/${JENKINS_WAR_VERSION}/jenkins.war
  mv jenkins.war ../$JENKINS_WAR
fi

# JENKINS_HOME=. java -jar ../$JENKINS_WAR

and the command line:

$ rm -rf plugins
$ bash ./README

I received the first time output:

File containing list of plugins to be downloaded: plugins.txt
Reading in plugins from plugins.txt

Plugin download location: plugins
No CLI option or environment variable set for update center, using default of https://updates.jenkins.io/update-center.json
No CLI option or environment variable set for experimental update center, using default of https://updates.jenkins.io/experimental/update-center.json
No CLI option or environment variable set for incrementals mirror, using default of https://repo.jenkins-ci.org/incrementals
No CLI option or environment variable set for plugin info, using default of https://updates.jenkins.io/plugin-versions.json
No war entered. Will use default of /usr/share/jenkins/jenkins.war

Retrieving update center information
Update center URL: https://updates.jenkins.io/update-center.json?version=2.431
Returning cached value for: update-center-2.431
Returning cached value for: experimental-update-center-2.431
Returning cached value for: plugin-versions
War not found, installing all plugins: /usr/share/jenkins/jenkins.war
Couldn't find checksum for bouncycastle-api at version: 2.27
Setting checksum for: bouncycastle-api to ODfuj3QCv0pNyQ9qIopghghiBbx1XhGerf8rFfr5CKM=

bouncycastle-api has no dependencies
Setting checksum for: instance-identity to 3HjAoj/T0Wp2mnjHgiqUhi3H7ze767CcvqP6Btxn/Go=
Setting checksum for: instance-identity to 3HjAoj/T0Wp2mnjHgiqUhi3H7ze767CcvqP6Btxn/Go=

instance-identity depends on:
bouncycastle-api 2.27
Skipping dependency bouncycastle-api:2.27 and its sub-dependencies, because there is a higher version defined on the top level - bouncycastle-api:2.27
Setting checksum for: instance-identity to 3HjAoj/T0Wp2mnjHgiqUhi3H7ze767CcvqP6Btxn/Go=
Will install new plugin instance-identity 185.v303dc7c645f9
Will install new plugin bouncycastle-api 2.27
Will use url: https://updates.jenkins.io/download/plugins/instance-identity/185.v303dc7c645f9/instance-identity.hpi to download instance-identity plugin
Will use url: https://updates.jenkins.io/download/plugins/bouncycastle-api/2.27/bouncycastle-api.hpi to download bouncycastle-api plugin
Downloaded instance-identity from https://mirror.xmission.com/jenkins/plugins/instance-identity/185.v303dc7c645f9/instance-identity.hpi (attempt 1 of 3)
Downloaded and validated plugin instance-identity
Checksum valid for: instance-identity
Downloaded bouncycastle-api from https://mirror.xmission.com/jenkins/plugins/bouncycastle-api/2.27/bouncycastle-api.hpi (attempt 1 of 3)
Downloaded and validated plugin bouncycastle-api
Checksum valid for: bouncycastle-api
Done

When I ran the second time with the command:

$ bash ./README

I received the output:

File containing list of plugins to be downloaded: plugins.txt
Reading in plugins from plugins.txt

Plugin download location: plugins
No CLI option or environment variable set for update center, using default of https://updates.jenkins.io/update-center.json
No CLI option or environment variable set for experimental update center, using default of https://updates.jenkins.io/experimental/update-center.json
No CLI option or environment variable set for incrementals mirror, using default of https://repo.jenkins-ci.org/incrementals
No CLI option or environment variable set for plugin info, using default of https://updates.jenkins.io/plugin-versions.json
No war entered. Will use default of /usr/share/jenkins/jenkins.war

Retrieving update center information
Update center URL: https://updates.jenkins.io/update-center.json?version=2.431
Returning cached value for: update-center-2.431
Returning cached value for: experimental-update-center-2.431
Returning cached value for: plugin-versions
War not found, installing all plugins: /usr/share/jenkins/jenkins.war
Couldn't find checksum for bouncycastle-api at version: 2.27
Setting checksum for: bouncycastle-api to ODfuj3QCv0pNyQ9qIopghghiBbx1XhGerf8rFfr5CKM=

bouncycastle-api has no dependencies
Setting checksum for: instance-identity to 3HjAoj/T0Wp2mnjHgiqUhi3H7ze767CcvqP6Btxn/Go=
Setting checksum for: instance-identity to 3HjAoj/T0Wp2mnjHgiqUhi3H7ze767CcvqP6Btxn/Go=

instance-identity depends on:
bouncycastle-api 2.27
Skipping dependency bouncycastle-api:2.27 and its sub-dependencies, because there is a higher version defined on the top level - bouncycastle-api:2.27
Setting checksum for: instance-identity to 3HjAoj/T0Wp2mnjHgiqUhi3H7ze767CcvqP6Btxn/Go=
Done

I don't see output in the second run that tells me the instance-identity plugin already exists.

@AayushSaini101
Copy link
Author

@MarkEWaite can I create an issue regarding this to add statement in verbose ? Or update this issue

@MarkEWaite
Copy link
Contributor

@MarkEWaite can I create an issue regarding this to add statement in verbose ? Or update this issue

Updating this issue seems like the best approach to me.

@aayushRedHat
Copy link

@MarkEWaite can I create an issue regarding this to add statement in verbose ? Or update this issue

Updating this issue seems like the best approach to me.

Thanks

@AayushSaini101 AayushSaini101 linked a pull request Nov 12, 2023 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants