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

Build link is not updated properly for lastSuccessfulBuild

      Hello,

       When using the Build Symlink Plugin of version 1.1 in our Jenkins (Version 2.361.4 with Java 11.0.16.1) the build links for the successful builds are not being updated properly. As for our downstream jobs we will be fetching the lastSuccessful artifacts from upstream build this is causing a severe issue. Able to notice that 'permalinks' are updated properly, but softlinks are not proper and is causing problems for us.

        I have tried the below methods to fix the issue, but none worked:

      • reinstalled the plugin itself and restarting Jenkins.
      • Enabling and disabling of the plugin in Plugin Manager.
      • Deleting the last* soft links manually in server and rebuilding is updating the links properly but this solution is not feasible as we have large number of jobs.
      • As in Jenkins official page not able to see other supported plugins to upgrade or downgrade, we are stuck with this version 1.1

      Attached images of permalinks and softlinks for reference where the latest successful build is 187. Please support on how we can procced to fix this issue. Any suggestions and alternatives will also be appreciated.

      Thank you

          [JENKINS-71229] Build link is not updated properly for lastSuccessfulBuild

          Jesse Glick added a comment -

          No idea offhand; I have not touched this plugin in years. You can create a custom logger at FINE level on io.jenkins.plugins.build_symlink and see if it shows any warnings, or other output which is different now than when the links are being properly maintained.

          Jesse Glick added a comment - No idea offhand; I have not touched this plugin in years. You can create a custom logger at FINE level on io.jenkins.plugins.build_symlink and see if it shows any warnings, or other output which is different now than when the links are being properly maintained.

          Parinith added a comment - - edited

          Hello Jesse,

          Thank you for your response, Could you please further support on below query. I am not able to find the option 'io.jenkins.plugins.build_symlink' here. Should i go with 'io.jenkins.plugins.build_symlink.RunListenerImpl' and proceed with FINE level? 

          Parinith added a comment - - edited Hello Jesse, Thank you for your response, Could you please further support on below query. I am not able to find the option 'io.jenkins.plugins.build_symlink' here. Should i go with 'io.jenkins.plugins.build_symlink.RunListenerImpl' and proceed with FINE level? 

          Jesse Glick added a comment -

          Either is fine. (The auto completion candidates are just suggestions; parent loggers are not currently offered.)

          Jesse Glick added a comment - Either is fine. (The auto completion candidates are just suggestions; parent loggers are not currently offered.)

          Parinith added a comment -

          We got the below logs for this build, last successful was 16175, but here its showing 16174

          Parinith added a comment - We got the below logs for this build, last successful was 16175, but here its showing 16174

          Jesse Glick added a comment -

          Not sure. From the log it looks like it is the text file permalinks which is not getting updated: PeepholePermalink.resolve is returning 16174.

          Jesse Glick added a comment - Not sure. From the log it looks like it is the text file permalinks which is not getting updated: PeepholePermalink.resolve is returning 16174.

          Parinith added a comment - - edited

          In this scenario the permalinks are updated properly with 977 build number, but in logs shows no change with still pointing to 976 build.

           

          Parinith added a comment - - edited In this scenario the permalinks are updated properly with 977 build number, but in logs shows no change with still pointing to 976 build.  

          Perhaps someone will find the following script useful to find discrepancies of the build numbers between permalinks and the symbolic links.
          The script finds all files with the name permalinks recursively in a given directory and compares the build number of the specified link with the associated build number in permalinks. If the numbers do not match, the path to this job is printed.
          Usage example: check_permalinks.sh jenkins/home/builds lastCompletedBuild

          #!/bin/bash
          
          builds=$1
          linkName=$2
          [[ -z $builds || -z $linkName ]] && { echo "usage: $(basename $0) <build folder> <link name>"; exit 1; }
          
          find "$builds" -type d -exec sh -c 'f="$1"/permalinks;  [ -e "$f" ] && { printf "%s\n" "$f"; true; }' find-sh {} \; -prune |
             xargs -P20 -I FILE bash -c '
                p=$(awk "/'$linkName'/ {print \$NF}" "FILE")
                l="-1"
                [[ -e "$(dirname "FILE")/'$linkName'" ]] && l=$(ls -l "$(dirname "FILE")/'$linkName'" | awk "END {print \$NF}")
                if [[ $p -ne $l ]] ; then 
                    echo "$(dirname "FILE"): '$linkName': permalinks: $p symlink: $l"
                fi
             '
           

          Hans-Juergen Hafner added a comment - Perhaps someone will find the following script useful to find discrepancies of the build numbers between permalinks and the symbolic links. The script finds all files with the name permalinks recursively in a given directory and compares the build number of the specified link with the associated build number in permalinks. If the numbers do not match, the path to this job is printed. Usage example: check_permalinks.sh jenkins/home/builds lastCompletedBuild #!/bin/bash builds= $1 linkName= $2 [[ -z $builds || -z $linkName ]] && { echo "usage: $(basename $0 ) <build folder> <link name>" ; exit 1; } find " $builds " -type d -exec sh -c 'f= " $1 " /permalinks; [ -e " $f " ] && { printf "%s\n" " $f " ; true; }' find-sh {} \; -prune | xargs -P20 -I FILE bash -c ' p=$(awk "/ ' $linkName ' / {print \ $NF }" "FILE" ) l= "-1" [[ -e "$(dirname " FILE ")/ ' $linkName ' " ]] && l=$(ls -l "$(dirname " FILE ")/ ' $linkName ' " | awk "END {print \ $NF }" ) if [[ $p -ne $l ]] ; then echo "$(dirname " FILE "): ' $linkName ' : permalinks: $p symlink: $l " fi '

          Jesse Glick added a comment -

          parinith_135 not sure what is going on. Check whether the log messages are coming after the completion of the last successful build. A pull request would be welcome if you figure it out.

          Jesse Glick added a comment - parinith_135 not sure what is going on. Check whether the log messages are coming after the completion of the last successful build. A pull request would be welcome if you figure it out.

          viks added a comment -

          Any further updates on this issue? I do see a similar issue and looking for a resolution.

           

          viks added a comment - Any further updates on this issue? I do see a similar issue and looking for a resolution.  

          Jesse Glick added a comment -

          If someone is able to reproduce the problem from scratch, a pull request would be appreciated (and maybe you can adopt the plugin).

          Jesse Glick added a comment - If someone is able to reproduce the problem from scratch, a pull request would be appreciated (and maybe you can adopt the plugin).

          Parinith added a comment -

          Hello Jesse Glick, we are still seeing the same issues. Do you have any alternative way to fetch these lastSuccessful, lastFailed, lastStable etc data for the builds in a job? Please let us know for any workaround also

          Parinith added a comment - Hello Jesse Glick, we are still seeing the same issues. Do you have any alternative way to fetch these lastSuccessful, lastFailed, lastStable etc data for the builds in a job? Please let us know for any workaround also

            Unassigned Unassigned
            parinith_135 Parinith
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: