Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-55646

Provide option to always extract files from war file

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      When starting jenkins for the first time via java -jar jenkins.war the contents of jenkins.war get extracted to (usually) /.jenkins/war. When starting jenkins for the second time the files in /.jenkins/war get only updated when they changed in jenkins.war. At least this is how it is supposed to work. Unfortunately the correct solution is based on a empty .timestamp file where the last modified timestamp of this file will be compared against the last modified timestamp of jenkins.war. Only if the timestamp of jenkins.war is newer files will be extracted and a new .timestamp file with the timestamp of the war file will be written to ~/.jenkins/war.

      I’m using the jenkins package from nixpkgs. The goal of nix/nixpkgs is to provide reproducible builds, which means that the build of a package should always produce the same output when the input (i.e. source files) don’t change. In order to achieve this nix sets the last modiefied timestamp of all files to Jan 1 1970, otherwise you wouldn’t get the same result.

      Generally speaking I think relying on the timestamps of some files is a bad approach as it doesn’t work reliably. A better approach would be to calculate a checksum of the war file and store that in ~/.jenkins/war instead of the timestamp. I’m not sure if this would be a solution you want to adopt, that’s why I would be already happy when you could provide an option to just disable the timestamp check, so that the contents of the war file are extracted every single time when I start jenkins.

      FWIW: my current workaround is to start jenkins like this rm -rf ~/.jenkins/war && java -jar jenkins.war but that always depends on implicit knowledge where the jenkins home folder is located, so I would prefer a more generic solution.

        Attachments

          Activity

          lo1tuma Mathias Schreck created issue -
          lo1tuma Mathias Schreck made changes -
          Field Original Value New Value
          Description When starting jenkins for the first time via {{java -jar jenkins.war}} the contents of {{jenkins.war}} get extracted to (usually) {{~/.jenkins/war}}. When starting jenkins for the second time the files in {{~/.jenkins/war}} get only updated when they changed in {{jenkins.war}. At least this is how it is supposed to work. Unfortunately the correct solution is based on a [empty {{.timestamp}} file|https://github.com/jenkinsci/winstone/blob/1433d7f48f571fe1ee0821aa7ceb43cef91ef453/src/main/java/winstone/HostConfiguration.java#L249-L250] where the last modified timestamp of this file will be compared against the last modified timestamp of {{jenkins.war}}. Only if the timestamp of {{jenkins.war}} is newer files will be extracted and a new {{.timestamp}} file with the timestamp of the war file will be [written to {{~/.jenkins/war}}|https://github.com/jenkinsci/winstone/blob/1433d7f48f571fe1ee0821aa7ceb43cef91ef453/src/main/java/winstone/HostConfiguration.java#L288-L289].

          I’m using the jenkins package from [nixpkgs|https://github.com/NixOS/nixpkgs]. The goal of {{nix}}/{{nixpkgs} is to provide reproducible builds, which means that the build of package should always produce the same output when the input (i.e. source files) don’t change. In order to achieve this {{nix}} sets the last modiefied timestamp of all files to {{Jan 1 1970}}, otherwise you wouldn’t get the same result.

          Generally speaking I think relying on the timestamps of some files is a bad approach as it doesn’t work reliably. A better approach would be to calculate a checksum of the war file and store that in {{~/.jenkins/war}} instead of the timestamp. I’m not sure if this would be a solution you want to adopt, that’s why I would be already happy when you could provide an option to just disable the timestamp check, so that the contents of the war file are extracted every single time when I start jenkins.

          FWIW: my current workaround is to start jenkins like this {{rm -rf ~/.jenkins/war && java -jar jenkins.war}} but that always depends on implicit knowledge where the jenkins home folder is located, so I would prefer a more generic solution.
          When starting jenkins for the first time via {{java -jar jenkins.war}} the contents of {{jenkins.war}} get extracted to (usually) {{~/.jenkins/war}}. When starting jenkins for the second time the files in {{~/.jenkins/war}} get only updated when they changed in {{jenkins.war}}. At least this is how it is supposed to work. Unfortunately the correct solution is based on a [empty {{.timestamp}} file|https://github.com/jenkinsci/winstone/blob/1433d7f48f571fe1ee0821aa7ceb43cef91ef453/src/main/java/winstone/HostConfiguration.java#L249-L250] where the last modified timestamp of this file will be compared against the last modified timestamp of {{jenkins.war}}. Only if the timestamp of {{jenkins.war}} is newer files will be extracted and a new {{.timestamp}} file with the timestamp of the war file will be [written to {{~/.jenkins/war}}|https://github.com/jenkinsci/winstone/blob/1433d7f48f571fe1ee0821aa7ceb43cef91ef453/src/main/java/winstone/HostConfiguration.java#L288-L289].

          I’m using the jenkins package from [nixpkgs|https://github.com/NixOS/nixpkgs]. The goal of {{nix}}/{{nixpkgs}} is to provide reproducible builds, which means that the build of package should always produce the same output when the input (i.e. source files) don’t change. In order to achieve this {{nix}} sets the last modiefied timestamp of all files to {{Jan 1 1970}}, otherwise you wouldn’t get the same result.

          Generally speaking I think relying on the timestamps of some files is a bad approach as it doesn’t work reliably. A better approach would be to calculate a checksum of the war file and store that in {{~/.jenkins/war}} instead of the timestamp. I’m not sure if this would be a solution you want to adopt, that’s why I would be already happy when you could provide an option to just disable the timestamp check, so that the contents of the war file are extracted every single time when I start jenkins.

          FWIW: my current workaround is to start jenkins like this {{rm -rf ~/.jenkins/war && java -jar jenkins.war}} but that always depends on implicit knowledge where the jenkins home folder is located, so I would prefer a more generic solution.
          lo1tuma Mathias Schreck made changes -
          Description When starting jenkins for the first time via {{java -jar jenkins.war}} the contents of {{jenkins.war}} get extracted to (usually) {{~/.jenkins/war}}. When starting jenkins for the second time the files in {{~/.jenkins/war}} get only updated when they changed in {{jenkins.war}}. At least this is how it is supposed to work. Unfortunately the correct solution is based on a [empty {{.timestamp}} file|https://github.com/jenkinsci/winstone/blob/1433d7f48f571fe1ee0821aa7ceb43cef91ef453/src/main/java/winstone/HostConfiguration.java#L249-L250] where the last modified timestamp of this file will be compared against the last modified timestamp of {{jenkins.war}}. Only if the timestamp of {{jenkins.war}} is newer files will be extracted and a new {{.timestamp}} file with the timestamp of the war file will be [written to {{~/.jenkins/war}}|https://github.com/jenkinsci/winstone/blob/1433d7f48f571fe1ee0821aa7ceb43cef91ef453/src/main/java/winstone/HostConfiguration.java#L288-L289].

          I’m using the jenkins package from [nixpkgs|https://github.com/NixOS/nixpkgs]. The goal of {{nix}}/{{nixpkgs}} is to provide reproducible builds, which means that the build of package should always produce the same output when the input (i.e. source files) don’t change. In order to achieve this {{nix}} sets the last modiefied timestamp of all files to {{Jan 1 1970}}, otherwise you wouldn’t get the same result.

          Generally speaking I think relying on the timestamps of some files is a bad approach as it doesn’t work reliably. A better approach would be to calculate a checksum of the war file and store that in {{~/.jenkins/war}} instead of the timestamp. I’m not sure if this would be a solution you want to adopt, that’s why I would be already happy when you could provide an option to just disable the timestamp check, so that the contents of the war file are extracted every single time when I start jenkins.

          FWIW: my current workaround is to start jenkins like this {{rm -rf ~/.jenkins/war && java -jar jenkins.war}} but that always depends on implicit knowledge where the jenkins home folder is located, so I would prefer a more generic solution.
          When starting jenkins for the first time via {{java -jar jenkins.war}} the contents of {{jenkins.war}} get extracted to (usually) {{~/.jenkins/war~}}. When starting jenkins for the second time the files in {{/.jenkins/war}} get only updated when they changed in {{jenkins.war}}. At least this is how it is supposed to work. Unfortunately the correct solution is based on a [empty {{.timestamp}} file|https://github.com/jenkinsci/winstone/blob/1433d7f48f571fe1ee0821aa7ceb43cef91ef453/src/main/java/winstone/HostConfiguration.java#L249-L250] where the last modified timestamp of this file will be compared against the last modified timestamp of {{jenkins.war}}. Only if the timestamp of {{jenkins.war}} is newer files will be extracted and a new {{.timestamp}} file with the timestamp of the war file will be [written to {{~/.jenkins/war}}|https://github.com/jenkinsci/winstone/blob/1433d7f48f571fe1ee0821aa7ceb43cef91ef453/src/main/java/winstone/HostConfiguration.java#L288-L289].

          I’m using the jenkins package from [nixpkgs|https://github.com/NixOS/nixpkgs]. The goal of {{nix}}/{{nixpkgs}} is to provide reproducible builds, which means that the build of a package should always produce the same output when the input (i.e. source files) don’t change. In order to achieve this {{nix}} sets the last modiefied timestamp of all files to {{Jan 1 1970}}, otherwise you wouldn’t get the same result.

          Generally speaking I think relying on the timestamps of some files is a bad approach as it doesn’t work reliably. A better approach would be to calculate a checksum of the war file and store that in {{~/.jenkins/war}} instead of the timestamp. I’m not sure if this would be a solution you want to adopt, that’s why I would be already happy when you could provide an option to just disable the timestamp check, so that the contents of the war file are extracted every single time when I start jenkins.

          FWIW: my current workaround is to start jenkins like this {{rm -rf ~/.jenkins/war && java -jar jenkins.war}} but that always depends on implicit knowledge where the jenkins home folder is located, so I would prefer a more generic solution.

            People

            • Assignee:
              Unassigned
              Reporter:
              lo1tuma Mathias Schreck
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: