[JIRA] (JENKINS-58659) ZipExtractionInstaller should ignore timestamp if URL changes

6 views
Skip to first unread message

anders@hammar.net (JIRA)

unread,
Jul 25, 2019, 9:23:02 AM7/25/19
to jenkinsc...@googlegroups.com
Anders Hammar created an issue
 
Jenkins / Improvement JENKINS-58659
ZipExtractionInstaller should ignore timestamp if URL changes
Issue Type: Improvement Improvement
Assignee: Unassigned
Components: core
Created: 2019-07-25 13:22
Environment: Jenkins LTS 2.176.2
RedHat OpenJDK 1.8.0
RHEL 7
Priority: Minor Minor
Reporter: Anders Hammar

Background:
We're using the Custom Tools Plugin to define misc custom tools in our Jenkins environment. Typically we use "Install automatically" and use the "Extract .zip/.tar.gz" installer to download the tool archive. The archive is typically hosted in our Nexus instance and we specify the exact version, like this:
http://nexus.acme.org/content/repositories/releases/org/acme/jenkins/nifty-tool/1.0.0/nifty-tool-1.0.0.tar.gz
(In this example we're pointing at a Maven artifact, but it could be any URL.)

When there is a new version of the tool we just update the ULR and Jenkins will update automatically.

Problem:
The problem is when we want to downgrade to an earlier version. For example, we have
http://nexus.acme.org/content/repositories/releases/org/acme/jenkins/nifty-tool/1.0.1/nifty-tool-1.0.1.tar.gz
but want to change back to the old
http://nexus.acme.org/content/repositories/releases/org/acme/jenkins/nifty-tool/1.0.0/nifty-tool-1.0.0.tar.gz

In this case the older version is not automatically installed, but we need to manually go in on every slave and remove the .timestamp file to force a downgrade.

Suggested Improvement:
The current behavior where only a newer archive is doenloaded and installed is suitable when the URL doesn't change but one just updates the archive (overwriting the old file). But if the URL changes, the archive should be installed regardless of the timestamp. A different URL should always indicate a different archive.

The change should be done in hudson.tool.FilePath.installIfNecessaryFrom(). The current javadoc says that if the timestamp of the archive doesn't match the local timestamp it is re-extracted, which is not fully correct. JENKINS-16215 changed this behavior so that the local timestamp value is use as if-modified-since header on the UrlConnection. So a downgrade to an earlier/older archive from an Http URL will never happen.

A possible impl solution is to store the URL in the timestamp file and use that to check if the URL has changed. If it has, always re-extract regardless of the local timestamp.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

slide.o.mix@gmail.com (JIRA)

unread,
Jul 25, 2019, 11:24:02 PM7/25/19
to jenkinsc...@googlegroups.com
Alex Earl updated an issue
Change By: Alex Earl
Component/s: customtools-plugin
Component/s: core

anders@hammar.net (JIRA)

unread,
Jul 26, 2019, 3:38:01 AM7/26/19
to jenkinsc...@googlegroups.com
Anders Hammar commented on Improvement JENKINS-58659
 
Re: ZipExtractionInstaller should ignore timestamp if URL changes

The functionality is in core, could someone please change back the specified component?
(Custom tools plugin, and other plugins, uses this core func.)

anders@hammar.net (JIRA)

unread,
Jul 26, 2019, 3:38:02 AM7/26/19
to jenkinsc...@googlegroups.com
Anders Hammar updated an issue
 
Change By: Anders Hammar
Background:
We're using the Custom Tools Plugin to define misc custom tools in our Jenkins environment. Typically we use "Install automatically" and use the "Extract *.zip/*.tar.gz" installer to download the tool archive. The archive is typically hosted in our Nexus instance and we specify the exact version, like this:

http://nexus.acme.org/content/repositories/releases/org/acme/jenkins/nifty-tool/1.0.0/nifty-tool-1.0.0.tar.gz
(In this example we're pointing at a Maven artifact, but it could be any URL.)

When there is a new version of the tool we just update the ULR and Jenkins will update automatically.

Problem:
The problem is when we want to downgrade to an earlier version. For example, we have
http://nexus.acme.org/content/repositories/releases/org/acme/jenkins/nifty-tool/1.0.1/nifty-tool-1.0.1.tar.gz
but want to change back to the old
http://nexus.acme.org/content/repositories/releases/org/acme/jenkins/nifty-tool/1.0.0/nifty-tool-1.0.0.tar.gz

In this case the older version is not automatically installed, but we need to manually go in on every slave and remove the .timestamp file to force a downgrade.

Suggested Improvement:
The current behavior where only a newer archive is doenloaded downloaded and installed is suitable when the URL doesn't change but one just updates the archive (overwriting the old file). But if the URL changes, the archive should be installed regardless of the timestamp. A different URL should always indicate a different archive.


The change should be done in hudson.tool.FilePath.installIfNecessaryFrom(). The current javadoc says that if the timestamp of the archive doesn't match the local timestamp it is re-extracted, which is not fully correct. JENKINS-16215 changed this behavior so that the local timestamp value is use as if-modified-since header on the UrlConnection. So a downgrade to an earlier/older archive from an Http URL will never happen.

A possible impl solution is to store the URL in the timestamp file and use that to check if the URL has changed. If it has, always re-extract regardless of the local timestamp.

anders@hammar.net (JIRA)

unread,
Jul 31, 2019, 7:03:04 AM7/31/19
to jenkinsc...@googlegroups.com
Anders Hammar updated an issue
Background:
We're using the Custom Tools Plugin to define misc custom tools in our Jenkins environment. Typically we use "Install automatically" and use the "Extract *.zip/*.tar.gz" installer to download the tool archive. The archive is typically hosted in our Nexus instance and we specify the exact version, like this:
http://nexus.acme.org/content/repositories/releases/org/acme/jenkins/nifty-tool/1.0.0/nifty-tool-1.0.0.tar.gz
(In this example we're pointing at a Maven artifact, but it could be any URL.)

When there is a new version of the tool we just update the ULR and Jenkins will update automatically.

Problem:
The problem is when we want to downgrade to an earlier version. For example, we have
http://nexus.acme.org/content/repositories/releases/org/acme/jenkins/nifty-tool/1.0.1/nifty-tool-1.0.1.tar.gz
but want to change back to the old
http://nexus.acme.org/content/repositories/releases/org/acme/jenkins/nifty-tool/1.0.0/nifty-tool-1.0.0.tar.gz

In this case the older version is not automatically installed, but we need to manually go in on every slave and remove the .timestamp file to force a downgrade.

Suggested Improvement:
The current behavior where only a newer archive is downloaded and installed is suitable when the URL doesn't change but one just updates the archive (overwriting the old file). But if the URL changes, the archive should be installed regardless of the timestamp. A different URL should always indicate a different archive.

The change should be done in hudson.
tool. FilePath.installIfNecessaryFrom(). The current javadoc says that if the timestamp of the archive doesn't match the local timestamp it is re-extracted, which is not fully correct. JENKINS-16215 changed this behavior so that the local timestamp value is use as if-modified-since header on the UrlConnection. So a downgrade to an earlier/older archive from an Http URL will never happen.


A possible impl solution is to store the URL in the timestamp file and use that to check if the URL has changed. If it has, always re-extract regardless of the local timestamp.

anders@hammar.net (JIRA)

unread,
Aug 10, 2019, 2:34:02 AM8/10/19
to jenkinsc...@googlegroups.com
Anders Hammar updated an issue
Change By: Anders Hammar
Component/s: core
Component/s: customtools-plugin
Reply all
Reply to author
Forward
0 new messages