bashrc is not taking effect in the remote server using ssh

Bhushan Patil
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 5, 2023

Hello,

I have a pipeline which contains a "atlassian/ssh-run:0.6.1" pipe added. I am executing some custom command which has been added in the bashrc. Those commands are not working for example. I have added "alias cecho='echo -e'" in bashrc, when I run this command through pipeline's pipe command section. I also tried alias "alias cecho='echo -e'" directly in the command key, but I still get command not found. I get command not found. Although I am able to run it on the server directly when I try to access the remove server from my local. I have checked my connection to the remote server is established, and other basic commands like ls and cd works and I am in correct directories and also I am able to navigate. But bashrc is not executing when the remote server connection is established.

Is there anything wrong I am doing?

this is the small piece of block in the pipeline

- stage:
name: Build and Deploy
steps:
- step:
name: Build the Application
deployment: development staging
script:
- echo "This is building phase"
- pipe: atlassian/ssh-run:0.6.1
variables:
SSH_USER: $BUILD_USER
SERVER: $BUILD_SERVER
COMMAND: 'alias cecho="echo -e" && cecho "=====This should work"'

 

1 answer

0 votes
Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 6, 2023

@Bhushan Patil hi. Try this example (move your complex command into myscript.sh):

script:
  - pipe: atlassian/ssh-run:0.6.1
    variables:
      SSH_USER: 'ec2-user'
      SERVER: '127.0.0.1'
      SSH_KEY: $MY_SSH_KEY
      MODE: 'script'
      COMMAND: 'myscript.sh' # path to a script in your repository

Regards, Igor

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events