"Pattern contains invalid characters"

Jonas's Avatar

Jonas

16 Jul, 2015 06:39 PM

As seen here: https://ci.appveyor.com/project/jpommerening/node-netif/build/1.0.5...

I've been banging my head against this part for a while now, have seen some related posts but don't seem to get any closer to the solution.

I'm trying to deploy a node.js binding to GitHub. Here's part of my appveyor.yml:

artifacts:
  - path: ls build/stage/$(APPVEYOR_REPO_NAME)/releases/download/$(APPVEYOR_REPO_TAG_NAME)/*.tar.gz
    name:binding
deploy:
  - provider: GitHub
    artifact: binding
    ...

I'd expect that to match (in my case) files like build/stage/jpommerening/node-netif/releases/download/v0.2.0-rc6/node-v11-win-ia32.tar.gz.

I've tried replacing the variables with patterns, omitting the name, backward slashes … I must have missed something.

Halp?

  1. Support Staff 1 Posted by Feodor Fitsner on 16 Jul, 2015 06:48 PM

    Feodor Fitsner's Avatar

    Try this:

    artifacts:
      - path: build/stage/$(APPVEYOR_REPO_NAME)/releases/download/$(APPVEYOR_REPO_TAG_NAME)/*.tar.gz
        name:binding
    

    Also, make sure the path is correct by running something like:

    after_build:
      - dir build\stage\%APPVEYOR_REPO_NAME%\releases\download\%APPVEYOR_REPO_TAG_NAME%
    
  2. 2 Posted by Jonas on 16 Jul, 2015 07:20 PM

    Jonas's Avatar

    Argh, I'm sorry … made a mistake pasting/editing the relevant parts for the post. The ls slipped in there because I had a line pretty much like you suggested but I had it in the before_deploy section.

    Thanks for the quick reply, though!

    Mayba part of the problem is that I was doing the packaging in before_deploy … but the artifacts get picked up before that, right? So at that point the directory probably does not exist yet.
    It looked like this:

    before_deploy:
      - npm run-script package
      - IF NOT "%APPVEYOR_REPO_TAG_NAME%" == "" ( dir build/stage/%APPVEYOR_REPO_NAME%/releases/download/%APPVEYOR_REPO_TAG_NAME% )
    artifacts:
      - ...
    

    I updated my config, here's a copy:

    install:
      - other stuff here
      - npm run-script package
      - IF NOT "%APPVEYOR_REPO_TAG_NAME%" == "" ( ls build/stage/%APPVEYOR_REPO_NAME%/releases/download/%APPVEYOR_REPO_TAG_NAME% )
    build: off
    artifacts:
      - path: build/stage/$(APPVEYOR_REPO_NAME)/releases/download/$(APPVEYOR_REPO_TAG_NAME)/*.tar.gz
        name: binding
    deploy:
      - provider: GitHub
        draft: false
        artifact: binding
        prerelease: false
        auth_token:
          secure: Y4nMpyIHHm1pH9cekqL5vj6xGSs98R3rgnQVd4awCWrxaO6qq53Ec007qm96lWE6
        on:
          appveyor_repo_tag: true
    

    I'm using ls because dir complains about my forward slashes. I'd use backslashes but %APPVEYOR_REPO_NAME% contains a forward slash. The step that generates the .tar.gz file is npm run-script package.

    Sadly, this did not work either. Still the same "Pattern contains invalid characters" message. Here's the build: https://ci.appveyor.com/project/jpommerening/node-netif/build/1.0.6...
    As you can see, the file seems to be right there inside the directory, but somethings seems to be the matter with my file pattern.

  3. Support Staff 3 Posted by Feodor Fitsner on 16 Jul, 2015 07:27 PM

    Feodor Fitsner's Avatar

    Oh, looks like / is considered as bad character :)

    Try this:

    artifacts:
      - path: build\stage\$(APPVEYOR_REPO_NAME)\releases\download\$(APPVEYOR_REPO_TAG_NAME)\*.tar.gz
    
  4. 4 Posted by Jonas on 16 Jul, 2015 08:37 PM

    Jonas's Avatar

    Yay, that works if I replace $(APPVEYOR_REPO_NAME) with the actual repository name (the variable contains a forward slash). Awesome, thank you! :D

    Now, just one more thing … is there a way to substitute the slash inside a variable with a backslash? I would like to avoid repeating the repo name inside the config…

  5. Support Staff 5 Posted by Feodor Fitsner on 16 Jul, 2015 11:03 PM

    Feodor Fitsner's Avatar

    Sure, just add this to install section:

    - ps: $env:APPVEYOR_REPO_PATH = $env:APPVEYOR_REPO_NAME.replace('/', '\')
    

    then use APPVEYOR_REPO_PATH instead of APPVEYOR_REPO_NAME.

  6. 6 Posted by Jonas on 16 Jul, 2015 11:56 PM

    Jonas's Avatar

    That does the job!

    Thank you so much, couldn't have done it without your help! :)

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