google-github-actions / deploy-appengine

A GitHub Action that deploys source code to Google App Engine.
https://cloud.google.com/appengine
254 stars 72 forks source link

Build in successful in the GCP build Logs for App Engine but GitHub Actions fails later with pnpm #345

Closed geekysaurabh001 closed 9 months ago

geekysaurabh001 commented 10 months ago

TL;DR

Error: google-github-actions/deploy-appengine failed with: failed to execute gcloud command `gcloud app deploy --quiet --format json pnpm-app.yaml --project *** --promote`: Services to deploy:

descriptor:                  [/home/runner/work/***-co.in/***-co.in/pnpm-app.yaml]
source:                      [/home/runner/work/***-co.in/***-co.in]
target project:              [***]
target service:              some_service
target version:              some_version
target url:                  some_url
target service account:      some_service_account

Beginning deployment of service [some_service]...
Created .gcloudignore file. See `gcloud topic gcloudignore` for details.
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 4 files to Google Cloud Storage                ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [some_service]...

After this, it fails.

Expected behavior

If the build is successful, the deployment should happen.

Observed behavior

The deployment doesn't happen with pnpm. npm isn't tested as legacy dependencies are present and I cannot change the npm ci command of the gcp app engine during the whole process unlike the control over gcp-build command. yarn works for some reason.

Action YAML

name: PNPM Test Deployment
on:
  push:
    branches:
      - 'new_branch'
jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu-latest
    steps:
      - id: checkout
        uses: actions/checkout@v4
        with:
          ref: ${{ github.event.inputs.branch }}
      - id: 'auth'
        name: 'Authenticate to Google Cloud'
        uses: google-github-actions/auth@v1
        with:
          credentials_json: '${{ secrets.STAGING_DEPLOYMENT_SERVICE_ACCOUNT }}'
      - id: Deploy
        uses: google-github-actions/deploy-appengine@v2
        env:
          CLOUDSDK_APP_CLOUD_BUILD_TIMEOUT: 1800
        with:
          project_id: ''
          deliverables: pnpm-app.yaml
          build_env_vars: |-
            __all environment key-value are listed here__

Log output

No response

Additional information

pnpm-yaml file

env: standard
runtime: nodejs20
service: new_service
instance_class: F2

handlers:
  - url: /.*
    secure: always
    script: auto
    redirect_http_response_code: 301
sethvargo commented 10 months ago

Hi there - could you please provide the debug output for the complete GitHub Actions workflow run?

geekysaurabh001 commented 10 months ago
##[debug]Caching tool gcloud 459.0.0 x64
##[debug]source dir: /home/runner/work/_temp/646b333b-45c6-4a0c-b00b-6126c3e6ce01/google-cloud-sdk
##[debug]destination /opt/hostedtoolcache/gcloud/459.0.0/x64
##[debug]finished caching tool
##[debug]Running command: gcloud --quiet auth login --force --cred-file /home/runner/work/***-co.in/***-co.in/gha-creds-04cef04572c3e7de.json
Successfully authenticated
Running: gcloud app deploy --quiet --format json pnpm-app.yaml --project *** --promote
Error: google-github-actions/deploy-appengine failed with: failed to execute gcloud command `gcloud app deploy --quiet --format json pnpm-app.yaml --project *** --promote`: Services to deploy:

descriptor:                  [/home/runner/work/***-co.in/***-co.in/pnpm-app.yaml]
source:                      [/home/runner/work/***-co.in/***-co.in]
target project:              [***]
target service:              some_service
target version:              some_version
target url:                  some_url
target service account:      some_service_account

Beginning deployment of service [some_service]...
Created .gcloudignore file. See `gcloud topic gcloudignore` for details.
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 0 files to Google Cloud Storage                ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [some_service]...
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
##[debug]Restoring original pnpm-app.yaml contents
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Run google-github-actions/deploy-appengine@v1
sethvargo commented 10 months ago

Hi @geekysaurabh001 - does running that gcloud command from your local machine succeed?

geekysaurabh001 commented 9 months ago

Hi @geekysaurabh001 - does running that gcloud command from your local machine succeed?

It was failing as well. On Friday afternoon, all of a sudden the pnpm one worked. But since the final size was huge (3.2 GB), I decided to try npm as well and it started failing due to GCP running npm ci whereas mine needed legacy flag. So had to use npmrc as below and it finally worked. Also brought down the size to 2.2 GB.

engine-strict=true
enable-pre-post-scripts=true
location=project
legacy-peer-deps=true

I think this can be closed at this point.