Search code examples
bitbucketbitbucket-pipelines

Bitbucket pipelines ssh-run: SERVER variable missing


When I run the Bitbucket pipeline I always have this strange error I can't resolve: In the build log

   --env=COMMAND="./ansible/deploy-dev.sh" \
   --env=MODE="script" \
   --env=SERVER="$SSH_JUMP_HOST" \
   --env=SSH_KEY="$SSH_JUMP" \
   --env=SSH_USER="$SSH_JUMP_USER" \
...
...
Status: Downloaded newer image for bitbucketpipelines/ssh-run:0.4.0
INFO: Executing the pipe...
/pipe.sh: line 26: SERVER: SERVER variable missing.

SERVER variable is set and provided by a repository variable.

bitbucket-pipelines.yml

...
    branches:  
      develop:
        - step:
            script:
                - pipe: atlassian/ssh-run:0.4.0
                  variables:
                    SSH_USER: $SSH_JUMP_USER
                    SERVER: $SSH_JUMP_HOST
                    SSH_KEY: $SSH_JUMP
                    MODE: "script"
                    COMMAND: "./ansible/deploy-dev.sh"

Someone has a clue, I going nuts !?


Solution

  • The Atlassian team answered me:

    I've seen this error occur because of incorrect indentation in the bitbucket-pipelines.yml file.

    Indentation should be two spaces, except for the level after - step: which should be four spaces, as follows. Note also indentation in variables section:

    pipelines:
      branches:
        develop:
          - step:
              script:
                - pipe: atlassian/ssh-run:0.4.0
                  variables:
                    SSH_USER: $SSH_JUMP_USER
                    SERVER: $SSH_JUMP_HOST
                    SSH_KEY: $SSH_JUMP
                    MODE: "script"
                    COMMAND: "./ansible/deploy-dev.sh"
    

    Can you check the content of your bitbucket-pipelines.yml file in our validator here https://bitbucket-pipelines.atlassian.io/validator ?