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

[JENKINS-49635] VirtualFile support #67

Merged
merged 49 commits into from Jun 15, 2018

Conversation

jglick
Copy link
Member

@jglick jglick commented Feb 28, 2018

Downstream of jenkinsci/jenkins#3302 & jenkinsci/plugin-pom#98.

  • reusable test facility
  • StashManager integration
  • stronger tests

@reviewbybees

pom.xml Outdated
@@ -62,7 +62,8 @@
</pluginRepository>
</pluginRepositories>
<properties>
<jenkins.version>2.60.3</jenkins.version>
<jenkins-core.version>2.110-20180228.232138-2</jenkins-core.version> <!-- TODO https://github.com/jenkinsci/jenkins/pull/3302 -->
Copy link
Member

Choose a reason for hiding this comment

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

🐛 Hard nope for me right here. We do not accept gratuitous core bumps especially to such a bleeding edge core versions because it prevents anybody from being able to consume new features and bugfixes to the pipeline plugins.

Copy link
Member

Choose a reason for hiding this comment

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

I agree. At a minimum this needs to hit LTS first.

Copy link
Member

Choose a reason for hiding this comment

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

Prefer 2 LTS cycles because otherwise it's hard to ship fixes to many of the users (especially important for urgent issues) that tend to run an LTS behind but yeah, 1 LTS is the bare minimum for me too -- should be reserved for critical fixes and super high-value features generally though.

Copy link
Member

@svanoort svanoort left a comment

Choose a reason for hiding this comment

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

Unmerge-able due to dependency on an unreleased Jenkins core. Please find a way to accomplish this that does NOT stand in the way of plugin development (or force massive amounts of backporting for all new work).

@svanoort
Copy link
Member

svanoort commented Mar 1, 2018

Note: that's only a time-sensitive merge-block, not a permanent one. I'm assuming that this is a speculative WIP PR so that won't be an issue and by the time it's release-ready the dependency will have been in an LTS or two.

@jglick
Copy link
Member Author

jglick commented Mar 1, 2018

Well, no. See JEP-300.

Anyway that is parenthetical—obviously no one was proposing a PR like this be merged today. Please reserve PR reviews to substantive matters of the code change itself to avoid visual clutter. It is helpful to create (I think conventionally orange?) on-hold labels as a marker for PRs which are not eligible for immediate merging to their target branch for logistical reasons, at least until Essentials is live.

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

The code mostly looks good to me. Environment management looks quite suspicious, but it's a wider issue in Jenkins.

}
}

private static @Nonnull EnvVars envFor(@Nonnull FilePath workspace, @Nonnull TaskListener listener) throws IOException, InterruptedException {
Copy link
Member

Choose a reason for hiding this comment

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

Not sure about the current implementation. It builds computer environment variables, but ignores possible overrides by the Run's logic. I hope it does not impact artifact managers, but I can imagine withEnvVars() closure overriding some variables for the external artifact manager. E.g. just tool() installation for the artifact management binary.

Maybe an edge case

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes this could be improved I think—will check. Anyway this method is only called when using the deprecated overloads. As of jenkinsci/workflow-basic-steps-plugin#60 the actual EnvVars is loaded from the step context, for example taking into account withEnv blocks.

@jglick jglick added the on-hold label Mar 14, 2018
@jglick jglick dismissed svanoort’s stale review March 14, 2018 19:14

Added on-hold label to remind viewers of current unmergeability.

@jglick jglick requested a review from svanoort March 14, 2018 19:15
@Rule public JenkinsRule r = new JenkinsRule();
@Rule public LoggerRule logging = new LoggerRule();

public static void run(@Nonnull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would split this, at least another for StashAwareArtifactManager, otherwise we only get the first failure

@vivek
Copy link

vivek commented Jun 12, 2018

As of jenkinsci/jep#117 plus recent edits here, Javadoc and JEP both already link to recommended implementation strategies, and all relevant APIs are marked beta. Anyone who deliberately bypasses beta restrictions in a new plugin, does not consult with the authors of the APIs in question, and offers a poor-quality implementation is beyond our help. There is no reason to believe they would choose to implement any other intermediate API we offer anyway.

I think we can move forward with above consideration. @svanoort this sounds good to you? Lets get moving on this PR :)

@svanoort
Copy link
Member

@vivek I'm just waiting on some docs from @jglick as promised somewhere way above and then yeah, I'll do the dance to set up the master/stable branches, merge this to master, and set the merge target as stable

@vivek
Copy link

vivek commented Jun 12, 2018

Thanks @svanoort!

@carlossg
Copy link
Contributor

We will only ever care about storing external artifacts in cloud blob stores (AWS S3 and similar implementations in Azure, Google Cloud, etc) that are supported via the JClouds library.

That is not accurate, implementors may choose their own libraries. JClouds makes it easier but other libraries may be more optimized, so it's up to future implementors to choose, but that's not the API decision

If community members decide to implement their own external storage solutions on top of the new API here, we are not responsible for any harm they do to Jenkins or the Pipeline ecosystem

correct, we can't predict the future

I raised a concern that this set of APIs is so tightly coupled to JClouds APIs that it cannot be used for artifact repositories such as Artifactory and Nexus

I don't think it is coupled to JClouds but to blobstores. I'd rather not over engineer a solution for artifact repositories until there is any interest from those parties, and they might as well ignore this as using mvn deploy or such would make it unnecessary

I have proposed a compromise, which is to define one additional level of ExtensionPoint above the JCloudsArtifactManager that plugin authors can extend. This would extend StashAwareArtifactManager and provide a minimal set of logic for failure detection and handling - probably hooks to wrap an HTTP call with RobustHttpClient, maybe a top-level timeout and retry for operations.

I don't agree that retry logic should live in pipeline. This approach would assume that other cloud libraries don't already have some retry logic or that use a specific http client, which may not hold true. If we see other implementations copy that logic then we can move it up or sideways to a common utilities plugin

when community members see the implementation and try to roll their own storage implementation

again I don't think we should over engineer it, the first implementation complies with requirements, there is no timeframe for new implementations and this is considered Beta to bring other interested parties

The entire point of marking newly introduced APIs with the beta annotation is so that we can ship working features without needing this kind of discussion of hypotheticals, do development in master, and refactor later if and when our initial assumptions are proven wrong.

agreed

@jglick
Copy link
Member Author

jglick commented Jun 13, 2018

(503 from repo.azure.jenkins.io)

@jglick jglick requested a review from svanoort June 13, 2018 16:25
@svanoort svanoort closed this Jun 14, 2018
@svanoort svanoort reopened this Jun 14, 2018
@@ -291,8 +291,12 @@ public boolean shouldClearAll(@Nonnull Run<?,?> build) {

/**
* Mixin interface for an {@link ArtifactManager} which supports specialized stash behavior as well.
* The recommended standard implementation is in the plugin currently named {@code artifact-manager-s3},
* which in turn supports extensibility to various cloud providers.
* <p>The recommended standard implementation is {@code JCloudsArtifactManager}
Copy link
Member

Choose a reason for hiding this comment

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

@jglick This is still not what we had discussed.

Copy link
Member

@svanoort svanoort left a comment

Choose a reason for hiding this comment

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

Still did not apply the requested docs change, just reworded some unrelated things.

@svanoort
Copy link
Member

@vivek Still blocked here due to not making the requested and trivial change. I noted this would be ready to merge:

once the "you should extend this other thing here, extending this is dangerous" expectation is clearly spelled out in Javadocs and documentation - both in this PR (warning: "implement StashAwareArtifactManager at your own risk if you use network storage") and in the downstream implementation.

Instead a few trivial rewordings were done.

I've set a very low bar here for merging what I consider to be a risky change and yet still someone felt they did not need to meet it?

@vivek
Copy link

vivek commented Jun 15, 2018

@svanoort PTAL, I think its good to go.

Copy link
Member

@svanoort svanoort left a comment

Choose a reason for hiding this comment

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

It's getting closer but I still want it to be very explicit about the dangerous bits and what they are. This one is risky enough that we can't afford to be cryptic about intent.

Something like this would be preferred:

"For off-master artifact storage, you should NOT extent this directly but instead use the $JCloudImpl by extending its BlobStore. This is dangerous to directly extend if using remote storage unless you write a very robust handling of network failures including at least a base timeout and retries."

Saying a standard implementation exists does not make it clear that you must be basing off that. Thanks!

@svanoort svanoort merged commit cb22f5c into jenkinsci:master Jun 15, 2018
@jglick jglick deleted the VirtualFile-JENKINS-49635 branch June 15, 2018 16:37
jglick added a commit to jglick/workflow-basic-steps-plugin that referenced this pull request Jun 15, 2018
jglick added a commit to jglick/copyartifact-plugin that referenced this pull request Jun 15, 2018
jglick added a commit to jglick/compress-artifacts-plugin that referenced this pull request Jun 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants