-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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-37862] Removing build symlink functionality #3982
Conversation
TIL that a single build can be linked to from both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, left a couple of remarks, non blocking though.
Played with it a bit and it seems to work as expected. Nice stuff :)
* Inner maps are from permalink name tp build number. | ||
* Synchronization is first on the outer map, then on the inner. | ||
*/ | ||
private static final Map<File, Map<String, Integer>> caches = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor styling, but as it is a constant I would suggest uppercase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it is a constant reference but not a constant value.
} finally { | ||
cw.abort(); | ||
} | ||
static @Nonnull File storageFor(@Nonnull File buildDir) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this method could be private? Or is there a use case I'm missing?
static @Nonnull File storageFor(@Nonnull File buildDir) { | |
private static @Nonnull File storageFor(@Nonnull File buildDir) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is referenced from the test.
Util.createSymlink(rootDir, targetDir, name, listener); | ||
} | ||
@Deprecated | ||
public final void updateSymlinks(@Nonnull TaskListener listener) throws InterruptedException {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we log a WARNING message like a plugin called updateSymlinks which is now a NOOP, see JENKINS-37862 for details
. This might help track down any plugin that rely on this feature.
We are only talking about maven plugin and workflow-job plugin for the community hosted plugin but I'm more thinking about custom/non hosted in jenkinsci ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are only talking about maven plugin and workflow-job plugin for the community hosted plugin
Right, as per this search.
If there are others in private source, I think nothing special needs to be done—the deprecation warning should eventually lead to the calls being removed. The new impl does nothing, so it is harmless to leave calls alone for a while; and the new plugin does the same update automatically, so there is no loss of functionality when that plugin is installed, regardless of whether or not an exotic job type is still calling this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW before we'd choose a warning I'd recommend collecting this via Telemetry
, as admins can do nothing about it anyway. (But it looks like we need neither.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I do not see anything to telemetrize here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
he new plugin does the same update automatically, so there is no loss of functionality when that plugin is installed
Yeah right, this is the part I missed when I suggested the warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐝
As a Windows user I can only thank you 🎉
Co-Authored-By: jglick <jglick@cloudbees.com>
Feedback so far has been positive and I got hosting approved, so I will prepare for a plugin release but hold off unless and until this PR is actually merged. |
One thing I should have mentioned: Jenkins core will not delete old symlinks that predated the upgrade. They will just be left to rot. If the new plugin is installed, it will update any old symlinks in addition to creating them for new jobs. If this feels like a problem, I suppose core could check for the existence of the plugin, and if not installed/enabled, actively attempt to delete the known symlinks where encountered. |
Should be fine. Definitely |
Maybe just propose a simple bash script for administrators that might really want to clean those up (looks like an edge case to me, not worth developing migration code over). Something in the lines of what I propose for the shelve plugin:
|
Maybe. If we are going to go to the trouble of publishing a migration script, I would rather just put in the little extra work to do it automatically inside core. Let me see if I can write something up today. |
This will negatively impact people who upgrade first and then install the plugin; jobs will lose all existing symlinks and (I assume) only get them back on the next build (and perhaps then not even all of them). |
Good point. In that case, I think it just makes sense to suggest a cleanup command right in the changelog / upgrade guide. The one by @PierreBtz is not right, I think, since |
This seems to work fine on Linux: find $JENKINS_HOME/jobs -type l -name last\* -exec rm -v {} \; Doing the cleanup on Windows servers may be trickier, assuming the account running Jenkins was permitted to create symbolic links to begin with. Would need to figure out the right Powershell mantra. |
People who use them will install the plugin, people who don't, likely won't care that much. More something for the LTS upgrade guide, I think. |
If it is not urgent, I would like to review it before merging |
fwiw, my jenkins uses these links for all sorts of things (including protecting builds from deletion). |
I am not really sure what this is referring to—some custom plugin?—but I would urge you to use standard mechanisms instead, such as |
Custom jobs/scripts--mostly shell scripts. Some to retrieve archives for use in other stages in a psuedo-pipeline. Some to delete a portion of a run because it's a lot of disk space. But, this isn't about keeping the log, it's about keeping artifacts, so |
Then you would be one of the users who could run the new plugin until you have time to switch to supported techniques that do not rely on direct access to
Normally done in actual Pipeline using
Despite the name, this field is about keeping the entire build, not merely the |
That's a horrible name. I don't have the energy to file a bug w/ a PR to try to fix it, but someone should. The documentation says:
Same for Run.isKeepLog:
If it means something else, it's doing a really horrible job of explaining itself. No one in their right mind would divine it means anything else. |
So, I looked, for one project, we have ~15 downstreams using custom code (we have at least 2 flavors of that project, so we're talking about at least 30 projects). We didn't have the I'm willing to offer help w/ this and the related PRs, but the cost for me to migrate 30+ projects (most of which are dead men walking, even if for 3 years) isn't worth it. We don't rely on |
Sorry, I have lost track of what you are talking about here.
No, it does not. Stapler routing suffices for ftp /var/jenkins/jobs/upstream/builds/lastStable/artifacts/upstream.war www@something:/var/wars that bypass the Jenkins server and directly rely on the existence of symbolic links to build directories. |
Err, sorry... We have two things that from my perspective rely on the symbolic names:
We'll install your plugin (the repo either isn't public yet or doesn't exist yet) in order to satisfy 2. I've looked at some of the build cleanup plugins and their intelligence doesn't seem to do a good job of mapping to my understanding of what we're trying to do. It's possible that w/ the From a documentation perspective, if the |
Oops, forgot to fix URL after it was forked to @jenkinsci.
BTW I think I recall a GSoC proposal in this area.
Good point; edited proposed changelog entry accordingly. |
@jsoref What is your final opinion about the PR?
There was, but unfortunately it did not get to GSoC this year. Though @nisarg1499 is still interested in the area, so you could coordinate in https://gitter.im/jenkinsci/gsoc-build-discarder-project (which could be probably renamed now). JIRA tickets for specific issues would be also appreciated. |
@jsoref gentle ping. If you are not interested to continue reviewing this PR, I would like to go ahead with final review/merge |
I'm ok with it. Sorry didn't realize you were waiting on me. Is enough done for us to install that other plugin? |
I am holding off on a release until this PR is merged. |
I had no time to review it, and my apologies for body-blocking the PR for a while. |
Well we had symlinks for a decade, it is certainly no rush to remove them!
As far as I am concerned it is. |
Latest test failure looks like a flake:
|
@jglick taking the review approvals, please feel free to proceed with the merge and to coordinate the plugin release accordingly |
See JENKINS-37862. Moving functionality to a new
build-symlink
plugin for anyone who needs it.Run.createSymlink
usesPeepholePermalink
usesProposed changelog entries
http://jenkins/job/upstream/lastStableBuild/
are not affected, only tools which directly access the$JENKINS_HOME
filesystem. Existing symlinks are not automatically removed by the update; administrators wishing to clean up may run something like the following:Desired reviewers
@jenkinsci/code-reviewers