Circle 2.0: Continuous deployment on Google App Engine

Hello. les amis. Can anyone give a sample yml to deploy my Golang app on google app engine? I am using circleci 2.0.

I was only just starting, but does GAE accept Docker images? I thought that was reserved to Google Container Engine deployments??

this is the error I am getting when I try the gcloud command used to deploy apps on GAE.

Here is my configuration file:

It seems the gcloud command isn’t installed by default.

OK, that’s better, thanks. However, these images are text artefacts with their contents trapped in bitmap form, and so they are not compatible with clipboards, screen-readers or search engines, which makes it harder for readers to help you. Would you copy + paste the logs and config into those posts as text? A formatting tool is available.

There’s an article about this, and something similar, for more explanation.

Quite possibly - it’s quite normal to install things every time in CI. If that takes a long time though, you can alternatively create a nice compact build image, and use that as your build environment instead.

Thank I will check that out.

export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \

echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" |
tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \

curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
apt-get update -y && apt-get install google-cloud-sdk -y

I tried to install it using instruction from google cloud pages but some packages lsb_release are not installed by default. And then I tried to build a custom image it git me nowhere.

This is what I got trying to build a custom image

Sending build context to Docker daemon 969.2kB
Step 1/14 : FROM circleci/golang:1.10.0
—> 01507f0f634f
Step 2/14 : USER root
—> Using cache
—> 8bc999570c84
Step 3/14 : RUN apt-get -qq update && apt-get install -y lsb_release
—> Running in d4bc16039464
Reading package lists…
Building dependency tree…
Reading state information…

> E: Unable to locate package lsb_release

The command ‘/bin/sh -c apt-get -qq update && apt-get install -y lsb_release’ returned a non-zero code: 100

I kept getting the highlighted error.

1 Like

I had to sleep only 4 hours last night but I think I am on the point of solving it.
This time I am going to learn how to blog. So that now one else ever has to go though the same pain.

I still have a little problem here: after reading a lot of posts online I concluded that the best way to deploy to app engine is to build a custom image with the gcloud command in it. So I build from circleci/golang:1.10.0. because I didn’t want to go into the hassle of installing golang. Howeve when I try to deploy i get an error:

``

`#!/bin/bash -eo pipefail

if [ ! -e {HOME}/gcloud-service-key.json ]; then
echo GCLOUD_SERVICE_KEY | base64 --decode --ignore-garbage > {HOME}/gcloud-service-key.json
fi
sudo gcloud auth activate-service-account --key-file=${HOME}/gcloud-service-key.json

sudo: gcloud: command not found
Exited with code 1`

Here is my Dockerfile:
`
#build custom image

#base image
FROM circleci/golang:1.10.0

RUN sudo apt-get update

#download gcloud sdk
RUN curl -OL https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-203.0.0-linux-x86_64.tar.gz

#install gcloud sdk
RUN sudo tar -xz -C /usr/bin -f google-cloud-sdk-203.0.0-linux-x86_64.tar.gz &&\ CLOUDSDK_CORE_DISABLE_PROMPTS=1 sudo /usr/bin/google-cloud-sdk/install.sh

#add gcloud command to bash:( I SUSPECT THE PROBLEM IS the last 2 lines)
RUN ["/bin/bash", "-c", "source /usr/bin/google-cloud-sdk/completion.bash.inc"]

RUN ["/bin/bash", "-c", "source /usr/bin/google-cloud-sdk/path.bash.inc"]

Please use block formatting for your errors, log files and config files. There is a button in the toolbar to apply it.

I did almost the same thing actually and this is the Dockerfile I ended up with… Granted I am running as root, but it solved my immediate problem (I am very new to Docker haha)

FROM circleci/golang:1.10

USER root

RUN apt-get update

RUN export CLOUD_SDK_REPO=“cloud-sdk-trusty” &&
echo “deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main” | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list &&
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - &&
apt-get update -y && apt-get install google-cloud-sdk -y

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