ingenieux / awseb-deployment-plugin

Jenkins Plugin for AWS Elastic Beanstalk
Apache License 2.0
29 stars 53 forks source link

FATAL: Deployment Failure java.nio.file.NoSuchFileException: /var/lib/jenkins/workspace/open/openEnv/.Python #92

Closed harmydiano closed 4 years ago

harmydiano commented 4 years ago

i keep getting this error each time i build, i can't really figure out what is causing the problem.

FATAL: Deployment Failure java.nio.file.NoSuchFileException: /var/lib/jenkins/workspace/open/openEnv/.Python 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.UnixFileAttributeViews$Posix.readAttributes(UnixFileAttributeViews.java:218) at sun.nio.fs.UnixFileAttributeViews$Posix.readAttributes(UnixFileAttributeViews.java:131) at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144) at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99) at java.nio.file.Files.readAttributes(Files.java:1737) at java.nio.file.Files.getPosixFilePermissions(Files.java:2004) at hudson.util.IOUtils.mode(IOUtils.java:130) Caused: hudson.os.PosixException: Unable to get file permissions null at hudson.util.IOUtils.mode(IOUtils.java:133) at hudson.util.io.ZipArchiver.visit(ZipArchiver.java:56) at hudson.util.DirScanner.scanSingle(DirScanner.java:49) at hudson.util.DirScanner$Glob.scan(DirScanner.java:135) at hudson.FilePath$Archive.invoke(FilePath.java:501) at hudson.FilePath$Archive.invoke(FilePath.java:488) at hudson.FilePath.act(FilePath.java:1078) at hudson.FilePath.act(FilePath.java:1061) at hudson.FilePath.archive(FilePath.java:486) at hudson.FilePath.zip(FilePath.java:473) at br.com.ingenieux.jenkins.plugins.awsebdeployment.cmd.BuildAndUploadArchive.getLocalFileObject(BuildAndUploadArchive.java:88) at br.com.ingenieux.jenkins.plugins.awsebdeployment.cmd.BuildAndUploadArchive.perform(BuildAndUploadArchive.java:41) at br.com.ingenieux.jenkins.plugins.awsebdeployment.cmd.DeployerChain.perform(DeployerChain.java:54) at br.com.ingenieux.jenkins.plugins.awsebdeployment.SlaveDeployerCallable.call(SlaveDeployerCallable.java:42) at br.com.ingenieux.jenkins.plugins.awsebdeployment.SlaveDeployerCallable.call(SlaveDeployerCallable.java:27) at hudson.remoting.LocalChannel$1.call(LocalChannel.java:52) at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused: java.util.concurrent.ExecutionException at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at hudson.remoting.LocalChannel$2.get(LocalChannel.java:77) at br.com.ingenieux.jenkins.plugins.awsebdeployment.DeployerRunner.perform(DeployerRunner.java:71) at br.com.ingenieux.jenkins.plugins.awsebdeployment.AWSEBDeploymentBuilder.perform(AWSEBDeploymentBuilder.java:193)

aldrinleal commented 4 years ago

Perhaps this?

Caused: hudson.os.PosixException: Unable to get file permissions 
harmydiano commented 4 years ago

@aldrinleal you mean if i could change the header title to that?

aldrinleal commented 4 years ago

No. Its failing bc it can't read this file (are you doing some sudo or something like that)? In that case, zip the file on your own and replace the Root Object for this final file.

harmydiano commented 4 years ago

i am not zipping the file myself. that is what the plugin is doing. No sudo or anything, the error is coming from the plugin

aldrinleal commented 4 years ago

Sorry, its a best effort attempt for the plugin, and sometimes it doesn't work. Workaround is to zip yourself.

harmydiano commented 4 years ago

I could see the zipped file in the tmp folder, the only problem is this line

java.nio.file.NoSuchFileException: /var/lib/jenkins/workspace/open/openEnv/.Python

harmydiano commented 4 years ago

while reading the plugin code here


    public static int mode(File f) throws PosixException {
        if(Functions.isWindows())   return -1;
        try {
            if (Util.NATIVE_CHMOD_MODE) {
                return PosixAPI.jnr().stat(f.getPath()).mode();
            } else {
                return Util.permissionsToMode(Files.getPosixFilePermissions(fileToPath(f)));
            }
        } catch (IOException cause) {
            PosixException e = new PosixException("Unable to get file permissions", null);
            e.initCause(cause);
            throw e;
        }
    }

    /**```

The exception is as a result of this 'Unable to get file permissions'
.Python is a symbolic file , i do not understand why the plugin is creating that file.
aldrinleal commented 4 years ago

You can add this file into the exceptions if you see fit. Unfortunately, I can't delve at this level.

harmydiano commented 4 years ago

Thanks for your concern, i hope the author could come to my aid

aldrinleal commented 4 years ago

I'm the author, so... no. I gave you workarounds. two, in fact. Hope you can solve it.

btw, you nagged another author by filing on his project on Jenkins Jira. Not that I care (he forked and published his fork as the publisher plugin)

harmydiano commented 4 years ago

oh, sorry about that. I had tested this on two different servers, i thought it was a server issue at first, the first was tested on ec2 instance and that was when i pasted it on jenkins jira before finding this repo.

could you please explain this line


        if(Functions.isWindows())   return -1;
        try {
            if (Util.NATIVE_CHMOD_MODE) {
                return PosixAPI.jnr().stat(f.getPath()).mode();
            } else {
                return Util.permissionsToMode(Files.getPosixFilePermissions(fileToPath(f)));
            }
        } catch (IOException cause) {
            PosixException e = new PosixException("Unable to get file permissions", null);
            e.initCause(cause);
            throw e;
        }
    }```

from it i could know what to do.

And zipping the file as you said, would i have to do that each time i attempt a new build?

Lastly, why does it keep creating this /var/lib/jenkins/workspace/openk/open/.Python

The '.Python'

Thanks
aldrinleal commented 4 years ago
  1. I haven't written this code, just consumed it. My guess is bc a symlink. Sounds like someone borrowed this snippet into your build definition: https://stackoverflow.com/questions/2325923/how-to-fix-importerror-no-module-named-error-in-python
  2. Sounds like your build process did that