• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • None
    • Ubuntu 20.04

      We have Jenkins masters on Ubuntu 20.04. They started showing end-of-life monitor alerts yesterday. According to the data in https://github.com/MarkEWaite/jenkins/blob/master/core/src/main/resources/jenkins/monitor/OperatingSystemEndOfLifeAdminMonitor/end-of-life-data.json#L131-L132 that is generally correct, as it's exactly 6 months from now.

      However, the alert being shown doesn't use the date from the JSON file, but rather the default date from the Java code (the field initialization value at https://github.com/MarkEWaite/jenkins/blob/master/core/src/main/java/jenkins/monitor/OperatingSystemEndOfLifeAdminMonitor.java#L76)

          [JENKINS-73845] end-of-life monitor shows wrong date

          Mark Waite added a comment - - edited

          I'm unable to duplicate the issue as described. I suspect that your Jenkins installation is damaged, with some of the files being deleted or otherwise harmed.

          Steps I took while trying to duplicate the problem (see the JENKINS-73845.tar.gz tar archive for my files):

          1. Create a Dockerfile based on Ubuntu 20.04 with Jenkins 2.479
          2. Build the Dockerfile with the command bash ./README
          3. Run the container image with the command docker run --rm -i -t -p 8080:8080 jenkins-73845:1276
          4. Complete the setup wizard by creating a user and installing no additional plugins
          5. Confirm that the end of life warning looks like this:

          Mark Waite added a comment - - edited I'm unable to duplicate the issue as described. I suspect that your Jenkins installation is damaged, with some of the files being deleted or otherwise harmed. Steps I took while trying to duplicate the problem (see the JENKINS-73845.tar.gz tar archive for my files): Create a Dockerfile based on Ubuntu 20.04 with Jenkins 2.479 Build the Dockerfile with the command bash ./README Run the container image with the command docker run --rm -i -t -p 8080:8080 jenkins-73845:1276 Complete the setup wizard by creating a user and installing no additional plugins Confirm that the end of life warning looks like this:

          markewaite I have been troubleshooting this lately.. it is a very particular scenario. This only happened for instances on Ubuntu 20.04 that were started on 2024-10-02 . That is exactly 6 months before the endOfLife 2025-04-02.

          Ubuntu 20.04 does not have a warning start date, therefore minus 6 months mark is the default startDate set:

          On 2024-10-02, we are exactly 6 month before the EOL. The warningStartDate is set to 2024-10-02:

          But today 2024-10-02 is not before LocalDate.now() and we never set the endOfLife:

                      // 2024-10-02 is before 2099-12-31
                      if (startDate.isBefore(warningsStartDate)) {
                          warningsStartDate = startDate;
                          LOGGER.log(Level.FINE, "Warnings start date is now {0}", warningsStartDate);
                      }
          
                      LOGGER.log(Level.FINE, "Matched operating system {0}", name);
                      // 2024-10-02 is today so we don't get past here....
                      if (startDate.isBefore(LocalDate.now())) {
                          this.operatingSystemName = name;
                          this.documentationUrl = buildDocumentationUrl(this.operatingSystemName);
                          this.endOfLifeDate = endOfLife.toString();
                          if (endOfLife.isBefore(LocalDate.now())) {
                              LOGGER.log(Level.FINE, "Operating system {0} is after end of life {1}",
                                      new Object[]{name, endOfLife});
                              afterEndOfLifeDate = true;
                          } else {
                              LOGGER.log(Level.FINE, "Operating system {0} started warnings {1} and reaches end of life {2}",
                                      new Object[]{name, startDate, endOfLife});
                          }
                      }
          

          That strict check if (startDate.isBefore(LocalDate.now())) should rather check "equals or before".

          ****

          To reproduce a problem, you may change the WEB_ROOT/WEB-INF/classes/jenkins/monitor/OperatingSystemEndOfLifeAdminMonitor/end-of-life-data.json and change the Ubuntu 20.04 endOfLife to that exactly 6 months from now. For example today, java.time.LocalDate.now().plusMonths(6) return 2025-04-24 so you can do this:

          [...]
            {
              "pattern": "Ubuntu.* 20.04.*",
              "endOfLife": "2025-04-24"
            },
          [...]
          

          And that put yourself in that scenario..

          Allan BURDAJEWICZ added a comment - markewaite I have been troubleshooting this lately.. it is a very particular scenario. This only happened for instances on Ubuntu 20.04 that were started on 2024-10-02 . That is exactly 6 months before the endOfLife 2025-04-02 . Ubuntu 20.04 does not have a warning start date, therefore minus 6 months mark is the default startDate set: https://github.com/jenkinsci/jenkins/blob/jenkins-2.482/core/src/main/java/jenkins/monitor/OperatingSystemEndOfLifeAdminMonitor.java#L128 On 2024-10-02 , we are exactly 6 month before the EOL. The warningStartDate is set to 2024-10-02 : https://github.com/jenkinsci/jenkins/blob/jenkins-2.482/core/src/main/java/jenkins/monitor/OperatingSystemEndOfLifeAdminMonitor.java#L143 But today 2024-10-02 is not before LocalDate.now() and we never set the endOfLife : // 2024-10-02 is before 2099-12-31 if (startDate.isBefore(warningsStartDate)) { warningsStartDate = startDate; LOGGER.log(Level.FINE, "Warnings start date is now {0}" , warningsStartDate); } LOGGER.log(Level.FINE, "Matched operating system {0}" , name); // 2024-10-02 is today so we don't get past here.... if (startDate.isBefore(LocalDate.now())) { this .operatingSystemName = name; this .documentationUrl = buildDocumentationUrl( this .operatingSystemName); this .endOfLifeDate = endOfLife.toString(); if (endOfLife.isBefore(LocalDate.now())) { LOGGER.log(Level.FINE, "Operating system {0} is after end of life {1}" , new Object []{name, endOfLife}); afterEndOfLifeDate = true ; } else { LOGGER.log(Level.FINE, "Operating system {0} started warnings {1} and reaches end of life {2}" , new Object []{name, startDate, endOfLife}); } } That strict check if (startDate.isBefore(LocalDate.now())) should rather check "equals or before". **** To reproduce a problem, you may change the WEB_ROOT/WEB-INF/classes/jenkins/monitor/OperatingSystemEndOfLifeAdminMonitor/end-of-life-data.json and change the Ubuntu 20.04 endOfLife to that exactly 6 months from now. For example today, java.time.LocalDate.now().plusMonths(6) return 2025-04-24 so you can do this: [...] { "pattern" : "Ubuntu.* 20.04.*" , "endOfLife" : "2025-04-24" }, [...] And that put yourself in that scenario..

          Mark Waite added a comment -

          Thanks very much allan_burdajewicz! That is a great investigation. I didn't detect the bug in my investigation because I didn't run my test on the day that it was reported. A reminder that prompt responses to bug reports are better for users and better for maintainers.

          Would you like to submit the pull request with the fix or would you prefer that I do it?

          Mark Waite added a comment - Thanks very much allan_burdajewicz ! That is a great investigation. I didn't detect the bug in my investigation because I didn't run my test on the day that it was reported. A reminder that prompt responses to bug reports are better for users and better for maintainers. Would you like to submit the pull request with the fix or would you prefer that I do it?

          Yes, I am preparing a PR.

          Allan BURDAJEWICZ added a comment - Yes, I am preparing a PR.

            allan_burdajewicz Allan BURDAJEWICZ
            bananeweizen Michael Keppler
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: