Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unix file permissions in zip files #24

Open
Telling opened this issue Jun 28, 2017 · 3 comments
Open

Unix file permissions in zip files #24

Telling opened this issue Jun 28, 2017 · 3 comments

Comments

@Telling
Copy link

Telling commented Jun 28, 2017

In the process of moving a codepipeline from US to EU, I noticed an issue with the zip artifact created by the codepipeline plugin; it has no unix file permissions. Having used the codedeploy plugin in the past, I knew the artifacts it created did have unix file permissions.

I hacked together a version of the codepipeline plugin that uses the same method of creating the zip file as the codedeploy plugin, basically I've rewritten compressZipFile to no longer use compressArchive:

public static void compressZipFile(
            final File temporaryZipFile,
            final Path pathToCompress,
            final BuildListener listener)
            throws IOException {
        try (
            final FileOutputStream zipArchiveOutputStream = new FileOutputStream(temporaryZipFile);
        ) {

            final FilePath sourceDirectory = new FilePath(pathToCompress.toFile());
            try {
                sourceDirectory.zip(
                    zipArchiveOutputStream,
                    new DirScanner.Glob("", "")
                );
            } catch(InterruptedException e) {
                LoggingHelper.log(listener, "Error creating zip file: '%s'", e.toString());
                throw new IOException(e.toString());
            } finally {
                zipArchiveOutputStream.close();
            }

        }
    }

Been years since I last wrote any java, so this is probably not the best solution - but it will allow me to get on with the task at hand.

@belltimo
Copy link
Contributor

Hi Telling,

Thanks for bringing this to our attention, and nice work finding a workaround ;)

I suspect the file permissions are being lost when we call IOUtils.copy

You mentioned that it was previously working, however looking at the commit history I don't see any obvious changes to this code.

Is it possible you were previously using the CodeDeploy plugin rather than the CodePipeline one? https://github.com/awslabs/aws-codedeploy-plugin

Unfortunately I don't have an ETA on when we can address this issue, but your details definitely help.

@Telling
Copy link
Author

Telling commented Jul 27, 2017

Hi belltimo,

Thanks for getting back to me, was beginning to get nervous :)

Yes, I was using the codedeploy plugin back when it used to work. The code to create the zip I've pasted is similar to that of the codedeploy plugin.

As I'm currently running my own version with the java code above, I can wait. But please do address this, its a fairly terrible bug and I'm not the only one who's been hit by it: #21 (I do believe the plugin now has tar support though not sure if permissions are kept in those)

@bilzard
Copy link

bilzard commented May 26, 2020

+1 I have the same problem with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants