Not able to deploy from CircleCI to Google Compute Engine?

circle.yml

#1

HI To all
I am new to circle CI , I wanted to deploy code from circle CI to Google Compute Engine , for that I went through documentation and stack overflow and written in my .yml file , my technology is node js . below is my .yml file.

its showing error message in deploy Job like

“#!/bin/bash -eo pipefail
sudo /opt/google-cloud-sdk/bin/gcloud compute copy-files ./dist 725459838767-compute@circle-ci:/circle_demo --zone $GCLOUD_INSTANCE_ZONE
sudo: /opt/google-cloud-sdk/bin/gcloud: command not found
Exited with code 1”

my .yml file is

version: 2
jobs:
build:
working_directory: ~/circle_ci_demo_project
docker:
- image: circleci/node:4.8.2
- image: mongo:3.4.4
steps:
- checkout
- run:
name: update-npm
command: ‘sudo npm install -g npm@latest’
- restore_cache:
key: dependency-cache-{{ checksum “package.json” }}
- run:
name: install-npm-wee
command: npm install
- save_cache:
key: dependency-cache-{{ checksum “package.json” }}
paths:
- ./node_modules
- run:
name: test
command: npm test
- run:
name: code-coverage
command: ‘./node_modules/.bin/nyc report --reporter=text-lcov’
- store_artifacts:
path: test-results.xml
prefix: tests
- store_artifacts:
path: coverage
prefix: coverage
- store_test_results:
path: test-results.xml
- deploy:
name: Deploy Master to Gcloud
command: echo GCLOUD_SERVICE_KEY | base64 --decode --ignore-garbage > {HOME}/gcloud-service-key.json
command: sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update
command: sudo /opt/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
command: sudo /opt/google-cloud-sdk/bin/gcloud config set project $GCLOUD_PROJECT
command: sudo /opt/google-cloud-sdk/bin/gcloud compute copy-files ./dist 725459838767-compute@circle-ci:/circle_demo --zone $GCLOUD_INSTANCE_ZONE


How to deploy to Google Compute Engine?
#2

(When posting YAML, please use the code formatting tool in the toolbar - it looks like </>. It is nearly unreadable without being able to see the space indentation).


#3

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.