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

Fix BlockBlobClient cast error downloading from job #226

Merged
merged 1 commit into from
May 17, 2022

Conversation

directhex
Copy link
Contributor

@directhex directhex commented May 17, 2022

I make extensive use of "Download artifact from build -> Upstream build that triggered this job". As of today, this throws:

com.azure.storage.blob.specialized.BlockBlobClient cannot be cast to com.azure.storage.file.share.ShareFileClient

This doesn't work with the current mix of Azure plugin dependencies on an up-to-date Jenkins install. The core issue is when the download items are enumerated, they are of type BlockBlobClient not BlobClient - the instanceof check therefore falls through into the ShareFileClient case, and that's not a valid cast.

Instead, check for the parent type of both BlobClient and BlockBlobClient, BlobClientBase. This is valid for the current case and the old case, so should be safe for various combinations of dependency versions.

  • 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

com.azure.storage.blob.specialized.BlockBlobClient cannot be cast to com.azure.storage.file.share.ShareFileClient
@timja timja added the bug label May 17, 2022
@timja timja merged commit b2cb979 into jenkinsci:master May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants