I create bitbucket pipelines for ssh to my server and run sh script that use `gcloud` command but I got message:
`/home/...../deploy-script.sh: line 7: gcloud: command not found`
In my server I install google-cloud sdk already, when I ssh to my server (not from bitbucket pipelines) I can use `gcloud` command.
This is some of bitbucket pipelines
image: atlassian/default-image:2
definitions:
services:
docker:
memory: 3072
pipelines:
branches:
master:
- step:
name: Deploy to GCP VM
script:
- echo "Start deploy to GCP VM"
- pipe: atlassian/ssh-run:0.4.2
variables:
SSH_USER: $SSH_USER
SERVER: $SSH_HOST
COMMAND: '/home/...../deploy-script.sh'
This is some of deploy-script.sh
#!/bin/bash
work_directory="$(dirname "$(realpath "$0")")"
cd $work_directory
echo "Logging in to GCP GCR....."
docker login -u oauth2accesstoken -p "$(gcloud auth print-access-token)" https://asia.gcr.io
How i can fix this?
Sorry for my bad english.
The PATH variable can be different based on the user and login type (interactive or not).
Try first printing the PATH variable and see if `gcloud` command is in the path.
To resolve this issue, you can either look into the various ~/*profile and ~/*rc files, to check which one is actually read during your login, or just update the PATH during runtime.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.