J'essaie de configurer un pipeline Cloud Build pour déployer une application golang
sur App Engine, mais elle semble engendrer des versions infinies d'elle-même, puis expire.
Pour commencer , voici ma configuration.
Step #1: Step #1: Step #1: Step #1: Step #1: Step #1: Copying gs://staging.solution360-event.appspot.com/asia.gcr.io/solution360-event/appengine/authproxy.20190130t100329:latest#1548842611410114... Step #1: Step #1: Step #1: Step #1: Step #1: Step #1: / [0 files][ 0.0 B/ 10.9 KiB] - - [1 files][ 10.9 KiB/ 10.9 KiB] Step #1: Step #1: Step #1: Step #1: Step #1: Step #1: Operation completed over 1 objects/10.9 KiB. Step #1: Step #1: Step #1: Step #1: Step #1: Step #1: BUILD Step #1: Step #1: Step #1: Step #1: Step #1: Step #1: Starting Step #0 Step #1: Step #1: Step #1: Step #1: Step #1: Step #1: Step #0: Already have image (with digest): gcr.io/cloud-builders/go Step #1: Step #1: Step #1: Step #1: Step #1: Step #1: Step #0: Documentation at https://github.com/GoogleCloudPlatform/cloud-builders/blob/master/go/README.md Step #1: Step #1: Step #1: Step #1: Step #1: Step #1: Step #0: Running: go get -u -d github.com/didip/tollbooth github.com/lib/pq github.com/stretchr/testify github.com/go-redis/redis cloud.google.com/go/pubsub
Voici la section pertinente de app.yaml
:
starting build "e5ad47ed-5332-4bc7-b4ac-618e243f05a5" FETCHSOURCE Fetching storage object: gs://staging.myproject-event.appspot.com/asia.gcr.io/myproject-event/appengine/myservice.20190130t095428:latest#1548842070817530 Copying gs://staging.myproject-event.appspot.com/asia.gcr.io/myproject-event/appengine/myservice.20190130t095428:latest#1548842070817530... / [0 files][ 0.0 B/ 10.9 KiB] - - [1 files][ 10.9 KiB/ 10.9 KiB] Operation completed over 1 objects/10.9 KiB. BUILD Starting Step #0 Step #0: Already have image (with digest): gcr.io/cloud-builders/go Step #0: Documentation at https://github.com/GoogleCloudPlatform/cloud-builders/blob/master/go/README.md Step #0: Running: go get -u -d github.com/didip/tollbooth github.com/lib/pq github.com/stretchr/testify github.com/go-redis/redis cloud.google.com/go/pubsub Finished Step #0 Starting Step #1 Step #1: Already have image (with digest): gcr.io/cloud-builders/gcloud Step #1: Services to deploy: Step #1: Step #1: descriptor: [/workspace/app.yaml] Step #1: source: [/workspace] Step #1: target project: [myproject-event] Step #1: target service: [myservice] Step #1: target version: [20190130t095546] Step #1: target url: [https://myservice-dot-myproject-event.appspot.com] Step #1: Step #1: Step #1: Do you want to continue (Y/n)? Step #1: WARNING: Unable to verify that the Appengine Flexible API is enabled for project [myproject-event]. You may not have permission to list enabled services on this project. If it is not enabled, this may cause problems in running your deployment. Please ask the project owner to ensure that the Appengine Flexible API has been enabled and that this account has permission to list enabled APIs. Step #1: Beginning deployment of service [myservice]... Step #1: Building and pushing image for service [myservice] Step #1: Started cloud build [b41069a6-2ef7-4eaf-8b49-de36bc620be2]. Step #1: To see logs in the Cloud Console: https://console.cloud.google.com/gcr/builds/b41069a6-2ef7-4eaf-8b49-de36bc620be2?project=954549095871 Step #1: ----------------------------- REMOTE BUILD OUTPUT ------------------------------ Step #1: starting build "b41069a6-2ef7-4eaf-8b49-de36bc620be2" Step #1: Step #1: FETCHSOURCE Step #1: Fetching storage object: gs://staging.myproject-event.appspot.com/asia.gcr.io/myproject-event/appengine/myservice.20190130t095546:latest#1548842148386512 Step #1: Copying gs://staging.myproject-event.appspot.com/asia.gcr.io/myproject-event/appengine/myservice.20190130t095546:latest#1548842148386512... Step #1: / [0 files][ 0.0 B/ 10.9 KiB] / [0 files][ 10.9 KiB/ 10.9 KiB] - - [1 files][ 10.9 KiB/ 10.9 KiB] Step #1: Operation completed over 1 objects/10.9 KiB. Step #1: BUILD Step #1: Starting Step #0 Step #1: Step #0: Already have image (with digest): gcr.io/cloud-builders/go Step #1: Step #0: Documentation at https://github.com/GoogleCloudPlatform/cloud-builders/blob/master/go/README.md Step #1: Step #0: Running: go get -u -d github.com/didip/tollbooth github.com/lib/pq github.com/stretchr/testify github.com/go-redis/redis cloud.google.com/go/pubsub Step #1: Finished Step #0 Step #1: Starting Step #1 Step #1: Step #1: Already have image (with digest): gcr.io/cloud-builders/gcloud Step #1: Step #1: Services to deploy:
Lorsque je déploie sur la branche que je l'ai configurée pour regarder, il démarre la compilation très bien et termine l'étape 0. Ensuite, il commence l'étape 1, qui est gcloud app deploy
, qui semble récursivement générer une autre instance du pipeline (voir les journaux ci-dessous). Cela continue jusqu'à ce que tout expire.
Voici le début du journal (vers la fin, vous verrez qu'il a recommencé de manière récursive l'étape 0 à l'étape 1).
service: "myservice" runtime: custom env: flex
gopath
dans un volume différent, au cas où cela ferait descendre gcloud de manière récursive. Voir la capture d'écran ci-jointe de la génération réelle des builds:
3 Réponses :
Je n'ai pas été en mesure de recréer les versions infinies, mais quelques petites choses
Les environnements d'exécution personnalisés nécessitent un fichier Docker, avez-vous essayé d'exécuter votre service dans l'environnement d'exécution go?
y a-t-il une raison spécifique pour laquelle vous utilisez des volumes au lieu de simplement définir la racine du projet dans l'environnement?
Vous n'êtes PAS autorisé à déployer l'application et à activer l'API flexible Appenginge.
Dans le journal, il y a un avertissement:
WARNING: Unable to verify that the Appengine Flexible API is enabled for project [project-name]. You may not have permission to list enabled services on this project. If it is not enabled, this may cause problems in running your deployment. Please ask the project owner to ensure that the Appengine Flexible API has been enabled and that this account has permission to list enabled APIs.
Étapes pour rationaliser le déploiement de Applications flexibles AppEngine:
@Prajjwal au cas où cette réponse serait utile, pourriez-vous l'accepter? Merci!
La première chose que j'ai essayée a été de lui donner toutes les autorisations demandées. Ce n'était pas ça.
Cela s'est donc avéré être un problème avec la façon dont Google Cloud Build
gère une rencontre avec le fichier de configuration cloudbuild.yaml
. Il doit générer une nouvelle construction à chaque fois qu'il en voit une, qu'elle ait déjà été vue ou non.
Dans mon cas, comme le projet était minuscule, cloudbuild.yaml
et mon go source étaient tous deux à la racine du projet. Cela a conduit à la situation suivante:
git push
initial déclenche une compilation, qui lit cloudbuild.yaml
. cloudbuild.yaml
dans le répertoire de travail actuel et génère une nouvelle build pour cela. Je suppose que cela est utile car vous pouvez avoir plusieurs configurations de construction pour diverses choses dans vos projets, qui seront construites au fur et à mesure des rencontres.
Le déplacement de la source go vers src /
(loin du cloudbuild) a résolu le problème.
tl; dr
NE METTEZ PAS VOTRE cloudbuild.yaml
DANS LE RÉPERTOIRE DE TRAVAIL.