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

implementing --skip-broken option #627

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

itsAftabAlam
Copy link
Contributor

@itsAftabAlam itsAftabAlam commented Dec 11, 2023

fixes #428

This is an attempt to implement --skip-broken options which need to display the list of failed plugins when enabled.

Approach

A new option named --skip-broken is created. Necessary flags are created for this option. Now when this option is enabled we fetch the list of failed plugins using getFailedPlugins().

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@itsAftabAlam itsAftabAlam marked this pull request as ready for review December 15, 2023 14:16
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide a command line example that shows how you've been able to reach the code that you added to PluginManager.java?

When I run with the following plugins.txt file:

adoptopenjdk:1.5
elastic-axis:464.va_7ed499b_9d75
embeddable-build-status:459.v428d6761597b_

Using the command:

java -jar ./plugin-management-cli/target/jenkins-plugin-manager-2.12.15-SNAPSHOT.jar  --skip-broken --plugin-file ../plugins-few.txt --plugin-download-directory ../plugins

The output is:

No plugin is skipped

If I replace adoptopenjdk:1.5 with adoptopenjdk:9999 (a version that does not exist), it reports that it is unable to resolve dependencies:

Unable to resolve plugin URL https://updates.jenkins.io/download/plugins/adoptopenjdk/9999/adoptopenjdk.hpi, or download plugin adoptopenjdk to file: status code: 404, reason phrase: Not Found
Tried downloading adoptopenjdk from https://get.jenkins.io/plugins/adoptopenjdk/9999/adoptopenjdk.hpi (attempt 1 of 3)
Unable to resolve plugin URL https://updates.jenkins.io/download/plugins/adoptopenjdk/9999/adoptopenjdk.hpi, or download plugin adoptopenjdk to file: status code: 404, reason phrase: Not Found
Tried downloading adoptopenjdk from https://get.jenkins.io/plugins/adoptopenjdk/9999/adoptopenjdk.hpi (attempt 2 of 3)
Tried downloading adoptopenjdk from https://get.jenkins.io/plugins/adoptopenjdk/9999/adoptopenjdk.hpi (attempt 3 of 3)
Unable to resolve plugin URL https://updates.jenkins.io/download/plugins/adoptopenjdk/9999/adoptopenjdk.hpi, or download plugin adoptopenjdk to file: status code: 404, reason phrase: Not Found
Downloading from mirrors failed, falling back to https://archives.jenkins.io/
Unable to resolve plugin URL https://archives.jenkins.io/plugins/adoptopenjdk/9999/adoptopenjdk.hpi, or download plugin adoptopenjdk to file: status code: 404, reason phrase: Not Found
Plugin prerequisite not met:
Plugin adoptopenjdk:9999 has unresolvable dependencies: Unable to resolve dependencies for adoptopenjdk

@itsAftabAlam
Copy link
Contributor Author

itsAftabAlam commented Dec 26, 2023

Hi @MarkEWaite. Thank you for reviewing the PR. You are absolutely right that on replacing adoptopenjdk:1.5 with adoptopenjdk:9999, the code doesn't lists the failed plugins. This is due to the fact that when this situation arises the tool raises an exception and we never reach to the code that lists the failed plugins which I assumed, is an expected behaviour of the tool.

However, if we do have to list the failed plugins even in this scenario. A minor change as depicted in the updated PR will do so. Now, when we run the command again it result in the following output:

Unable to resolve plugin URL https://updates.jenkins.io/download/plugins/adoptopenjdk/999/adoptopenjdk.hpi, or download plugin adoptopenjdk to file: status code: 404, reason phrase: Not Found
Tried downloading adoptopenjdk from https://get.jenkins.io/plugins/adoptopenjdk/999/adoptopenjdk.hpi (attempt 1 of 3)
Unable to resolve plugin URL https://updates.jenkins.io/download/plugins/adoptopenjdk/999/adoptopenjdk.hpi, or download plugin adoptopenjdk to file: status code: 404, reason phrase: Not Found
Tried downloading adoptopenjdk from https://get.jenkins.io/plugins/adoptopenjdk/999/adoptopenjdk.hpi (attempt 2 of 3)
Tried downloading adoptopenjdk from https://get.jenkins.io/plugins/adoptopenjdk/999/adoptopenjdk.hpi (attempt 3 of 3)
Unable to resolve plugin URL https://updates.jenkins.io/download/plugins/adoptopenjdk/999/adoptopenjdk.hpi, or download plugin adoptopenjdk to file: status code: 404, reason phrase: Not Found
Downloading from mirrors failed, falling back to https://archives.jenkins.io/
Unable to resolve plugin URL https://archives.jenkins.io/plugins/adoptopenjdk/999/adoptopenjdk.hpi, or download plugin adoptopenjdk to file: status code: 404, reason phrase: Not Found
Following plugins are skipped due to failure:
adoptopenjdk
Plugin prerequisite not met:
Plugin adoptopenjdk:999 has unresolvable dependencies: Unable to resolve dependencies for adoptopenjdk

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

Successfully merging this pull request may close these issues.

List skipped plugins when --skip-broken argument is used
2 participants