Skip to content

Upgrade to track 2 SDK, v6 => v12 #15

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

Merged
merged 9 commits into from
May 6, 2021
Merged

Conversation

timja
Copy link
Member

@timja timja commented May 5, 2021

need to figure out copyBlobs method

listener.getLogger().println(Messages.AzureArtifactManager_copy_all_fail(e));
throw new IOException(e);
}
}

private int copyBlobs(Iterable<ListBlobItem> sourceBlobs, String toKey, CloudBlobContainer container) throws
StorageException, URISyntaxException {
private int copyBlobs(PagedIterable<BlobItem> sourceBlobs, String toKey, BlobContainerClient container) {
Copy link
Member Author

Choose a reason for hiding this comment

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

@jglick do you know what this is used for? / how to test it?
It's part of this API:
https://javadoc.jenkins.io/plugin/workflow-api/index.html?org/jenkinsci/plugins/workflow/flow/StashManager.StashAwareArtifactManager.html

There's no test coverage for it here, and I haven't managed to trigger this usecase.

Can't see it in the JEP either

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

❤️ this conformance test, mostly got it working but it picked up deeply nested dir not working for some reason, although one level of dir working

Copy link
Member Author

Choose a reason for hiding this comment

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

ugh this requires re-writing of the archive method to make the test pass.

The test is failing because the .git directory is not being archived, .git isn't being archived because the storage plugin is using https://github.com/jenkinsci/azure-storage-plugin/blob/master/src/main/java/com/microsoftopentechnologies/windowsazurestorage/service/UploadService.java#L502

Which calls https://javadoc.jenkins.io/hudson/FilePath.html#list-java.lang.String-java.lang.String-

Which uses the default exclude list from ant, which excludes .git.

https://github.com/apache/ant/blob/e6ab7d025f2685b954c8ecf78811d314067d3b1b/src/main/org/apache/tools/ant/DirectoryScanner.java#L195-L199

Also not sure how reasonable this test is, who is archiving .git directories =/

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

The test is failing because the .git directory is not being archived

Sorry, what .git/ directory? Which test would be trying to archive that?

Copy link
Member

Choose a reason for hiding this comment

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

I think the s3 plugin passes because it defaults to ignoring deleting of stashes?

It depends on which tests you run. Use the *AndDelete versions if your artifact manager supports deleting blobs, the base versions if it does not, or both if this behavior is configurable.

Copy link
Member

Choose a reason for hiding this comment

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

For context, artifact-manager-s3 normally does not delete blobs because

  • It is safer to not have to grant Jenkins that permission, which could be used to erase evidence. In the default mode you need only grant it permission to create new blobs.
  • There are more efficient and reliable ways of deleting blobs in bulk according to some policy, or even moving them to archival storage like Glacier.

Copy link
Member Author

Choose a reason for hiding this comment

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

The test is failing because the .git directory is not being archived

Sorry, what .git/ directory? Which test would be trying to archive that?

This test asserts that you can copy git directories, I solved that bit by rewriting the archive method

I think the s3 plugin passes because it defaults to ignoring deleting of stashes?

It depends on which tests you run. Use the *AndDelete versions if your artifact manager supports deleting blobs, the base versions if it does not, or both if this behavior is configurable.

Ah I see, yes this one does support it

For context, artifact-manager-s3 normally does not delete blobs because
It is safer to not have to grant Jenkins that permission, which could be used to erase evidence. > In the default mode you need only grant it permission to create new blobs.

I see, in the current setup of this / other plugins in the Azure eco-system it's not possible to prevent Jenkins having that permission. Azure has moved on and now has the required features to make that possible but it requires some plugin(s) factoring. I'll leave as is for now.

Thanks! The test now passes

Copy link
Member

Choose a reason for hiding this comment

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

This test asserts that you can copy git directories

Ah sorry I had forgotten about https://github.com/jenkinsci/workflow-api-plugin/blob/fa8a6b3e6d5248e4489545ccb33f1f623ad4c9bb/src/test/java/org/jenkinsci/plugins/workflow/ArtifactManagerTest.java#L209 and https://github.com/jenkinsci/workflow-api-plugin/blob/fa8a6b3e6d5248e4489545ccb33f1f623ad4c9bb/src/test/java/org/jenkinsci/plugins/workflow/ArtifactManagerTest.java#L362 which I guess are trying to verify consistent behavior with the built-in artifact manager.

it's not possible to prevent Jenkins having that permission

Fine, that is just a design decision for this plugin, so you pick whichever test flavor is more appropriate.

@timja timja added the enhancement New feature or request label May 6, 2021
Can't stream it unfortunately as each file has a different signed url
@timja timja mentioned this pull request May 6, 2021
@timja timja marked this pull request as ready for review May 6, 2021 13:12
@timja timja mentioned this pull request May 6, 2021
@timja timja requested a review from xuzhang3 May 6, 2021 13:17
@timja
Copy link
Member Author

timja commented May 6, 2021

fyi @xuzhang3 if you have time

@timja timja merged commit 15c954c into jenkinsci:master May 6, 2021
@timja timja deleted the upgrade-sdk branch May 6, 2021 15:08
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 this pull request may close these issues.

2 participants