pipe ssh-run: SERVER variable missing

nils-m May 3, 2022

When I run the Bitbucket pipeline I always have this error (in bold) 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 ?

1 answer

1 accepted

2 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 4, 2022

Hi @nils-m,

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

Indentation for branches:, develop: and - step: should be at least 1 space from the parent level.
Indentation for children of - step: (like script:) should be at least 3 spaces from the parent.

Commands in the script do not need to be intended from the parent level script:, but you can add indentation for readability.
For pipes
    the keyword variables: needs to be intended at least 2 spaces from - pipe
    the actual variables need to be intended at least 1 space from variables:

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 ?

Kind regards,
Theodora

nils-m May 4, 2022

Oh gosh, that was it !
This should be documented, imagine the time spent ...

Could we have a reasonable explanation why the yaml is interpreted this way ?

Thanks !!!

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 10, 2022

Hi @nils-m,

It's good to hear that the issue is resolved, and you are very welcome!

I was actually mistaken about the indentation, it needs to be at least 1 and 3 spaces respectively (instead of 2 and 4 exactly that I mentioned).

I will edit my previous response with the correct info. Indentation has to do with the type of data structures used in the yml file, I will create a request with my team to include info about indentation in the documentation.

Kind regards,
Theodora

Like nils-m likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events