Is there a way to provide a condition for an artifact?

brianlheim's Avatar

brianlheim

18 Jan, 2018 04:06 PM

Hello,

I have a project where the setup is:
1. deploy to S3 for every build
2. deploy to GitHub releases for every tag

The artifact being deployed to GitHub releases is not the same as the S3 artifact. It takes some extra time to make the release artifact, and since that process is trivial, I skip it on my non-tagged builds.

I've arranged it so that each artifact is given a name in my `artifacts` section. Something like:

artifacts:
- path: s3/artifacts/path
  name: art_s3
- path: gh/artifacts/path
  name: art_gh

However, when building a non-tagged release this causes a message saying "No artifacts found matching gh/artifacts/path path", which looks like a warning but is really normal behavior. Is there some way I could provide a condition for my artifact, or configure my project so that it only searches for this artifact when building a tag? Thanks!

  1. Support Staff 1 Posted by Ilya Finkelshte... on 18 Jan, 2018 06:15 PM

    Ilya Finkelshteyn's Avatar

    You probably have

      on:
        appveyor_repo_tag: true
    

    for GitHub deployment, right? So why not to set

      on:
        appveyor_repo_tag: false
    

    for S3 one?

  2. 2 Posted by brianlheim on 18 Jan, 2018 09:29 PM

    brianlheim's Avatar

    The problem is that the file I refer to as `gh/artifacts/path` in the artifacts section of `appveyor.yml` doesn't exist when I'm building an untagged build. I want to stop Appveyor from seeking it out unless `appveyor_repo_tag`, or some equivalent condition, is true. That answer doesn't seem to solve this problem at all.

    To be clearer, what I want is:

    Untagged build -> artifact for S3 is created and pushed.
    Tagged build -> artifact for S3 is created and pushed, separate artifact for GitHub is created and pushed.

    and no warning messages.

    Right now, I have everything working fine except the "no warning messages" part, because Appveyor thinks the artifact for the GitHub deployment should exist no matter what.

  3. Support Staff 3 Posted by Ilya Finkelshte... on 18 Jan, 2018 10:52 PM

    Ilya Finkelshteyn's Avatar

    I see. Deployment part mislead me. This message is being risen by artifact packaging part, not deployment. I do not have a good answer for you. Here is pretty dirty hack to cheat AppVeyor which I do not like myself, but it will work with packing fake empty artifact:

    install:
    - ps: |
        if ($env:APPVEYOR_REPO_TAG -eq "false") {
          $env:ARTIFACT_PATH = "$env:APPVEYOR_REPO_COMMIT"
          $env:ARTIFACT_NAME = $env:ARTIFACT_PATH
          New-Item -Path $env:ARTIFACT_PATH
        }
        else {
          $env:ARTIFACT_PATH = "gh/artifacts/path"
          $env:ARTIFACT_NAME = "art_gh"
        }
    
    artifacts: 
    - path: s3/artifacts/path 
      name: art_s3 
    - path: $(ARTIFACT_PATH)
      name: $(ARTIFACT_NAME)
    
  4. 4 Posted by brianlheim on 21 Jan, 2018 03:28 AM

    brianlheim's Avatar

    Thanks!

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