Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,461,074
Community Members
 
Community Events
176
Community Groups

pipe ssh-run: SERVER variable missing

Edited

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

1 vote
Answer accepted

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

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 !!!

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

Atlassian Community Events