No description
Find a file
Nodoubtz b25b02eaac
Add Cloud Build configuration and optimizations
- Configure Cloud Build for CI/CD pipeline
- Include build steps for testing, linting, and deployment
- Optimize build process for faster execution
- Secure build environment by hiding sensitive data
- Fix errors related to build scripts and dependencies
- Improve management and execution of build tasks
- Remove duplicate codes and ensure unique build steps

This commit enhances the CI/CD pipeline, ensuring secure, efficient, and reliable cloud builds.
2025-04-04 14:37:25 -04:00
# Ignore credential files *.pem *.key *.crt *.csr *.der *.pfx *.p12 # Ignore environment files .env .env.local .env.*.local .envrc # Ignore configuration files config.yml config.yaml config.json config.js config.py # Ignore log files *.log # Ignore database files *.sqlite *.db # Ignore build files and directories /dist /build /node_modules /.next # Ignore sensitive directories /secrets /keys /credentials # Ignore temporary files *.tmp *.swp *.bak *.orig # Ignore private keys and certificates *.pem *.key # Ignore IDE files .idea/ /.vscode/ Add Cloud Build configuration and optimizations 2025-04-04 14:37:25 -04:00
.devcontainer GA for granular cache (#1035) 2022-12-21 19:38:44 +05:30
.github Create jekyll-gh-pages.yml 2025-03-21 22:42:18 -04:00
.licenses Update to use the latest version of the cache package to obfuscate the SAS 2025-03-18 07:58:36 -07:00
.vscode Initial commit 2019-10-30 14:48:49 -04:00
__tests__ added unit tests 2024-10-18 17:22:08 +00:00
dist Update to use the latest version of the cache package to obfuscate the SAS 2025-03-18 07:58:36 -07:00
restore Merge branch 'main' into todgru/v4-documentation-update 2024-08-14 12:09:56 +02:00
save docs: Make the "always save prime numbers" example more clear (#1525) 2025-01-09 23:36:56 +00:00
src appease the linter 2024-10-18 13:52:16 +00:00
starting build "38fcd5c0-407a-41d6-94ac-3a6b3d5a0693" FETCHSOURCE BUILD Starting Step #0 - "fetcher" Step #0 - "fetcher": Already have image (with digest): gcr.io/cloud-builders/gcs-fetcher Step #0 - "fetcher": WARNING: -type=Archive is deprecated; use -type=ZipArchive Step #0 - "fetcher": Fetching archive gs:/serverside-tagging/gtm-cloud-image.zip. Step #0 - "fetcher": ****************************************************** Step #0 - "fetcher": Status: SUCCESS Step #0 - "fetcher": Started: 2021-04-20T16:16:34Z Step #0 - "fetcher": Completed: 2021-04-20T16:16:34Z Step #0 - "fetcher": Total files: 2 Step #0 - "fetcher": MiB downloaded: 0.00 MiB Step #0 - "fetcher": MiB/s throughput: 0.03 MiB/s Step #0 - "fetcher": Time for zipfile: 0.05 s Step #0 - "fetcher": Time to unzip: 0.00 s Step #0 - "fetcher": Total time: 0.05 s Step #0 - "fetcher": ****************************************************** Finished Step #0 - "fetcher" Starting Step #1 - "prep" Step #1 - "prep": Already have image (with digest): gcr.io/cloud-builders/gcloud Finished Step #1 - "prep" Starting Step #2 - "pre-tag" Step #2 - "pre-tag": Pulling image: gcr.io/gae-runtimes/crane:shell Step #2 - "pre-tag": shell: Pulling from gae-runtimes/crane Step #2 - "pre-tag": 4000adbbc3eb: Pulling fs layer Step #2 - "pre-tag": 69e2f037cdb3: Pulling fs layer Step #2 - "pre-tag": e43810d8344f: Pulling fs layer Step #2 - "pre-tag": 72164b581b02: Pulling fs layer Step #2 - "pre-tag": 8250a9b721ab: Pulling fs layer Step #2 - "pre-tag": 72164b581b02: Waiting Step #2 - "pre-tag": 8250a9b721ab: Waiting Step #2 - "pre-tag": e43810d8344f: Verifying Checksum Step #2 - "pre-tag": e43810d8344f: Download complete Step #2 - "pre-tag": 4000adbbc3eb: Verifying Checksum Step #2 - "pre-tag": 4000adbbc3eb: Download complete Step #2 - "pre-tag": 69e2f037cdb3: Verifying Checksum Step #2 - "pre-tag": 69e2f037cdb3: Download complete Step #2 - "pre-tag": 72164b581b02: Verifying Checksum Step #2 - "pre-tag": 72164b581b02: Download complete Step #2 - "pre-tag": 8250a9b721ab: Verifying Checksum Step #2 - "pre-tag": 8250a9b721ab: Download complete Step #2 - "pre-tag": 4000adbbc3eb: Pull complete Step #2 - "pre-tag": 69e2f037cdb3: Pull complete Step #2 - "pre-tag": e43810d8344f: Pull complete Step #2 - "pre-tag": 72164b581b02: Pull complete Step #2 - "pre-tag": 8250a9b721ab: Pull complete Step #2 - "pre-tag": Digest: sha256:70d1c3be3db90db0bc52538557e7232bb5c4fdc16cdadf82e49739e633f6ec4e Step #2 - "pre-tag": Status: Downloaded newer image for gcr.io/gae-runtimes/crane:shell Step #2 - "pre-tag": gcr.io/gae-runtimes/crane:shell Step #2 - "pre-tag": 2021/04/20 16:16:39 Copying from us.gcr.io/gtm-kqqwvx2-zgi2z/app-engine-tmp/build-cache/ttl-7d/default/buildpack-cache:latest to us.gcr.io/gtm-kqqwvx2-zgi2z/app-engine-tmp/build-cache/ttl-7d/default/buildpack-cache:38fcd5c0-407a-41d6-94ac-3a6b3d5a0693 Step #2 - "pre-tag": 2021/04/20 16:16:41 fetching "us.gcr.io/gtm-kqqwvx2-zgi2z/app-engine-tmp/build-cache/ttl-7d/default/buildpack-cache:latest": GET https:/us.gcr.io/v2/gtm-kqqwvx2-zgi2z/app-engine-tmp/build-cache/ttl-7d/default/buildpack-cache/manifests/latest: MANIFEST_UNKNOWN: Failed to fetch "latest" from request "/v2/gtm-kqqwvx2-zgi2z/app-engine-tmp/build-cache/ttl-7d/default/buildpack-cache/manifests/latest". Step #2 - "pre-tag": Unable to tag previous cache image. This is expected for new or infrequent deployments. Step #2 - "pre-tag": 2021/04/20 16:16:41 Copying from us.gcr.io/gtm-kqqwvx2-zgi2z/app-engine-tmp/app/ttl-2h/default/buildpack-app:latest to us.gcr.io/gtm-kqqwvx2-zgi2z/app-engine-tmp/app/ttl-2h:e8d16cb3-7859-47a0-a9cd-371f627854d3 Step #2 - "pre-tag": 2021/04/20 16:16:42 fetching "us.gcr.io/gtm-kqqwvx2-zgi2z/app-engine-tmp/app/ttl-2h/default/buildpack-app:latest": GET https:/us.gcr.io/v2/gtm-kqqwvx2-zgi2z/app-engine-tmp/app/ttl-2h/default/buildpack-app/manifests/latest: MANIFEST_UNKNOWN: Failed to fetch "latest" from request "/v2/gtm-kqqwvx2-zgi2z/app-engine-tmp/app/ttl-2h/default/buildpack-app/manifests/latest". Step #2 - "pre-tag": Unable to tag previous application image. This is expected for new or infrequent deployments. Finished Step #2 - "pre-tag" Starting Step #3 - "detector" Step #3 - "detector": Pulling image: us.gcr.io/gae-runtimes/buildpacks/nodejs12/builder:nodejs12_20210322_12_21_0_RC00 Step #3 - "detector": nodejs12_20210322_12_21_0_RC00: Pulling from gae-runtimes/buildpacks/nodejs12/builder Step #3 - "detector": 9f2825a1003a: Already exists Step #3 - "detector": 7e79098fe9b4: Already exists Step #3 - "detector": 3c2cba919283: Already exists Step #3 - "detector": f646d208560e: Already exists Step #3 - "detector": 9a41a37780ff: Already exists Step #3 - "detector": 62122dc2bee3: Already exists Step #3 - "detector": 69699a8504dd: Already exists Step #3 - "detector": f6605c16d1a3: Already exists Step #3 - "detector": b26a64ba8422: Already exists Step #3 - "detector": 078f23eb819a: Already exists Step #3 - "detector": e4470417d83d: Already exists Step #3 - "detector": 3ed0d0963e38: Pulling fs layer Step #3 - "detector": da6fb28899d9: Pulling fs layer Step #3 - "detector": a9e1600a0cc7: Pulling fs layer Step #3 - "detector": 0a43b31920e2: Pulling fs layer Step #3 - "detector": 6b19e8b8e8a2: Pulling fs layer Step #3 - "detector": 1d63dc0dc5bb: Pulling fs layer Step #3 - "detector": e8d195f01c99: Pulling fs layer Step #3 - "detector": 68f3d700f361: Pulling fs layer Step #3 - "detector": 0aaf2d9f2d01: Pulling fs layer Step #3 - "detector": 2be8fbc33275: Pulling fs layer Step #3 - "detector": 9c8275a048c0: Pulling fs layer Step #3 - "detector": 06f428a8446f: Pulling fs layer Step #3 - "detector": 68eda11453ef: Pulling fs layer Step #3 - "detector": 11efd81bbe4a: Pulling fs layer Step #3 - "detector": 75c834a7bd3d: Pulling fs layer Step #3 - "detector": aaa8d30bedc4: Pulling fs layer Step #3 - "detector": 47e9e73689c7: Pulling fs layer Step #3 - "detector": da9a267cf32b: Pulling fs layer Step #3 - "detector": 66e330c268aa: Pulling fs layer Step #3 - "detector": d716a8de5ec7: Pulling fs layer Step #3 - "detector": a81848cc08a6: Pulling fs layer Step #3 - "detector": 4f4fb700ef54: Pulling fs layer Step #3 - "detector": 1d63dc0dc5bb: Waiting Step #3 - "detector": e8d195f01c99: Waiting Step #3 - "detector": 68f3d700f361: Waiting Step #3 - "detector": 0aaf2d9f2d01: Waiting Step #3 - "detector": 2be8fbc33275: Waiting Step #3 - "detector": 9c8275a048c0: Waiting Step #3 - "detector": 06f428a8446f: Waiting Step #3 - "detector": 68eda11453ef: Waiting Step #3 - "detector": 11efd81bbe4a: Waiting Step #3 - "detector": 75c834a7bd3d: Waiting Step #3 - "detector": aaa8d30bedc4: Waiting Step #3 - "detector": 47e9e73689c7: Waiting Step #3 - "detector": da9a267cf32b: Waiting Step #3 - "detector": 66e330c268aa: Waiting Step #3 - "detector": d716a8de5ec7: Waiting Step #3 - "detector": a81848cc08a6: Waiting Step #3 - "detector": 4f4fb700ef54: Waiting Step #3 - "detector": 6b19e8b8e8a2: Waiting Step #3 - "detector": 0a43b31920e2: Waiting Step #3 - "detector": 3ed0d0963e38: Verifying Checksum Step #3 - "detector": 3ed0d0963e38: Download complete Step #3 - "detector": da6fb28899d9: Verifying Checksum Step #3 - "detector": da6fb28899d9: Download complete Step #3 - "detector": 3ed0d0963e38: Pull complete Step #3 - "detector": 6b19e8b8e8a2: Verifying Checksum Step #3 - "detector": 6b19e8b8e8a2: Download complete Step #3 - "detector": da6fb28899d9: Pull complete Step #3 - "detector": a9e1600a0cc7: Verifying Checksum Step #3 - "detector": a9e1600a0cc7: Download complete Step #3 - "detector": 0a43b31920e2: Verifying Checksum Step #3 - "detector": 0a43b31920e2: Download complete Step #3 - "detector": e8d195f01c99: Verifying Checksum Step #3 - "detector": e8d195f01c99: Download complete Step #3 - "detector": 1d63dc0dc5bb: Verifying Checksum Step #3 - "detector": 1d63dc0dc5bb: Download complete Step #3 - "detector": 0aaf2d9f2d01: Verifying Checksum Step #3 - "detector": 0aaf2d9f2d01: Download complete Step #3 - "detector": 68f3d700f361: Verifying Checksum Step #3 - "detector": 68f3d700f361: Download complete Step #3 - "detector": a9e1600a0cc7: Pull complete Step #3 - "detector": 2be8fbc33275: Download complete Step #3 - "detector": 06f428a8446f: Download complete Step #3 - "detector": 9c8275a048c0: Download complete Step #3 - "detector": 68eda11453ef: Verifying Checksum Step #3 - "detector": 68eda11453ef: Download complete Step #3 - "detector": 75c834a7bd3d: Verifying Checksum Step #3 - "detector": 75c834a7bd3d: Download complete Step #3 - "detector": 11efd81bbe4a: Verifying Checksum Step #3 - "detector": 11efd81bbe4a: Download complete Step #3 - "detector": aaa8d30bedc4: Verifying Checksum Step #3 - "detector": aaa8d30bedc4: Download complete Step #3 - "detector": 47e9e73689c7: Verifying Checksum Step #3 - "detector": 47e9e73689c7: Download complete Step #3 - "detector": da9a267cf32b: Verifying Checksum Step #3 - "detector": da9a267cf32b: Download complete Step #3 - "detector": 66e330c268aa: Verifying Checksum Step #3 - "detector": 66e330c268aa: Download complete Step #3 - "detector": 4f4fb700ef54: Verifying Checksum Step #3 - "detector": 4f4fb700ef54: Download complete Step #3 - "detector": a81848cc08a6: Verifying Checksum Step #3 - "detector": a81848cc08a6: Download complete Step #3 - "detector": d716a8de5ec7: Verifying Checksum Step #3 - "detector": d716a8de5ec7: Download complete Step #3 - "detector": 0a43b31920e2: Pull complete Step #3 - "detector": 6b19e8b8e8a2: Pull complete Step #3 - "detector": 1d63dc0dc5bb: Pull complete Step #3 - "detector": e8d195f01c99: Pull complete Step #3 - "detector": 68f3d700f361: Pull complete Step #3 - "detector": 0aaf2d9f2d01: Pull complete Step #3 - "detector": 2be8fbc33275: Pull complete Step #3 - "detector": 9c8275a048c0: Pull complete Step #3 - "detector": 06f428a8446f: Pull complete Step #3 - "detector": 68eda11453ef: Pull complete Step #3 - "detector": 11efd81bbe4a: Pull complete Step #3 - "detector": 75c834a7bd3d: Pull complete Step #3 - "detector": aaa8d30bedc4: Pull complete Step #3 - "detector": 47e9e73689c7: Pull complete Step #3 - "detector": da9a267cf32b: Pull complete Step #3 - "detector": 66e330c268aa: Pull complete Step #3 - "detector": d716a8de5ec7: Pull complete Step #3 - "detector": a81848cc08a6: Pull complete Step #3 - "detector": 4f4fb700ef54: Pull complete Step #3 - "detector": Digest: sha256:6d033da520b0f2631be09969c7a32409a8ce666f09ed9d5b3e13480125ef85f6 Step #3 - "detector": Status: Downloaded newer image for us.gcr.io/gae-runtimes/buildpacks/nodejs12/builder:nodejs12_20210322_12_21_0_RC00 Step #3 - "detector": us.gcr.io/gae-runtimes/buildpacks/nodejs12/builder:nodejs12_20210322_12_21_0_RC00 Step #3 - "detector": ======== Output: google.nodejs.yarn-gcp-build@0.9.0 ======== Step #3 - "detector": Opting out: yarn.lock not found Step #3 - "detector": ======== Output: google.nodejs.yarn@0.9.0 ======== Step #3 - "detector": Opting out: yarn.lock not found Step #3 - "detector": ======== Output: google.nodejs.appengine@0.9.0 ======== Step #3 - "detector": Opting in: always enabled Step #3 - "detector": ======== Output: google.utils.label@0.0.1 ======== Step #3 - "detector": Opting in: always enabled Step #3 - "detector": ======== Results ======== Step #3 - "detector": skip: google.nodejs.yarn-gcp-build@0.9.0 Step #3 - "detector": fail: google.nodejs.yarn@0.9.0 Step #3 - "detector": pass: google.nodejs.appengine@0.9.0 Step #3 - "detector": pass: google.utils.label@0.0.1 Step #3 - "detector": ======== Output: google.nodejs.npm-gcp-build@0.9.0 ======== Step #3 - "detector": Opting out: gcp-build script not found in package.json Step #3 - "detector": ======== Output: google.nodejs.npm@0.9.0 ======== Step #3 - "detector": Opting in: found package.json Step #3 - "detector": ======== Output: google.nodejs.appengine@0.9.0 ======== Step #3 - "detector": Opting in: always enabled Step #3 - "detector": ======== Output: google.utils.label@0.0.1 ======== Step #3 - "detector": Opting in: always enabled Step #3 - "detector": ======== Results ======== Step #3 - "detector": skip: google.nodejs.npm-gcp-build@0.9.0 Step #3 - "detector": pass: google.nodejs.npm@0.9.0 Step #3 - "detector": pass: google.nodejs.appengine@0.9.0 Step #3 - "detector": pass: google.utils.label@0.0.1 Step #3 - "detector": Resolving plan... (try #1) Step #3 - "detector": 3 of 4 buildpacks participating Step #3 - "detector": google.nodejs.npm 0.9.0 Step #3 - "detector": google.nodejs.appengine 0.9.0 Step #3 - "detector": google.utils.label 0.0.1 Finished Step #3 - "detector" Starting Step #4 - "analyzer" Step #4 - "analyzer": Already have image (with digest): us.gcr.io/gae-runtimes/buildpacks/nodejs12/builder:nodejs12_20210322_12_21_0_RC00 Step #4 - "analyzer": Previous image with name "us.gcr.io/gtm-kqqwvx2-zgi2z/app-engine-tmp/app/ttl-2h:e8d16cb3-7859-47a0-a9cd-371f627854d3" not found Step #4 - "analyzer": Layer cache not found Finished Step #4 - "analyzer" Starting Step #5 - "restorer" Step #5 - "restorer": Already have image (with digest): us.gcr.io/gae-runtimes/buildpacks/nodejs12/builder:nodejs12_20210322_12_21_0_RC00 Step #5 - "restorer": Layer cache not found Finished Step #5 - "restorer" Starting Step #6 - "builder" Step #6 - "builder": Already have image (with digest): us.gcr.io/gae-runtimes/buildpacks/nodejs12/builder:nodejs12_20210322_12_21_0_RC00 Step #6 - "builder": === Node.js - NPM (google.nodejs.npm@0.9.0) === Step #6 - "builder": Generating package-lock.json. Step #6 - "builder": WARNING: *** Improve build performance by generating and committing package-lock.json. Step #6 - "builder": -------------------------------------------------------------------------------- Step #6 - "builder": Running "npm install --package-lock-only --quiet" Step #6 - "builder": npm WARN gtm-cloud-image@1.0.1 No description Step #6 - "builder": npm WARN gtm-cloud-image@1.0.1 No repository field. Step #6 - "builder": npm WARN gtm-cloud-image@1.0.1 No license field. Step #6 - "builder": Step #6 - "builder": added 55 packages and audited 55 packages in 1.974s Step #6 - "builder": found 0 vulnerabilities Step #6 - "builder": Step #6 - "builder": Done "npm install --package-lock-only --quiet" (2.572096581s) Step #6 - "builder": -------------------------------------------------------------------------------- Step #6 - "builder": Running "node -v" Step #6 - "builder": v12.21.0 Step #6 - "builder": Done "node -v" (6.166259ms) Step #6 - "builder": DEBUG: Current dependency hash: "3e414bb5cf9919affaa95ad1558323cda6b98067aa5cb8d8afda37a96081518d" Step #6 - "builder": DEBUG: Cache dependency hash: "" Step #6 - "builder": DEBUG: No metadata found from a previous build, skipping cache. Step #6 - "builder": Installing application dependencies. Step #6 - "builder": DEBUG: ***** CACHE MISS: "prod dependencies" Step #6 - "builder": -------------------------------------------------------------------------------- Step #6 - "builder": Running "node -v" Step #6 - "builder": v12.21.0 Step #6 - "builder": Done "node -v" (5.336197ms) Step #6 - "builder": -------------------------------------------------------------------------------- Step #6 - "builder": Running "npm ci --quiet (NODE_ENV=production)" Step #6 - "builder": added 55 packages in 0.627s Step #6 - "builder": Done "npm ci --quiet (NODE_ENV=production)" (1.120123648s) Step #6 - "builder": -------------------------------------------------------------------------------- Step #6 - "builder": Running "cp --archive node_modules /layers/google.nodejs.npm/npm/node_modules" Step #6 - "builder": Done "cp --archive node_modules /layers/google.nodejs.npm/npm/node..." (52.943054ms) Step #6 - "builder": === Node.js - App Engine (google.nodejs.appengine@0.9.0) === Step #6 - "builder": DEBUG: Using GOOGLE_RUNTIME: nodejs12 Step #6 - "builder": DEBUG: Using config appstart.Config{Runtime:"nodejs12", Entrypoint:appstart.Entrypoint{Type:"Default", Command:"/serve", WorkDir:""}, MainExecutable:""} Step #6 - "builder": === Utils - Label Image (google.utils.label@0.0.1) === Finished Step #6 - "builder" Starting Step #7 - "exporter" Step #7 - "exporter": Already have image (with digest): us.gcr.io/gae-runtimes/buildpacks/nodejs12/builder:nodejs12_20210322_12_21_0_RC00 Step #7 - "exporter": no project metadata found at path 'project-metadata.toml', project metadata will not be exported Step #7 - "exporter": Reusing tarball for layer "google.nodejs.npm:env" with SHA: sha256:378501f12998bc53bf6ac6aa40e4b2de42ebb6ffb8bb70b310b6b548e1f1b7a7 Step #7 - "exporter": Adding layer 'google.nodejs.npm:env' Step #7 - "exporter": Layer 'google.nodejs.npm:env' SHA: sha256:378501f12998bc53bf6ac6aa40e4b2de42ebb6ffb8bb70b310b6b548e1f1b7a7 Step #7 - "exporter": Reusing tarball for layer "google.nodejs.appengine:config" with SHA: sha256:1c1283fba155448b1a2aa72ec9d7b8ff93dfc9498279abda0e1e4bd4168b3e68 Step #7 - "exporter": Adding layer 'google.nodejs.appengine:config' Step #7 - "exporter": Layer 'google.nodejs.appengine:config' SHA: sha256:1c1283fba155448b1a2aa72ec9d7b8ff93dfc9498279abda0e1e4bd4168b3e68 Step #7 - "exporter": Layer 'slice-1' SHA: sha256:5493fd1cc210604581c4880934c4907a2b17667216226d98d636b5a24176b4a1 Step #7 - "exporter": Adding 1/1 app layer(s) Step #7 - "exporter": Reusing tarball for layer "launcher" with SHA: sha256:576e5f5696c6fcae9b679dca450d7ab127176f5c529bc9790b42abb9e3658cfa Step #7 - "exporter": Adding layer 'launcher' Step #7 - "exporter": Layer 'launcher' SHA: sha256:576e5f5696c6fcae9b679dca450d7ab127176f5c529bc9790b42abb9e3658cfa Step #7 - "exporter": Reusing tarball for layer "config" with SHA: sha256:89eee30774480a887409462a2e2de16f6d021fa8cd97270eeb3311449d4e71ca Step #7 - "exporter": Adding layer 'config' Step #7 - "exporter": Layer 'config' SHA: sha256:89eee30774480a887409462a2e2de16f6d021fa8cd97270eeb3311449d4e71ca Step #7 - "exporter": Adding label 'io.buildpacks.lifecycle.metadata' Step #7 - "exporter": Adding label 'io.buildpacks.build.metadata' Step #7 - "exporter": Adding label 'io.buildpacks.project.metadata' Step #7 - "exporter": Adding label 'google.builder-version' Step #7 - "exporter": Setting CNB_LAYERS_DIR=/layers Step #7 - "exporter": Setting CNB_APP_DIR=/workspace Step #7 - "exporter": Setting CNB_PLATFORM_API=0.3 Step #7 - "exporter": Setting CNB_DEPRECATION_MODE=quiet Step #7 - "exporter": Setting ENTRYPOINT: '/cnb/lifecycle/launcher' Step #7 - "exporter": *** Images (sha256:949ecef4dc7dacbcd9e252baf64f63abbb064911a01341be4a8da53c9aeab919): Step #7 - "exporter": us.gcr.io/gtm-kqqwvx2-zgi2z/app-engine-tmp/app/ttl-2h:e8d16cb3-7859-47a0-a9cd-371f627854d3 Step #7 - "exporter": Step #7 - "exporter": *** Digest: sha256:949ecef4dc7dacbcd9e252baf64f63abbb064911a01341be4a8da53c9aeab919 Step #7 - "exporter": Layer cache not found Step #7 - "exporter": Adding cache layer 'google.nodejs.npm:npm' Step #7 - "exporter": Layer 'google.nodejs.npm:npm' SHA: sha256:2d15730e3fab61a6b76c8f1802bd178d0e6e5c1fdc2b006f119383d8b5d83f8c Finished Step #7 - "exporter" Starting Step #8 - "post-tag" Step #8 - "post-tag": Pulling image: gcr.io/gae-runtimes/crane:current Step #8 - "post-tag": current: Pulling from gae-runtimes/crane Step #8 - "post-tag": Digest: sha256:f03a2c63b1ea0cebcd22b14b0fb9161b5856e3055d5116e54b0bf751c62f278d Step #8 - "post-tag": Status: Downloaded newer image for gcr.io/gae-runtimes/crane:current Step #8 - "post-tag": gcr.io/gae-runtimes/crane:current Step #8 - "post-tag": 2021/04/20 16:17:16 Pulling us.gcr.io/gtm-kqqwvx2-zgi2z/app-engine-tmp/app/ttl-2h:e8d16cb3-7859-47a0-a9cd-371f627854d3 Step #8 - "post-tag": 2021/04/20 16:17:16 Pushing us.gcr.io/gtm-kqqwvx2-zgi2z/app-engine-tmp/app/ttl-2h/default/buildpack-app:latest Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:5b89393b60457d7c98044822c48e7bd84d9c89c35e9a38a294ef37a04382563a Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:f12ca902989a9af80ab93eba77cb5b9cc9cdad2248fd403c17fad6f20780b6b3 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:0d9623ae2019c5ec82f46525aee58bcaec794b633532a2c3436fbbab752da671 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:ec3bc56b1a2f716645696791b218204173344b6f4170bf40ff68857fe2dfa7e0 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:1e8fba40a6793b451d3d7f933de4d4d7f81a051e657a05fed03ff8570afe3d36 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:c9c950d755c2c9c59f90490c4544d91a2ab6028af17d70413612a8d874e77494 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:35499b6cb8a6cc1af12c7f89bb3181a4a8fcf8e2dce3ae45dc960ef9ef475761 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:d6fa2741ceb247a566aaa8f394838ff424b92a42f217f510e7291dadc8e868b2 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:8ddfe3ca51b685e05d1009dfb22de11b3bf47af9bfec9557b9d317435df36193 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:bc71512691bfc6afb8eed4e89ea0438e8029978683e6aadfb7b3e00841d98bfc Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:29e536fccebc96b1cf38f27918a0fc79f5e150fcd804bcf83a6c85b1be5d5b51 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:6216d8dd4b8767e83cd270ecd734ebebc32858f13c03bb9737dec69c7e672239 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:c0a93c3c44f42b9ce55888a2cac2cfd15e27db7bb8fbc73671ca4424308071c4 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:38388c02704cb52a856a47b8c6f8a65daa67c090bd0555264d5c492802b72274 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:700015da93a828fa0affb362c6c244f1a2af6e93656aaa136c38e6643479b032 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:312fed76fab86b9419351fc54d923fea4e789558e5e2207d26b104892485ec81 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:049ccbff6a5357f7f5862515bb66a8008682c2cfa0a1df45eb322d181a180519 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:2085bee30fcfef189d413727587c6524bce3faa1b8bbf96e6fd6a520bd6f2ea0 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:977886e5d19d432f51378fef21757e499d5d1aff3a33fdd77bdeccb3feba1a05 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:e5a7d56ab97c611070445a48f2729e2460d46a97c3aae2ade70ff60cc82d60e8 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:a476ea4db8111ae2488d3dbd1b05f510e9e42e637f8e1007fb95b2cf3520a21f Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:d531490c83f5a0694ce809c0ff0628e2374ca4b8ac3e348a89b4a20ac0b68b3d Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:27db413a8ba92075e6af9eee1e9cc535f27afb2293e6dd40f59a658341d8fcc8 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:2877c4e0b5d1420b9473b14d0023e8d87107ff3f24582c799f409975a04c7429 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:5c65d0212e45b115a195673c30dca94f5a7337df5beb7cea7dcdbd6707dab089 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:2b77546a9489a653ad05a034d6c7be01e586a0be6b09a2b2385f340ebe539d08 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:b557dbd91413856ec087fa04f3dfe638df8065814a510b83916bbb3454bc04ce Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:a967fd7500d21521acb1ca34a086e884f66888ea85fc2e02eaa187277099aa29 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:d0911dfa6aecbe959a7699f54211f812e91962e71d21fd7c6afe0451736e2a7a Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:cb983dcdc03f0b98ccdb7c6d6d581fbd34c72aa55dae066d82778bd0d59bf599 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:3c2cba919283a210665e480bcbf943eaaf4ed87a83f02e81bb286b8bdead0e75 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:984c5458661774af1f695f2218ebe6a909a81ef1baefbe444e2717d6b0280f3d Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:bfd8e3c1dbf591fe937abcbe896554f19190e09cacab45f281ff4761b5313fc0 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:dac7a713bad16dc606168d7229cdf017a863edfeb5160dada164e356614ff7e7 Step #8 - "post-tag": 2021/04/20 16:17:17 existing blob: sha256:34e4253f734351aa03d64ad011ecfe127bf4b4a3a9d0e4eae8ec09e2ae67edc0 Step #8 - "post-tag": 2021/04/20 16:17:18 us.gcr.io/gtm-kqqwvx2-zgi2z/app-engine-tmp/app/ttl-2h/default Add Cloud Build configuration and optimizations 2025-04-04 14:37:25 -04:00
.eslintrc.json Update eslint and prettier 2022-01-31 12:55:11 +05:30
.gitattributes Fix line ending for windows test 2022-01-31 13:00:27 +05:30
.gitignore test e2e during workflow (#185) 2020-02-13 12:38:56 -05:00
.licensed.yml Add licensed output 2024-12-04 13:44:43 -08:00
.prettierrc.json Initial commit 2019-10-30 14:48:49 -04:00
action.yml Update action.yml 2025-03-18 12:46:24 -04:00
caching-strategies.md Correct GitHub Spelling in caching-strategies.md (#1526) 2025-01-06 16:55:00 +00:00
CODE_OF_CONDUCT.md Fix repo name in contact email (#41) 2019-11-03 09:38:45 -05:00
CONTRIBUTING.md Update contributing.md 2020-09-23 17:07:50 -04:00
examples.md Add Bun example (#1456) 2024-10-08 19:53:09 +00:00
jest.config.js Resolve dependabot alerts 2022-01-31 12:06:04 +05:30
Latency_by_API_method_(median) (14).csv Update Latency_by_API_method_(median) (14).csv 2025-04-04 14:10:49 -04:00
LICENSE Initial commit 2019-10-30 14:48:49 -04:00
log-38fcd5c0-407a-41d6-94ac-3a6b3d5a0693.txt Add files via upload 2025-04-04 14:29:40 -04:00
method,google.devtools.cloudbuild.v1.CloudBuild.GetDefaultServiceAccount,google.devtools.cloudbuild.v1.CloudBuild.ListWorkerPools project_id,gtm-kqqwvx2-zgi2z,gtm-kqqwvx2-zgi2z Sat Mar 08 2025 17:00:00 GMT-0500 (Eastern Standard Time),0.00009259259259259259,0.00009259259259259259 Sat Mar 15 2025 12:00:00 GMT-0400 (Eastern Daylight Time),0.00009259259259259259,0.00009259259259259259 Wed Mar 19 2025 12:00:00 GMT-0400 (Eastern Daylight Time),0.0012037037037037036,undefined Wed Mar 19 2025 15:00:00 GMT-0400 (Eastern Daylight Time),0.00018518518518518518,undefined Wed Mar 19 2025 18:00:00 GMT-0400 (Eastern Daylight Time),0.00009259259259259259,undefined Thu Mar 20 2025 09:00:00 GMT-0400 (Eastern Daylight Time),0.00018518518518518518,undefined Sat Mar 22 2025 12:00:00 GMT-0400 (Eastern Daylight Time),0.00009259259259259259,undefined Sun Mar 23 2025 00:00:00 GMT-0400 (Eastern Daylight Time),0.00018518518518518518,undefined Thu Mar 27 2025 12:00:00 GMT-0400 (Eastern Daylight Time),0.00018518518518518518,undefined Thu Mar 27 2025 15:00:00 GMT-0400 (Eastern Daylight Time),0.0002777777777777778,undefined Update Traffic_by_API_method (15).csv 2025-04-04 14:16:29 -04:00
package-lock.json Update to use the latest version of the cache package to obfuscate the SAS 2025-03-18 07:58:36 -07:00
package.json Update to use the latest version of the cache package to obfuscate the SAS 2025-03-18 07:58:36 -07:00
project_id,gtm-kqqwvx2-zgi2z,gtm-kqqwvx2-zgi2z method,google.devtools.cloudbuild.v1.CloudBuild.GetDefaultServiceAccount,google.devtools.cloudbuild.v1.CloudBuild.ListWorkerPools Sat Mar 08 2025 17:00:00 GMT-0500 (Eastern Standard Time),0.196608,0.049152 Sat Mar 15 2025 12:00:00 GMT-0400 (Eastern Daylight Time),0.098304,0.049152 Wed Mar 19 2025 12:00:00 GMT-0400 (Eastern Daylight Time),0.10426181818181818,undefined Wed Mar 19 2025 15:00:00 GMT-0400 (Eastern Daylight Time),0.065536,undefined Wed Mar 19 2025 18:00:00 GMT-0400 (Eastern Daylight Time),0.098304,undefined Thu Mar 20 2025 09:00:00 GMT-0400 (Eastern Daylight Time),0.098304,undefined Sat Mar 22 2025 12:00:00 GMT-0400 (Eastern Daylight Time),0.098304,undefined Sun Mar 23 2025 00:00:00 GMT-0400 (Eastern Daylight Time),0.196608,undefined Thu Mar 27 2025 12:00:00 GMT-0400 (Eastern Daylight Time),0.098304,undefined Thu Mar 27 2025 15:00:00 GMT-0400 (Eastern Daylight Time),0.114688,undefined Update Traffic_by_API_method (15).csv 2025-04-04 14:16:29 -04:00
README.md Add 3.4.0 release notes 2024-12-05 04:30:22 -08:00
RELEASES.md Update releases.md 2025-03-18 08:00:50 -07:00
tips-and-workarounds.md Update force deletion docs due a recent deprecation (#1500) 2025-02-12 10:49:34 -05:00
Traffic_by_API_method (15).csv Update Traffic_by_API_method (15).csv 2025-04-04 14:13:41 -04:00
tsconfig.json Initial commit 2019-10-30 14:48:49 -04:00
Windy Create Windy 2025-03-18 12:55:16 -04:00

Cache action

This action allows caching dependencies and build outputs to improve workflow execution time.

Two other actions are available in addition to the primary cache action:

Tests

Documentation

See "Caching dependencies to speed up workflows".

What's New

⚠️ Important changes

The cache backend service has been rewritten from the ground up for improved performance and reliability. actions/cache now integrates with the new cache service (v2) APIs.

The new service will gradually roll out as of February 1st, 2025. The legacy service will also be sunset on the same date. Changes in these release are fully backward compatible.

We are deprecating some versions of this action. We recommend upgrading to version v4 or v3 as soon as possible before February 1st, 2025. (Upgrade instructions below).

If you are using pinned SHAs, please use the SHAs of versions v4.2.0 or v3.4.0

If you do not upgrade, all workflow runs using any of the deprecated actions/cache will fail.

Upgrading to the recommended versions will not break your workflows.

Read more about the change & access the migration guide: reference to the announcement.

v4

  • Integrated with the new cache service (v2) APIs.
  • Updated to node 20

v3

  • Integrated with the new cache service (v2) APIs.
  • Added support for caching in GHES 3.5+.
  • Fixed download issue for files > 2GB during restore.
  • Updated the minimum runner version support from node 12 -> node 16.
  • Fixed avoiding empty cache save when no files are available for caching.
  • Fixed tar creation error while trying to create tar with path as ~/ home folder on ubuntu-latest.
  • Fixed zstd failing on amazon linux 2.0 runners.
  • Fixed cache not working with github workspace directory or current directory.
  • Fixed the download stuck problem by introducing a timeout of 1 hour for cache downloads.
  • Fix zstd not working for windows on gnu tar in issues.
  • Allowing users to provide a custom timeout as input for aborting download of a cache segment using an environment variable SEGMENT_DOWNLOAD_TIMEOUT_MINS. Default is 10 minutes.
  • New actions are available for granular control over caches - restore and save.
  • Support cross-os caching as an opt-in feature. See Cross OS caching for more info.
  • Added option to fail job on cache miss. See Exit workflow on cache miss for more info.
  • Fix zstd not being used after zstd version upgrade to 1.5.4 on hosted runners
  • Added option to lookup cache without downloading it.
  • Reduced segment size to 128MB and segment timeout to 10 minutes to fail fast in case the cache download is stuck.

See the v2 README.md for older updates.

Usage

Pre-requisites

Create a workflow .yml file in your repository's .github/workflows directory. An example workflow is available below. For more information, see the GitHub Help Documentation for Creating a workflow file.

If you are using this inside a container, a POSIX-compliant tar needs to be included and accessible from the execution path.

If you are using a self-hosted Windows runner, GNU tar and zstd are required for Cross-OS caching to work. They are also recommended to be installed in general so the performance is on par with hosted Windows runners.

Inputs

  • key - An explicit key for a cache entry. See creating a cache key.
  • path - A list of files, directories, and wildcard patterns to cache and restore. See @actions/glob for supported patterns.
  • restore-keys - An ordered multiline string listing the prefix-matched keys, that are used for restoring stale cache if no cache hit occurred for key.
  • enableCrossOsArchive - An optional boolean when enabled, allows Windows runners to save or restore caches that can be restored or saved respectively on other platforms. Default: false
  • fail-on-cache-miss - Fail the workflow if cache entry is not found. Default: false
  • lookup-only - If true, only checks if cache entry exists and skips download. Does not change save cache behavior. Default: false

Environment Variables

  • SEGMENT_DOWNLOAD_TIMEOUT_MINS - Segment download timeout (in minutes, default 10) to abort download of the segment if not completed in the defined number of minutes. Read more

Outputs

  • cache-hit - A string value to indicate an exact match was found for the key.
    • If there's a cache hit, this will be 'true' or 'false' to indicate if there's an exact match for key.
    • If there's a cache miss, this will be an empty string.

See Skipping steps based on cache-hit for info on using this output

Cache scopes

The cache is scoped to the key, version, and branch. The default branch cache is available to other branches.

See Matching a cache key for more info.

Example cache workflow

Restoring and saving cache using a single action

name: Caching Primes

on: push

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4

    - name: Cache Primes
      id: cache-primes
      uses: actions/cache@v4
      with:
        path: prime-numbers
        key: ${{ runner.os }}-primes

    - name: Generate Prime Numbers
      if: steps.cache-primes.outputs.cache-hit != 'true'
      run: /generate-primes.sh -d prime-numbers

    - name: Use Prime Numbers
      run: /primes.sh -d prime-numbers

The cache action provides a cache-hit output which is set to true when the cache is restored using the primary key and false when the cache is restored using restore-keys or no cache is restored.

Using a combination of restore and save actions

name: Caching Primes

on: push

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4

    - name: Restore cached Primes
      id: cache-primes-restore
      uses: actions/cache/restore@v4
      with:
        path: |
          path/to/dependencies
          some/other/dependencies
        key: ${{ runner.os }}-primes
    .
    . //intermediate workflow steps
    .
    - name: Save Primes
      id: cache-primes-save
      uses: actions/cache/save@v4
      with:
        path: |
          path/to/dependencies
          some/other/dependencies
        key: ${{ steps.cache-primes-restore.outputs.cache-primary-key }}

Note

You must use the cache or restore action in your workflow before you need to use the files that might be restored from the cache. If the provided key matches an existing cache, a new cache is not created and if the provided key doesn't match an existing cache, a new cache is automatically created provided the job completes successfully.

Caching Strategies

With the introduction of the restore and save actions, a lot of caching use cases can now be achieved. Please see the caching strategies document for understanding how you can use the actions strategically to achieve the desired goal.

Implementation Examples

Every programming language and framework has its own way of caching.

See Examples for a list of actions/cache implementations for use with:

Creating a cache key

A cache key can include any of the contexts, functions, literals, and operators supported by GitHub Actions.

For example, using the hashFiles function allows you to create a new cache when dependencies change.

  - uses: actions/cache@v4
    with:
      path: |
        path/to/dependencies
        some/other/dependencies
      key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

Additionally, you can use arbitrary command output in a cache key, such as a date or software version:

  # http://man7.org/linux/man-pages/man1/date.1.html
  - name: Get Date
    id: get-date
    run: |
      echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
    shell: bash

  - uses: actions/cache@v4
    with:
      path: path/to/dependencies
      key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/lockfiles') }}

See Using contexts to create cache keys

Cache Limits

A repository can have up to 10GB of caches. Once the 10GB limit is reached, older caches will be evicted based on when the cache was last accessed. Caches that are not accessed within the last week will also be evicted.

Skipping steps based on cache-hit

Using the cache-hit output, subsequent steps (such as install or build) can be skipped when a cache hit occurs on the key. It is recommended to install missing/updated dependencies in case of a partial key match when the key is dependent on the hash of the package file.

Example:

steps:
  - uses: actions/checkout@v4

  - uses: actions/cache@v4
    id: cache
    with:
      path: path/to/dependencies
      key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

  - name: Install Dependencies
    if: steps.cache.outputs.cache-hit != 'true'
    run: /install.sh

Note

The id defined in actions/cache must match the id in the if statement (i.e. steps.[ID].outputs.cache-hit)

Cache Version

Cache version is a hash generated for a combination of compression tool used (Gzip, Zstd, etc. based on the runner OS) and the path of directories being cached. If two caches have different versions, they are identified as unique caches while matching. This, for example, means that a cache created on a windows-latest runner can't be restored on ubuntu-latest as cache Versions are different.

Pro tip: The list caches API can be used to get the version of a cache. This can be helpful to troubleshoot cache miss due to version.

Example The workflow will create 3 unique caches with same keys. Ubuntu and windows runners will use different compression technique and hence create two different caches. And `build-linux` will create two different caches as the `paths` are different.
jobs:
  build-linux:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Cache Primes
        id: cache-primes
        uses: actions/cache@v4
        with:
          path: prime-numbers
          key: primes

      - name: Generate Prime Numbers
        if: steps.cache-primes.outputs.cache-hit != 'true'
        run: ./generate-primes.sh -d prime-numbers

      - name: Cache Numbers
        id: cache-numbers
        uses: actions/cache@v4
        with:
          path: numbers
          key: primes

      - name: Generate Numbers
        if: steps.cache-numbers.outputs.cache-hit != 'true'
        run: ./generate-primes.sh -d numbers

  build-windows:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v4

      - name: Cache Primes
        id: cache-primes
        uses: actions/cache@v4
        with:
          path: prime-numbers
          key: primes

      - name: Generate Prime Numbers
        if: steps.cache-primes.outputs.cache-hit != 'true'
        run: ./generate-primes -d prime-numbers

Known practices and workarounds

There are a number of community practices/workarounds to fulfill specific requirements. You may choose to use them if they suit your use case. Note these are not necessarily the only solution or even a recommended solution.

Windows environment variables

Please note that Windows environment variables (like %LocalAppData%) will NOT be expanded by this action. Instead, prefer using ~ in your paths which will expand to the HOME directory. For example, instead of %LocalAppData%, use ~\AppData\Local. For a list of supported default environment variables, see the Learn GitHub Actions: Variables page.

Contributing

We would love for you to contribute to actions/cache. Pull requests are welcome! Please see the CONTRIBUTING.md for more information.

License

The scripts and documentation in this project are released under the MIT License