Deploy replicates directory structure from artifact

Carlos's Avatar

Carlos

06 Jun, 2015 02:04 PM

Hi,

My build creates a zip file inside folder called 'upload' in my project, so it follows this structure:

C:\projects\<my_project>\upload\file.zip

I want to upload this file into an folder in the s3 bucket, so I have configured it this way:

artifacts:
  - path: upload\*.zip
    name: projet-zip
    type: zip

deploy:
  provider: S3
  access_key_id: 
  secret_access_key:
  bucket: 
  set_public: true
  folder: windows
  artifact: project-zip

However, I end up with the file in: /windows/upload/file.zip, instead of /windows/file.zip.

I have also tried using the 'application' settings deployment (http://www.appveyor.com/docs/deployment/ftp), but whichever way I configure the artifact I end up with: /windows/project-zip.zip (So, I guess that is only really meant to be run for FTP deployment).

Is there any way I can upload the file C:\projects\<my_project>\upload\file.zip into an s3 bucket as /windows/file.zip ?

  1. Support Staff 1 Posted by Feodor Fitsner on 06 Jun, 2015 04:51 PM

    Feodor Fitsner's Avatar

    You can use appveyor PushArtifact command to upload artifact with custom file name:

    after_build:
      - appveyor PushArtifact upload\file.zip -FileName file.zip -DeploymentName projet-zip
    
  2. 2 Posted by Carlos on 06 Jun, 2015 08:14 PM

    Carlos's Avatar

    Thank you for the quick response Feodor.

    I should have mentioned that file.zip has an automatically generated filename which I cannot easily replicate within the appveyor.tml file. I can use a wildcard to select the artifact to upload, but I am not sure how to "copy" for the filename for the -FileName flag.

    If you don't mind, for simplicity I will start using the names given in my project, instead of generic "project" and "file.zip", except for the autogerated tag which I will identified with "<filetag>".

    If I leave the artifact setting in the deployment info it will still upload the correct zip file into /windows/upload/ardublockly_<filetag>.zip (instead of ), but the PushArtifact command will not upload anything:

    after_build:
      - appveyor PushArtifact upload\*.zip -FileName file.zip -DeploymentName ardublockly-s3-deployment
    
    artifacts:
      - path: upload \*.zip
        name: ardublockly-zip
        type: zip
    
    deploy:
      name: ardublockly-s3-deployment
      provider: S3
      access_key_id: 
      secret_access_key:
      bucket: ardublockly-builds
      set_public: true
      folder: windows
      artifact: ardublockly-zip
    

    It will still prints this (and the artifact shows in appveyor website), but nothing is uploaded into the s3 bucket with the name "file.zip":

    Packaging artifacts...OK
    Uploading artifact upload\ardublockly_2015-06-06_19.23.00_appveyor-update_f1ea77ec91.zip (49.7 MB)...OK
    

    If I remove the artifact listing, nothing gets uploaded:

    after_build:
      - appveyor PushArtifact upload\*.zip -FileName file.zip -DeploymentName ardublockly-s3-deployment
    
    deploy:
      name: ardublockly-s3-deployment
      provider: S3
      access_key_id:
      secret_access_key:
      bucket: ardublockly-builds
      set_public: true
      folder: windows
    

    Obviously I must be making a mistake somewhere, but I have tried many combinations and cannot seem to get it work. Any extra help will be greatly appreciated.

  3. Support Staff 3 Posted by Feodor Fitsner on 06 Jun, 2015 10:37 PM

    Feodor Fitsner's Avatar

    Remove artifacts section and leave appveyor PushArtifact command only, but do not use wildcard there - use exact path to the artifact:

    appveyor PushArtifact upload\my_artifact_filename.zip -FileName file.zip -DeploymentName ardublockly-s3-deployment
    
  4. 4 Posted by Carlos on 06 Jun, 2015 11:49 PM

    Carlos's Avatar

    Hi Feodor,

    Unfortunately a script generates the zip file name which includes the time of build, so I cannot really hardcode the file name into the yml file.

    I am very new to using the shell and ps scripts, is there a way to get the filename from the upload folder (we can count on only having one file there) and embed it into the appveyor PushArtifac command? I googled how to do this on a command line, but none of the stack overflow answers (all similar to this) worked on my command line interface (nor powershell), I don't know if I need to activate something or what am I doing wrong.

  5. Support Staff 5 Posted by Feodor Fitsner on 07 Jun, 2015 12:19 AM

    Feodor Fitsner's Avatar

    You can use PowerShell instead:

    after_build:
      - ps: Get-ChildItem .\upload\*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name -DeploymentName ardublockly-s3-deployment }
    
  6. 6 Posted by Carlos on 07 Jun, 2015 12:36 AM

    Carlos's Avatar

    That worked, thank you Feodor, you're the best!

  7. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:56 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