Artifact packaging ignoring empty folders

Steven's Avatar

Steven

26 Oct, 2017 01:12 PM

Hey guys,
I'm creating an artifact after doing a dotnet publish, but it doesn't include what is on disk.
It's missing a folder that is created, but empty.
Is there some kind of "optimisation" that does not include empty folders in an artifact?
If that is the case, is there a switch to override this behaviour?

Cheers,
Steven

  1. 1 Posted by Ilya Finkelshte... on 26 Oct, 2017 06:39 PM

    Ilya Finkelshteyn's Avatar

    Hi Steven,

    This is default zip behavior, we did not introduce this intentionally. Anyway you can zip your folder manually with special 7z switches and then package your own .zip file as an artifact. This YAML worked for me:

    install:
    - mkdir contains-empty-folders\folder1
    - mkdir contains-empty-folders\folder2
    
    build_script:
    - cmd: 7z a -r -tzip contains-empty-folders.zip contains-empty-folders
    
    artifacts:
    - path: contains-empty-folders.zip
    
  2. 2 Posted by Steven on 27 Oct, 2017 08:11 AM

    Steven's Avatar

    Thank you for the response Ilya.
    I wasn't sure, hence the question.
    I've been using 7zip on my desktop/laptop for a few years and had not noticed this, hence the confusion.
    I will use the cmd to create the zip.

  3. 3 Posted by Steven on 30 Oct, 2017 12:57 PM

    Steven's Avatar

    Hi Ilya, that did not work for me unfortunately... Any ideas?

  4. 4 Posted by Steven on 30 Oct, 2017 01:44 PM

    Steven's Avatar

    I managed to figure it out:

    I needed to add * to the path for the 7zip command

  5. 5 Posted by Ilya Finkelshte... on 30 Oct, 2017 05:34 PM

    Ilya Finkelshteyn's Avatar

    Thank you for update. However I am a little bit surprised that you were needed to update path. AppVeyor build worker images have path set to 7z (not 7zip) command by default. I would recommend to ensure that you do not have commands which overwrite path variable (instead of updating it).

  6. 6 Posted by Steven on 31 Oct, 2017 08:37 AM

    Steven's Avatar

    Hi Ilya, I meant the path to the folder to zip up,
    i.e. in the case of your example it would look like this:

    7z a -r -tzip contains-empty-folders.zip contains-empty-folders\*

  7. 7 Posted by Ilya Finkelshte... on 31 Oct, 2017 08:25 PM

    Ilya Finkelshteyn's Avatar

    I see, thanks for clarification.

  8. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:20 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac