timja / jenkins-gh-issues-poc-06-18

0 stars 0 forks source link

[JENKINS-49395] archiveArtifact fingerprinting excluded files #9631

Open timja opened 6 years ago

timja commented 6 years ago

The archiveArtifacts step appears to be fingerprinting files which should be in the excludes set, which causes build failure if the files cannot be fingerprinted. (In this case – a broken symlink).

The archiveArtifacts step should not be processing files in the excludes set beyond the required name-pattern check.

We have a multi-architecture build, and archive the build results by first stashing them for each platform, and unstashing them into platform-specific subdirectories.

Our archive step is then (originally from the Pipeline Syntax generator):

archiveArtifacts ([
    artifacts: """
        ${env.PROJECT_HOME}/**/*.exe,
        ${env.PROJECT_HOME}/**/lib*.so*,
        ${env.PROJECT_HOME}/**/lib*.a,
    """,
    allowEmptyArchive: true,
    excludes:          """
        **/test/**,
        ${env.PROJECT_HOME}/lib/*,
    """,
    fingerprint:       true,
    onlyIfSuccessful:  true,
])

where the broken symlink is a library-name in '${env.PROJECT_HOME}/lib'.

The step results in the following exception which fails the build (although the stage is not marked as a failure?):

Archiving artifacts
Recording fingerprints
ERROR: Failed to record fingerprints
java.nio.file.NoSuchFileException: ${WORSPACE}/${PROJECT_HOME}/lib/libcrypto.so.1.1
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
    at java.nio.file.Files.newByteChannel(Files.java:361)
    at java.nio.file.Files.newByteChannel(Files.java:407)
    at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
    at java.nio.file.Files.newInputStream(Files.java:152)
    at hudson.Util.getDigestOf(Util.java:838)
    at hudson.FilePath$38.invoke(FilePath.java:1940)
    at hudson.FilePath$38.invoke(FilePath.java:1937)
    at hudson.FilePath.act(FilePath.java:997)
    at hudson.FilePath.act(FilePath.java:975)
    at hudson.FilePath.digest(FilePath.java:1937)
    at hudson.tasks.Fingerprinter$2.invoke(Fingerprinter.java:231)
Caused: java.io.IOException: Failed to compute digest for ${WORKSPACE}/${PROJECT_HOME}/lib/libcrypto.so.1.1
    at hudson.tasks.Fingerprinter$2.invoke(Fingerprinter.java:233)
    at hudson.tasks.Fingerprinter$2.invoke(Fingerprinter.java:215)
    at hudson.FilePath.act(FilePath.java:997)
    at hudson.FilePath.act(FilePath.java:975)
    at hudson.tasks.Fingerprinter.record(Fingerprinter.java:215)
    at hudson.tasks.Fingerprinter.perform(Fingerprinter.java:127)
    at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:247)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
    at hudson.security.ACL.impersonate(ACL.java:260)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Note that I have tried a number of excludes patterns to try to get rid of this error – although other projects with similar structure but without the broken symlink compete successfully.

Workaround: Another step before the archive to explicitly remove the symlinks.

 

 


Originally reported by simon_watts, imported from: archiveArtifact fingerprinting excluded files
  • status: Open
  • priority: Major
  • resolution: Unresolved
  • imported: 2022/01/10
timja commented 6 years ago

jglick:

JENKINS-51032 would enable this.

timja commented 6 years ago

simon_watts:

jglick The file (broken symlink) is already in the 'excludes' for the 'archiveArtifacts'. If JENKINS-51032 is a solution then we'd have to exclude the same file (pattern) twice?  

timja commented 6 years ago

jglick:

No.

timja commented 2 years ago

[Originally depends on: JENKINS-51032]