How to deploy a folder only if it exists

We’re using snapshot testing in our app and it’s setup to only produce output when a snapshot doesn’t match which makes a test fail. I’ve been trying to deploy the folder that contains the images but it fails in the case where the test pass cause the folder doesn’t exist.

deploy failed, error: failed to create file artifact, error: failed to get file size, error: file not exist at: /tmp/SNAPSHOT_ARTIFACTS

So I tried making the folder in the case it didn’t exists and then got another error cause it failed when trying to zip it.

failed to zip output dir, error: command: (/usr/bin/zip "-rTy" "/var/folders/wp/4pf4qdmn217djs68lskdcc780000gn/T/__deploy-to-bitrise-io__271803799/SNAPSHOT_ARTIFACTS.zip" ".") failed, output: zip error: Nothing to do! (try: zip -rTy /var/folders/wp/4pf4qdmn217djs68lskdcc780000gn/T/__deploy-to-bitrise-io__271803799/SNAPSHOT_ARTIFACTS.zip . -i .), error: exit status 12

My solution ended up being to make the folder if it didn’t exist, them move it into another folder and use that folder as the deploy dir so it wasn’t trying to zip an empty folder. Seems like there should be an easier way.

Hello,

Could you post the build URL and enable support access?

I wonder if the problem is that /tmp/SNAPSHOT_ARTIFACTS is being seen as a file instead of a directory. What happens if you include / on the end “/tmp/SNAPSHOT_ARTIFACTS/”

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.