0

I am trying to integrate storybook/chromatic into my azure pipeline, however i am getting the following error:

/home/vsts/work/_temp/60ae6370-8818-4ab7-a2d8-f4a0443fadf9.sh: line 1: --project-token=${project_token}: bad substitution

I followed this https://www.chromatic.com/docs/azure-pipelines

I did obviously put my project token where it was needed.

Sole
  • 3,100
  • 14
  • 58
  • 112
  • I have tested the sampe in the link. But it can work fine in my side. You can refer to the steps in the answer. If this isse still exists, can you share your YAML sample with us? – Kevin Lu-MSFT Sep 15 '21 at 08:59

1 Answers1

0

Based on the error message, it seems that this issue comes from a script format or symbol.

I have tested the YAML sample from the link you shared and it can work fine.

Here are my steps, you can refer to them.

Step1 : Set the variable CHROMATIC_PROJECT_TOKEN

enter image description here

Step2: Run the YAML sample:

stages:
- stage: Test
  displayName: Chromatic Testing
  # Job list
  jobs:
  - job: Chromatic_Deploy
    displayName: Install packages and publishes to Chromatic

    steps:

    - task: NodeTool@0
      inputs:
        versionSpec: '12.x'
      displayName: 'Install Node.js'  
    - task: Npm@1
      inputs:
        command: 'install'
        workingDir: '$(build.sourcesdirectory)'

    - task: CmdLine@2
      displayName: Publish to Chromatic
      inputs:
        script: npx chromatic --project-token=${CHROMATIC_PROJECT_TOKEN}

Here is my result:

enter image description here

You can also try to use --project-token=$(CHROMATIC_PROJECT_TOKEN) in the YAML sample.

Kevin Lu-MSFT
  • 20,786
  • 3
  • 19
  • 28