bitbucket-pipelines.yml
image: node:8.9.4
pipelines:
default:
- step:
caches:
- node
script:
# SETUP AND TESTS
- ./test.sh
# BUILD APPLICATION
- ember build --environment=production
# DEPLOY APPLICATION
- cd dist && gcloud app deploy app.yaml -q --version production
test.sh
# INSTALL GOOGLE CLOUD SDK
curl -s -o /tmp/google-cloud-sdk.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-191.0.0-linux-x86_64.tar.gz
tar -xzf /tmp/google-cloud-sdk.tar.gz -C /tmp/
/tmp/google-cloud-sdk/install.sh -q
source /tmp/google-cloud-sdk/path.bash.inc
# SETUP GOOGLE CLOUD SDK
echo $GCLOUD_SERVICE_KEY | base64 --decode > /tmp/gcloud-service-key.json
gcloud auth activate-service-account --key-file /tmp/gcloud-service-key.json
gcloud config set project cmg-frontend
# INSTALL REQUIREMENTS FOR BUILDING
npm install -g ember-cli
# INSTALL REQUIREMENTS FOR TESTING
npm install phantomjs-prebuilt
# INSTALL REQUIREMENTS FOR APP
npm install
# RUN TESTS
ember test
I get this error:
+ cd dist && gcloud app deploy app.yaml -q --version production
bash: gcloud: command not found
But gcloud command works fine inside test.sh (successful auth and project config).
What am I missing?
Thanks!
This is probably because you've installed the gcloud command into your base directory on your build. When you change directories, bash doesn't know where to find gcloud.
You can fix this by running this command in your build.
export PATH="$BITBUCKET_CLONE_DIR:$PATH"
You can learn more about PATH here: http://www.linfo.org/path_env_var.html
The BITBUCKET_CLONE_DIR comes from here: https://confluence.atlassian.com/bitbucket/environment-variables-794502608.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.