getting permission denied on app engine deploy - go

cannot run gcloud app deploy i get the following on terminal (gcloud.app.deploy) Error Response: [9] Cloud build 8c84eb5e-f6b7-4170-a87d-80754fecfbbe status: FAILURE
removing /layers/google.go.gomod/gopath: unlinkat /layers/google.go.gomod/gopath/pkg/mod/gonum.org/v1/gonum#v0.9.3/internal/math32/signbit.go: permission denied
Full build logs: https://console.cloud.google.com/cloud-build/builds;region=us-central1/8c84eb5e-f6b7-4170-a87d-80754fecfbbe?project=552359020884
starting build "f0da5db4-4130-4784-9276-90236bc2e6c6"
FETCHSOURCE
BUILD
Starting Step #0 - "fetch"
Step #0 - "fetch": Pulling image: us.gcr.io/gae-runtimes/utilities/gcs-fetcher:base_20220302a_18_04_RC00
Step #0 - "fetch": base_20220302a_18_04_RC00: Pulling from gae-runtimes/utilities/gcs-fetcher
Step #0 - "fetch": 05867982f162: Pulling fs layer
Step #0 - "fetch": 05867982f162: Verifying Checksum
Step #0 - "fetch": 05867982f162: Download complete
Step #0 - "fetch": 05867982f162: Pull complete
Step #0 - "fetch": Digest: sha256:3534f59733f91a6b570e0fee8394f356100459ce1b9b25aa80fa0dae19fd2b4b
Step #0 - "fetch": Status: Downloaded newer image for us.gcr.io/gae-runtimes/utilities/gcs-fetcher:base_20220302a_18_04_RC00
Step #0 - "fetch": us.gcr.io/gae-runtimes/utilities/gcs-fetcher:base_20220302a_18_04_RC00
Step #0 - "fetch": Fetching manifest gs://staging.fitstack-343223.appspot.com/ae/b92b526e-7dcf-4786-9d01-988286bbd036/manifest.json.
Step #0 - "fetch": Processing 32 files.
Step #0 - "fetch": ******************************************************
Step #0 - "fetch": Status: SUCCESS
Step #0 - "fetch": Started: 2022-03-16T01:27:57Z
Step #0 - "fetch": Completed: 2022-03-16T01:27:57Z
Step #0 - "fetch": Requested workers: 200
Step #0 - "fetch": Actual workers: 32
Step #0 - "fetch": Total files: 32
Step #0 - "fetch": Total retries: 0
Step #0 - "fetch": GCS timeouts: 0
Step #0 - "fetch": MiB downloaded: 0.27 MiB
Step #0 - "fetch": MiB/s throughput: 2.30 MiB/s
Step #0 - "fetch": Time for manifest: 73.99 ms
Step #0 - "fetch": Total time: 0.20 s
Step #0 - "fetch": ******************************************************
Finished Step #0 - "fetch"
Starting Step #1 - "pre-buildpack"
Step #1 - "pre-buildpack": Pulling image: us.gcr.io/gae-runtimes/utilities/buildpack-shim:base_20220302a_18_04_RC00
Step #1 - "pre-buildpack": base_20220302a_18_04_RC00: Pulling from gae-runtimes/utilities/buildpack-shim
Step #1 - "pre-buildpack": 47d17572643b: Already exists
Step #1 - "pre-buildpack": b69d4a399026: Already exists
Step #1 - "pre-buildpack": 3c2cba919283: Already exists
Step #1 - "pre-buildpack": 5683da2e62ee: Already exists
Step #1 - "pre-buildpack": 5d61b34c58e5: Already exists
Step #1 - "pre-buildpack": 871c5c6098f7: Already exists
Step #1 - "pre-buildpack": 258748e39430: Already exists
Step #1 - "pre-buildpack": 9044308efa14: Already exists
Step #1 - "pre-buildpack": 3dcf4435d2c6: Already exists
Step #1 - "pre-buildpack": dc5b391f6f2a: Already exists
Step #1 - "pre-buildpack": 2c067104188b: Already exists
Step #1 - "pre-buildpack": e60795ed0a63: Pulling fs layer
Step #1 - "pre-buildpack": b8988709d36f: Pulling fs layer
Step #1 - "pre-buildpack": ab002007ac6d: Pulling fs layer
Step #1 - "pre-buildpack": b8988709d36f: Download complete
Step #1 - "pre-buildpack": ab002007ac6d: Download complete
Step #1 - "pre-buildpack": e60795ed0a63: Verifying Checksum
Step #1 - "pre-buildpack": e60795ed0a63: Download complete
Step #1 - "pre-buildpack": e60795ed0a63: Pull complete
Step #1 - "pre-buildpack": b8988709d36f: Pull complete
Step #1 - "pre-buildpack": ab002007ac6d: Pull complete
Step #1 - "pre-buildpack": Digest: sha256:275cba4037e38f32445232017e902e70e6b29251ddbf8e2fba1b95f3fe37a6cf
Step #1 - "pre-buildpack": Status: Downloaded newer image for us.gcr.io/gae-runtimes/utilities/buildpack-shim:base_20220302a_18_04_RC00
Step #1 - "pre-buildpack": us.gcr.io/gae-runtimes/utilities/buildpack-shim:base_20220302a_18_04_RC00
Step #1 - "pre-buildpack": Preparing directory /layers
Step #1 - "pre-buildpack": Preparing directory /workspace
Step #1 - "pre-buildpack": Preparing directory /builder/home
Step #1 - "pre-buildpack": Preparing directory /builder/outputs
Step #1 - "pre-buildpack": Preparing directory /platform/env
Step #1 - "pre-buildpack": Passing build environment variable BUILDER_OUTPUT to buildpacks
Step #1 - "pre-buildpack": Passing build environment variable GOOGLE_DEBUG to buildpacks
Step #1 - "pre-buildpack": Passing build environment variable GOOGLE_RUNTIME to buildpacks
Step #1 - "pre-buildpack": Passing build environment variable GOOGLE_LABEL_BUILDER_VERSION to buildpacks
Step #1 - "pre-buildpack": Passing build environment variable GOOGLE_LABEL_BUILDER_IMAGE to buildpacks
Step #1 - "pre-buildpack": Passing build environment variable GOOGLE_LABEL_RUN_IMAGE to buildpacks
Step #1 - "pre-buildpack": Passing build environment variable GAE_APP_ENGINE_APIS to buildpacks
Step #1 - "pre-buildpack": Passing build environment variable GOOGLE_EXPERIMENTAL_AR_AUTH_ENABLED to buildpacks
Step #1 - "pre-buildpack": Retagging us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:latest as us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:f0da5db4-4130-4784-9276-90236bc2e6c6
Step #1 - "pre-buildpack": Checking if image us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:latest exists
Step #1 - "pre-buildpack": Image us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:latest exists
Step #1 - "pre-buildpack": DEBUG: "us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:latest"(us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:latest) took 381.418627ms
Step #1 - "pre-buildpack": Checking if image us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:latest is valid
Step #1 - "pre-buildpack": DEBUG: ...pull("us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:latest") took 95.856602ms
Step #1 - "pre-buildpack": DEBUG: ...validate("us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:latest") took 204.495818ms
Step #1 - "pre-buildpack": Image us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:latest is valid
Step #1 - "pre-buildpack": DEBUG: "us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:latest"(us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:latest) took 300.520902ms
Step #1 - "pre-buildpack": Image us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:latest copied to us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:f0da5db4-4130-4784-9276-90236bc2e6c6
Step #1 - "pre-buildpack": DEBUG: "us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:latest", "us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:f0da5db4-4130-4784-9276-90236bc2e6c6"(us.gcr.io/fitstack-343223/app-engine-tmp/build-cache/default/ttl-7d:latest) took 634.021045ms
Finished Step #1 - "pre-buildpack"
Starting Step #2 - "build"
Step #2 - "build": Pulling image: us.gcr.io/gae-runtimes/buildpacks/go116/builder:go116_20220306_1_16_13_RC00
Step #2 - "build": go116_20220306_1_16_13_RC00: Pulling from gae-runtimes/buildpacks/go116/builder
Step #2 - "build": 47d17572643b: Already exists
Step #2 - "build": b69d4a399026: Already exists
Step #2 - "build": 3c2cba919283: Already exists
Step #2 - "build": 5683da2e62ee: Already exists
Step #2 - "build": 5d61b34c58e5: Already exists
Step #2 - "build": 871c5c6098f7: Already exists
Step #2 - "build": 258748e39430: Already exists
Step #2 - "build": 9044308efa14: Already exists
Step #2 - "build": 3dcf4435d2c6: Already exists
Step #2 - "build": dc5b391f6f2a: Already exists
Step #2 - "build": 2c067104188b: Already exists
Step #2 - "build": 0f543a8b6413: Pulling fs layer
Step #2 - "build": 6b10d361d16a: Pulling fs layer
Step #2 - "build": 11c1bcc7b79a: Pulling fs layer
Step #2 - "build": d41faa8feb5c: Pulling fs layer
Step #2 - "build": 49ef2925f143: Pulling fs layer
Step #2 - "build": 9ebd49cad864: Pulling fs layer
Step #2 - "build": 9f660d20a3a2: Pulling fs layer
Step #2 - "build": e8c7adea3b75: Pulling fs layer
Step #2 - "build": 06f428a8446f: Pulling fs layer
Step #2 - "build": dcaad5a887e8: Pulling fs layer
Step #2 - "build": bfddb12fd793: Pulling fs layer
Step #2 - "build": 2dc944e4043e: Pulling fs layer
Step #2 - "build": 674804e5a494: Pulling fs layer
Step #2 - "build": fe55734633e1: Pulling fs layer
Step #2 - "build": d1ced7a31646: Pulling fs layer
Step #2 - "build": 8d51793b1c23: Pulling fs layer
Step #2 - "build": d32271d57ef0: Pulling fs layer
Step #2 - "build": 50e8b9c0dddc: Pulling fs layer
Step #2 - "build": 4f4fb700ef54: Pulling fs layer
Step #2 - "build": d41faa8feb5c: Waiting
Step #2 - "build": 49ef2925f143: Waiting
Step #2 - "build": 674804e5a494: Waiting
Step #2 - "build": 9ebd49cad864: Waiting
Step #2 - "build": fe55734633e1: Waiting
Step #2 - "build": 9f660d20a3a2: Waiting
Step #2 - "build": e8c7adea3b75: Waiting
Step #2 - "build": d1ced7a31646: Waiting
Step #2 - "build": 06f428a8446f: Waiting
Step #2 - "build": 8d51793b1c23: Waiting
Step #2 - "build": dcaad5a887e8: Waiting
Step #2 - "build": d32271d57ef0: Waiting
Step #2 - "build": bfddb12fd793: Waiting
Step #2 - "build": 2dc944e4043e: Waiting
Step #2 - "build": 50e8b9c0dddc: Waiting
Step #2 - "build": 4f4fb700ef54: Waiting
Step #2 - "build": 6b10d361d16a: Verifying Checksum
Step #2 - "build": 6b10d361d16a: Download complete
Step #2 - "build": 0f543a8b6413: Verifying Checksum
Step #2 - "build": 0f543a8b6413: Download complete
Step #2 - "build": d41faa8feb5c: Verifying Checksum
Step #2 - "build": d41faa8feb5c: Download complete
Step #2 - "build": 49ef2925f143: Download complete
Step #2 - "build": 0f543a8b6413: Pull complete
Step #2 - "build": 9ebd49cad864: Verifying Checksum
Step #2 - "build": 9ebd49cad864: Download complete
Step #2 - "build": 9f660d20a3a2: Verifying Checksum
Step #2 - "build": 9f660d20a3a2: Download complete
Step #2 - "build": e8c7adea3b75: Verifying Checksum
Step #2 - "build": e8c7adea3b75: Download complete
Step #2 - "build": 06f428a8446f: Verifying Checksum
Step #2 - "build": 06f428a8446f: Download complete
Step #2 - "build": 6b10d361d16a: Pull complete
Step #2 - "build": bfddb12fd793: Verifying Checksum
Step #2 - "build": bfddb12fd793: Download complete
Step #2 - "build": dcaad5a887e8: Verifying Checksum
Step #2 - "build": dcaad5a887e8: Download complete
Step #2 - "build": 2dc944e4043e: Verifying Checksum
Step #2 - "build": 2dc944e4043e: Download complete
Step #2 - "build": 674804e5a494: Verifying Checksum
Step #2 - "build": 674804e5a494: Download complete
Step #2 - "build": fe55734633e1: Verifying Checksum
Step #2 - "build": fe55734633e1: Download complete
Step #2 - "build": d1ced7a31646: Verifying Checksum
Step #2 - "build": d1ced7a31646: Download complete
Step #2 - "build": d32271d57ef0: Verifying Checksum
Step #2 - "build": d32271d57ef0: Download complete
Step #2 - "build": 8d51793b1c23: Verifying Checksum
Step #2 - "build": 8d51793b1c23: Download complete
Step #2 - "build": 4f4fb700ef54: Verifying Checksum
Step #2 - "build": 4f4fb700ef54: Download complete
Step #2 - "build": 50e8b9c0dddc: Verifying Checksum
Step #2 - "build": 50e8b9c0dddc: Download complete
Step #2 - "build": 11c1bcc7b79a: Verifying Checksum
Step #2 - "build": 11c1bcc7b79a: Download complete
Step #2 - "build": 11c1bcc7b79a: Pull complete
Step #2 - "build": d41faa8feb5c: Pull complete
Step #2 - "build": 49ef2925f143: Pull complete
Step #2 - "build": 9ebd49cad864: Pull complete
Step #2 - "build": 9f660d20a3a2: Pull complete
Step #2 - "build": e8c7adea3b75: Pull complete
Step #2 - "build": 06f428a8446f: Pull complete
Step #2 - "build": dcaad5a887e8: Pull complete
Step #2 - "build": bfddb12fd793: Pull complete
Step #2 - "build": 2dc944e4043e: Pull complete
Step #2 - "build": 674804e5a494: Pull complete
Step #2 - "build": fe55734633e1: Pull complete
Step #2 - "build": d1ced7a31646: Pull complete
Step #2 - "build": 8d51793b1c23: Pull complete
Step #2 - "build": d32271d57ef0: Pull complete
Step #2 - "build": 50e8b9c0dddc: Pull complete
Step #2 - "build": 4f4fb700ef54: Pull complete
Step #2 - "build": Digest: sha256:874ed274d98a67c23a1102811baac2313a3db7b0e1d60f2bdc34c9e2615e45a7
Step #2 - "build": Status: Downloaded newer image for us.gcr.io/gae-runtimes/buildpacks/go116/builder:go116_20220306_1_16_13_RC00
Step #2 - "build": us.gcr.io/gae-runtimes/buildpacks/go116/builder:go116_20220306_1_16_13_RC00
Step #2 - "build": ===> DETECTING
Step #2 - "build": google.go.appengine_gomod 0.9.0
Step #2 - "build": google.go.gomod 0.9.0
Step #2 - "build": google.go.build 0.9.0
Step #2 - "build": google.go.appengine 0.9.0
Step #2 - "build": google.utils.label 0.0.2
Step #2 - "build": ===> ANALYZING
Step #2 - "build": Previous image with name "us.gcr.io/fitstack-343223/app-engine-tmp/app/default/ttl-18h:b92b526e-7dcf-4786-9d01-988286bbd036" not found
Step #2 - "build": Restoring metadata for "google.go.gomod:gopath" from cache
Step #2 - "build": ===> RESTORING
Step #2 - "build": Restoring data for "google.go.gomod:gopath" from cache
Step #2 - "build": ===> BUILDING
Step #2 - "build": === App Engine Gomod (google.go.appengine_gomod#0.9.0) ===
Step #2 - "build": --------------------------------------------------------------------------------
Step #2 - "build": Running "cp --dereference -R . /layers/google.go.appengine_gomod/srv"
Step #2 - "build": Done "cp --dereference -R . /layers/google.go.appengine_gomod/srv" (62.041821ms)
Step #2 - "build": === Go - Gomod (google.go.gomod#0.9.0) ===
Step #2 - "build": DEBUG: go.mod SHA has changed: clearing GOPATH layer's cache
Step #2 - "build": Failure: (ID: 4516fb13) removing /layers/google.go.gomod/gopath: unlinkat /layers/google.go.gomod/gopath/pkg/mod/gonum.org/v1/gonum#v0.9.3/internal/math32/signbit.go: permission denied
Step #2 - "build": --------------------------------------------------------------------------------
Step #2 - "build": Running "mv -f /builder/outputs/output-5577006791947779410 /builder/outputs/output"
Step #2 - "build": Done "mv -f /builder/outputs/output-5577006791947779410 /builder/o..." (35.537571ms)
Step #2 - "build": ERROR: failed to build: exit status 1
Finished Step #2 - "build"
ERROR
ERROR: build step 2 "us.gcr.io/gae-runtimes/buildpacks/go116/builder:go116_20220306_1_16_13_RC00" failed: step exited with non-zero status: 145
here is my go mod
module github.com/voodoostack/fitstackapi
go 1.17
require golang.org/x/crypto v0.0.0-20220214200702-86341886e292
require (
github.com/99designs/gqlgen v0.17.1
github.com/georgysavva/scany v0.3.0
github.com/go-chi/chi v1.5.4
github.com/golang-migrate/migrate/v4 v4.15.1
github.com/jackc/pgx/v4 v4.15.0
github.com/joho/godotenv v1.4.0
github.com/lestrrat-go/jwx v1.2.20
github.com/stretchr/testify v1.7.0
github.com/vektah/gqlparser/v2 v2.4.0
)
require (
github.com/agnivade/levenshtein v1.1.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d // indirect
github.com/goccy/go-json v0.9.4 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.11.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.2.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.10.0 // indirect
github.com/jackc/puddle v1.2.1 // indirect
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
github.com/lestrrat-go/blackmagic v1.0.0 // indirect
github.com/lestrrat-go/httpcc v1.0.0 // indirect
github.com/lestrrat-go/iter v1.0.1 // indirect
github.com/lestrrat-go/option v1.0.0 // indirect
github.com/lib/pq v1.10.2 // indirect
github.com/matryer/moq v0.2.3 // indirect
github.com/mitchellh/mapstructure v1.2.3 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/urfave/cli/v2 v2.3.0 // indirect
go.uber.org/atomic v1.6.0 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.9 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)
and finally my app.yaml
runtime: go117
env: standard
instance_class: F1
handlers:
- url: /.*
script: auto
- url: .*
script: auto
env_variables:
DATABASE_URL: none
automatic_scaling:
min_idle_instances: automatic
max_idle_instances: automatic
min_pending_latency: automatic
max_pending_latency: automatic
network: {}
service_account: fitstack-343223#appspot.gserviceaccount.com

Google cloud with the appengine doesn't support go 1.17 yet, only go 1.16 max at the moment

Related

"unable to get local issuer certificate"

[builder 4/6] RUN yarn:
#10 0.574 yarn install v1.22.19
#10 0.704 [1/4] Resolving packages...
#10 1.587 [2/4] Fetching packages...
#10 2.112 error An unexpected error occurred: "https://registry.yarnpkg.com/#babel/runtime/-/runtime-7.18.9.tgz: unable to get local issuer certificate".
#10 2.112 info If you think this is a bug, please open a bug report with the information provided in "/app/yarn-error.log".
#10 2.112 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
executor failed running [/bin/sh -c yarn]: exit code: 1
I have used the following commands, but still, I'm getting this error certificate error.
yarn install --ignore-engines --ignore-platform
yarn config set "strict-ssl" false -g
yarn config set enableStrictSsl false

ng test Process completed with exit code 1 on Github Action

In my Angular project I want to run automated test on every push on any branches with this YAML file:
on: [push]
jobs:
ng-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout#v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v1
with:
node-version: ${{ matrix.node-version }}
- name: npm ci
run: |
cd angular/
npm ci
- name: ng test
run: |
cd angular/
npm run test:ci
And the result is this:
Chrome Headless 96.0.4664.45 (Linux x86_64): Executed 18 of 23 (skipped 5) SUCCESS (0.817 secs / 0.519 secs)
TOTAL: 36 SUCCESS
TOTAL: 36 SUCCESS
TOTAL: 36 SUCCESS
=============================== Coverage summary ===============================
Statements : 32.12% ( 387/1205 )
Branches : 11.75% ( 53/451 )
Functions : 14.2% ( 45/317 )
Lines : 29.78% ( 341/1145 )
================================================================================
=============================== Coverage summary ===============================
Statements : 32.12% ( 387/1205 )
Branches : 11.75% ( 53/451 )
Functions : 14.2% ( 45/317 )
Lines : 29.78% ( 341/1145 )
================================================================================
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myproject#11.0.0 test:ci: `ng test --watch=false --code-coverage --source-map true`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myproject#11.0.0 test:ci script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-12-06T12_08_18_494Z-debug.log
Error: Process completed with exit code 1.
In my local machine everything is fine.
What's wrong here? Any idea?

Gitlab runner cache miss file after stage complete

Summary
My gitlab-ci.yml has 3 stage for deploy an application to okd pod
Application running spring boot on tomcat:8
Sometimes, the cache.zip is not update after stage complete so that the next step can't run correctly
Steps to reproduce
My gitlab-ci run the following stage
Stage 1: run test compile ---> OK
Stage 2: package war file as output for deploy ---> Gitlab-ci log show success but the cache.zip has not war file (just sometimes cache.zip not have war file, sometimes it run correctly)
Stage 3: Deploy war file to pod ---> Because of war file not exists in cache.zip, script error -> failed
.gitlab-ci.yml
image: openshift/origin-cli
stages:
- build
- test
- staging
cache:
paths:
- .m2/repository
- target
- artifact
validate:jdk8:
stage: build
script:
- 'mvn test-compile'
only:
- master
image: maven:3.3.9-jdk-8
verify:jdk8:
stage: test
script:
- 'mvn verify'
- 'mvn package' # =====> this command generate war file
only:
- master
image: maven:3.3.9-jdk-8
staging:
script:
- "mkdir -p artifact"
- "cp ./target/*.war ./artifact/" # ======> Sometimes error at this line because of previous step not add war file into cache
- "oc start-build $APP"
- "rm -rf ./target/* && rm -rf ./artifact/*" # Remove war & class file, only cache m2 lib
stage: staging
variables:
APP: $CI_PROJECT_NAME
environment:
name: staging
url: http://$CI_PROJECT_NAME-staging.$OPENSHIFT_DOMAIN
only:
- master
Actual behavior
Sometimes cache not have war file after test stage complete (is this depends on war file size?)
Expected behavior
War file update into cache after test stage for staging stage deploy
Relevant logs and/or screenshots
ScreenShot
job log
Running with gitlab-runner 13.7.0 (943fc252)
on gitlab-runner-node1 y6awygsj
Preparing the "docker" executor
00:01
Using Docker executor with image openshift/origin-cli ...
Using locally found image version due to if-not-present pull policy
Using docker image sha256:7ebb6be01117a50344d63f77c385a13302afecd33480b97c36a518d4f5ebc25a for openshift/origin-cli with digest docker.io/openshift/origin-cli#sha256:509e052d0f2d531b666b7da9fa49c5558c76ce5d286456f0859c0a49b16d6bf2 ...
Preparing environment
00:00
Running on runner-y6awygsj-project-489-concurrent-0 via gitlab.runner.node1...
Getting source from Git repository
00:01
Fetching changes...
Reinitialized existing Git repository in /builds/my-project/.git/
Checking out b4c97428 as master...
Removing .m2/
Removing artifact/
Removing target/
Skipping Git submodules setup
Restoring cache
00:05
Checking cache for default-23...
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.
Successfully extracted cache
Executing "step_script" stage of the job script
00:01
$ mkdir -p artifact
$ cp ./target/*.war ./artifact/
cp: cannot stat './target/*.war': No such file or directory
Cleaning up file based variables
00:00
ERROR: Job failed: exit code 1
Environment description
config.toml
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "gitlab-runner-node1"
url = "https://gitlab.mycompany.vn/"
token = "y6awygsj9zks18nU6PDt"
executor = "docker"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
dns = ["192.168.100.1"]
tls_verify = false
image = "alpine:latest"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/mnt/nfs/nfsshare-gitlab/cache:/cache"]
shm_size = 0
pull_policy = "if-not-present"
Used GitLab Runner version
Version: 13.7.0
Git revision: 943fc252
Git branch: 13-7-stable
GO version: go1.13.8
Built: 2020-12-21T13:47:06+0000
OS/Arch: linux/amd64
Possible fixes
Re-run test stage until cache has war file
Let's go step by step.
First, regarding how to manage the files between stages.
It's true that you could directly access to the files between jobs and stages if both run on the same environment, but that's not always the case (even if both runners are using the same nfs share directory) and you should use artifacts for that.
When you define an artifact within a job, you're specifying a list of files that are attached to the job when it succeeds, fails or always, depending on the configuration you have.
By default, all artifacts from previous stages are passed to each job, but in any case you can use dependencies to also define from which jobs you want to fetch artifacts from.
So basically you should use the following .gitlab-ci.yml
image: openshift/origin-cli
stages:
- build
- test
- staging
cache:
paths:
- .m2/repository
validate:jdk8:
stage: build
script:
- 'mvn test-compile'
only:
- master
image: maven:3.3.9-jdk-8
verify:jdk8:
stage: test
script:
- 'mvn verify' # =====> verify already includes: validate, compile, test and package
artifacts:
paths:
- target/[YOUR_APP_NAME].war
only:
- master
image: maven:3.3.9-jdk-8
staging:
dependencies:
- verify:jdk8
script:
- "mkdir -p artifact"
- "cp ./target/[YOUR_APP_NAME].war ./artifact/"
- "oc start-build $APP"
stage: staging
variables:
APP: $CI_PROJECT_NAME
environment:
name: staging
url: http://$CI_PROJECT_NAME-staging.$OPENSHIFT_DOMAIN
only:
- master
Also, notice that I deleted the mvn package instruction. I would recommend you to take a look into the Build Lifecycle Basics of Maven.

How to analyze image build that fails silently in CI tool?

My Docker image is failing during build in GitLab CI and it fails silently without giving any errors to work with. I can build the image locally and no problem whatsoever so the problem is in CI environment. Something that is not obvious causes the build to fail. After doing some research about this I've learned the best thing to do to SSH into the CI server and "poke around" to find out what's happening. In particular I've learned that I can get a log of the last layer before the build fails to get insight into why it might be failing. However, GitLab doesn't support direct SSH connection into CI server. Supports only fixed SSH commands executed towards the server from the build environment (.gitlab-ci.yml) which isn't very helpful because I need to use SSH to access build layers of the image.
What are my other options as to how can I debug / analyze an image during build in CI ?
Any feedback much appreciated.
Dockerfile:
###########
# BUILDER #
###########
# base image
FROM node:11.12.0-alpine as builder
# set working directory
WORKDIR /usr/src/app
RUN apk add --no-cache --virtual .gyp python make g++
# install app dependencies
ENV PATH /usr/src/app/node_modules/.bin:$PATH
COPY package.json /usr/src/app/package.json
COPY package-lock.json /usr/src/app/package-lock.json
RUN npm install --no-optional
RUN npm install react-scripts#2.1.8 -g --silent --no-optional
# set environment variables
ARG REACT_APP_USERS_SERVICE_URL
ENV REACT_APP_USERS_SERVICE_URL $REACT_APP_USERS_SERVICE_URL
ARG NODE_ENV
ENV NODE_ENV $NODE_ENV
# create build
COPY . /usr/src/app
RUN npm run build
#########
# FINAL #
#########
# base image
FROM nginx:1.15.9-alpine
# update nginx conf
RUN rm -rf /etc/nginx/conf.d
COPY conf /etc/nginx
# copy static files
COPY --from=builder /usr/src/app/build /usr/share/nginx/html
# expose port
EXPOSE 80
# run nginx
CMD ["nginx", "-g", "daemon off;"]
.gitlab-ci.yml file:
...
...
after_script:
- bash ./docker-push.sh
- docker-compose down
docker-push.sh script that builds the image for pushing into ECR on AWS:
echo "building the client image ..."
docker -D build $CLIENT_REPO -t $CLIENT:$COMMIT -f Dockerfile-prod --build-arg REACT_APP_USERS_SERVICE_URL="" # this line is failing
if [ $? -ne 0 ]; then
echo "Failure. Exiting now..."
exit 1
fi
docker -D tag $CLIENT:$COMMIT $REPO/$CLIENT:$TAG
docker -D push $REPO/$CLIENT:$TAG
docker build $USERS_REPO -t $USERS:$COMMIT -f Dockerfile-$DOCKER_ENV
docker tag $USERS:$COMMIT $REPO/$USERS:$TAG
docker push $REPO/$USERS:$TAG
docker build $USERS_DB_REPO -t $USERS_DB:$COMMIT -f Dockerfile
docker tag $USERS_DB:$COMMIT $REPO/$USERS_DB:$TAG
docker push $REPO/$USERS_DB:$TAG
docker build $SWAGGER_REPO -t $SWAGGER:$COMMIT -f Dockerfile-$DOCKER_ENV
docker tag $SWAGGER:$COMMIT $REPO/$SWAGGER:$TAG
docker push $REPO/$SWAGGER:$TAG
job log from gitlab ci (relevant part only):
Login Succeeded
building the client image ...
time="2020-04-14T08:54:23Z" level=debug msg="Skipping excluded path: .dockerignore"
time="2020-04-14T08:54:23Z" level=debug msg="Skipping excluded path: Dockerfile"
time="2020-04-14T08:54:23Z" level=debug msg="Skipping excluded path: Dockerfile-prod"
time="2020-04-14T08:54:23Z" level=debug msg="Skipping excluded path: Dockerfile-stage"
time="2020-04-14T08:54:23Z" level=debug msg="Skipping excluded path: .dockerignore"
time="2020-04-14T08:54:23Z" level=debug msg="Skipping excluded path: Dockerfile-prod"
time="2020-04-14T08:54:23Z" level=debug msg="Skipping excluded path: Dockerfile"
time="2020-04-14T08:54:23Z" level=debug msg="Skipping excluded path: Dockerfile-stage"
Step 1/25 : FROM node:11.12.0-alpine as builder
---> 09084e4ff58d
Step 2/25 : WORKDIR /usr/src/app
---> Using cache
---> 9c6639a8a785
Step 3/25 : RUN apk add --no-cache --virtual .gyp python make g++
---> Using cache
---> 0d5320ee514b
Step 4/25 : ENV PATH /usr/src/app/node_modules/.bin:$PATH
---> Using cache
---> c041f8c64b34
Step 5/25 : COPY package.json /usr/src/app/package.json
---> 02d18d67a517
Step 6/25 : COPY package-lock.json /usr/src/app/package-lock.json
---> 2d94e8e8fb6c
Step 7/25 : RUN npm install --no-optional
---> Running in 59660215041e
> cypress#4.1.0 postinstall /usr/src/app/node_modules/cypress
> node index.js --exec install
Installing Cypress (version: 4.1.0)
[08:55:20] Downloading Cypress [started]
[08:55:20] Downloading Cypress 0% 0s [title changed]
[08:55:20] Downloading Cypress 2% 5s [title changed]
...
...
[08:55:39] Unzipping Cypress 9% 167s [title changed]
[08:55:39] Unzipping Cypress 100% 0s [title changed]
[08:55:39] Unzipped Cypress [title changed]
[08:55:39] Unzipped Cypress [completed]
[08:55:39] Finishing Installation [started]
[08:55:40] Finished Installation /root/.cache/Cypress/4.1.0 [title changed]
[08:55:40] Finished Installation /root/.cache/Cypress/4.1.0 [completed]
You can now open Cypress by running: node_modules/.bin/cypress open
https://on.cypress.io/installing-cypress
added 2034 packages from 768 contributors and audited 38602 packages in 77.201s
found 1073 vulnerabilities (1058 low, 14 moderate, 1 high)
run `npm audit fix` to fix them, or `npm audit` for details
Saving cache
00:02
Uploading artifacts for successful job
00:02
Job succeeded

Firebase CLI error in Google Cloud Build step

When I am running the "firebase use" command from the Firebase CLI in a cloudbuild step I get the following error:
Starting Step #5 - "SetFirebaseEnvironment"
Step #5 - "SetFirebaseEnvironment": Already have image (with digest): eu.gcr.io/BUCKET_NAME/firebase:7.12-0
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.806Z] ----------------------------------------------------------------------
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.808Z] Command: /usr/local/bin/node /usr/local/bin/firebase use dev --debug
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.808Z] CLI Version: 7.12.1
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.808Z] Platform: linux
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.808Z] Node Version: v13.6.0
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.813Z] Time: Mon Feb 17 2020 13:09:50 GMT+0000 (Coordinated Universal Time)
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.813Z] ----------------------------------------------------------------------
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.813Z]
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.820Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.820Z] > attempting to authenticate via app default credentials
Step #5 - "SetFirebaseEnvironment": [2020-02-17T13:09:50.854Z] TypeError: Cannot create property 'refresh_token' on string 'Not Found
Step #5 - "SetFirebaseEnvironment": '
Step #5 - "SetFirebaseEnvironment": at /usr/local/lib/node_modules/firebase-tools/node_modules/google-auto-auth/node_modules/google-auth-library/lib/auth/oauth2client.js:208:28
Step #5 - "SetFirebaseEnvironment": at /usr/local/lib/node_modules/firebase-tools/node_modules/google-auto-auth/node_modules/google-auth-library/lib/auth/computeclient.js:85:7
Step #5 - "SetFirebaseEnvironment": at Request._callback (/usr/local/lib/node_modules/firebase-tools/node_modules/google-auto-auth/node_modules/google-auth-library/lib/transporters.js:106:7)
Step #5 - "SetFirebaseEnvironment": at Request.self.callback (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:185:22)
Step #5 - "SetFirebaseEnvironment": at Request.emit (events.js:321:20)
Step #5 - "SetFirebaseEnvironment": at Request.EventEmitter.emit (domain.js:485:12)
Step #5 - "SetFirebaseEnvironment": at Request.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:1154:10)
Step #5 - "SetFirebaseEnvironment": at Request.emit (events.js:321:20)
Step #5 - "SetFirebaseEnvironment": at Request.EventEmitter.emit (domain.js:485:12)
Step #5 - "SetFirebaseEnvironment": at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:1076:12)
Step #5 - "SetFirebaseEnvironment": at Object.onceWrapper (events.js:427:28)
Step #5 - "SetFirebaseEnvironment": at IncomingMessage.emit (events.js:333:22)
Step #5 - "SetFirebaseEnvironment": at IncomingMessage.EventEmitter.emit (domain.js:485:12)
Step #5 - "SetFirebaseEnvironment": at endReadableNT (_stream_readable.js:1220:12)
Step #5 - "SetFirebaseEnvironment": at processTicksAndRejections (internal/process/task_queues.js:84:21)
Step #5 - "SetFirebaseEnvironment":
Step #5 - "SetFirebaseEnvironment": Error: An unexpected error has occurred.
Finished Step #5 - "SetFirebaseEnvironment"
2020/02/17 14:09:51 Step Step #5 - "SetFirebaseEnvironment" finished
2020/02/17 14:09:51 status changed to "ERROR"
ERROR
ERROR: build step 5 "eu.gcr.io/BUCKET_NAME/firebase:7.12-0" failed: exit status 2
2020/02/17 14:09:54 Build finished with ERROR status
When I run the same command on my local machine with exactly the same Firebase CLI version and Node version I dont get this error. Why do I get this error and how do a solve it?
It seems as it's fixed now (see comments to original question with links), but generally, the logic to fix such an issue is to try rebuilding firebase docker image used in cloud builder step.

Resources