ci: revert CI git cache removal (#40964)

* Revert "ci: increase "gclient sync" output timeout (#40963)"

This reverts commit be4eb4e8a7.

* Revert "build: remove CI cache of git cache (#40953)"

This reverts commit b39ebb8625.
This commit is contained in:
Keeley Hammond 2024-01-11 13:51:19 -08:00 committed by GitHub
parent be4eb4e8a7
commit e83192adba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -289,7 +289,6 @@ step-depot-tools-add-to-path: &step-depot-tools-add-to-path
step-gclient-sync: &step-gclient-sync step-gclient-sync: &step-gclient-sync
run: run:
name: Gclient sync name: Gclient sync
no_output_timeout: 30m
command: | command: |
# If we did not restore a complete sync then we need to sync for realz # If we did not restore a complete sync then we need to sync for realz
if [ ! -s "src/electron/.circle-sync-done" ]; then if [ ! -s "src/electron/.circle-sync-done" ]; then
@ -884,26 +883,44 @@ step-touch-sync-done: &step-touch-sync-done
step-maybe-restore-src-cache: &step-maybe-restore-src-cache step-maybe-restore-src-cache: &step-maybe-restore-src-cache
restore_cache: restore_cache:
keys: keys:
- v18-src-cache-{{ checksum "src/electron/.depshash" }} - v17-src-cache-{{ checksum "src/electron/.depshash" }}
name: Restoring src cache name: Restoring src cache
step-maybe-restore-src-cache-marker: &step-maybe-restore-src-cache-marker step-maybe-restore-src-cache-marker: &step-maybe-restore-src-cache-marker
restore_cache: restore_cache:
keys: keys:
- v18-src-cache-marker-{{ checksum "src/electron/.depshash" }} - v17-src-cache-marker-{{ checksum "src/electron/.depshash" }}
name: Restoring src cache marker name: Restoring src cache marker
step-maybe-restore-src-cache-aks: &step-maybe-restore-src-cache-aks step-maybe-restore-src-cache-aks: &step-maybe-restore-src-cache-aks
restore_cache_aks: restore_cache_aks:
step-name: Restoring src cache step-name: Restoring src cache
cache_key: v18-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ') cache_key: v17-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')
cache_path: /var/portal cache_path: /var/portal
step-maybe-restore-src-cache-marker-aks: &step-maybe-restore-src-cache-marker-aks step-maybe-restore-src-cache-marker-aks: &step-maybe-restore-src-cache-marker-aks
restore_cache_aks: restore_cache_aks:
step-name: Restoring src cache marker step-name: Restoring src cache marker
cache_key: v18-src-cache-marker-$(shasum src/electron/.depshash | cut -f1 -d' ') cache_key: v17-src-cache-marker-$(shasum src/electron/.depshash | cut -f1 -d' ')
cache_path: "." cache_path: "."
# Restore exact or closest git cache based on the hash of DEPS and .circle-sync-done
# If the src cache was restored above then this will match an empty cache
# If the src cache was not restored above then this will match a close git cache
step-maybe-restore-git-cache: &step-maybe-restore-git-cache
restore_cache:
paths:
- git-cache
keys:
- v1-git-cache-{{ checksum "src/electron/.circle-sync-done" }}-{{ checksum "src/electron/DEPS" }}
- v1-git-cache-{{ checksum "src/electron/.circle-sync-done" }}
name: Conditionally restoring git cache
step-maybe-restore-git-cache-aks: &step-maybe-restore-git-cache-aks
restore_cache_aks:
step-name: Conditionally restoring git cache (aks)
cache_key: v1-git-cache-$(shasum src/electron/.circle-sync-done | cut -f1 -d' ')-$(shasum src/electron/DEPS | cut -f1 -d' ') v1-git-cache-$(shasum src/electron/.circle-sync-done | cut -f1 -d' ')
cache_path: git-cache
step-set-git-cache-path: &step-set-git-cache-path step-set-git-cache-path: &step-set-git-cache-path
run: run:
name: Set GIT_CACHE_PATH to make gclient to use the cache name: Set GIT_CACHE_PATH to make gclient to use the cache
@ -912,6 +929,21 @@ step-set-git-cache-path: &step-set-git-cache-path
# https://circleci.com/docs/2.0/env-vars/#setting-an-environment-variable-in-a-shell-command # https://circleci.com/docs/2.0/env-vars/#setting-an-environment-variable-in-a-shell-command
echo 'export GIT_CACHE_PATH="$PWD/git-cache"' >> $BASH_ENV echo 'export GIT_CACHE_PATH="$PWD/git-cache"' >> $BASH_ENV
# Persist the git cache based on the hash of DEPS and .circle-sync-done
# If the src cache was restored above then this will persist an empty cache
step-save-git-cache: &step-save-git-cache
save_cache:
paths:
- git-cache
key: v1-git-cache-{{ checksum "src/electron/.circle-sync-done" }}-{{ checksum "src/electron/DEPS" }}
name: Persisting git cache
step-save-git-cache-aks: &step-save-git-cache-aks
save_cache_aks:
step-name: Persisting git cache (AKS)
cache_key: v1-git-cache-$(shasum src/electron/.circle-sync-done | cut -f1 -d' ')-$(shasum src/electron/DEPS | cut -f1 -d' ')
cache_path: git-cache
step-run-electron-only-hooks: &step-run-electron-only-hooks step-run-electron-only-hooks: &step-run-electron-only-hooks
run: run:
name: Run Electron Only Hooks name: Run Electron Only Hooks
@ -949,7 +981,7 @@ step-save-src-cache: &step-save-src-cache
save_cache: save_cache:
paths: paths:
- /var/portal - /var/portal
key: v18-src-cache-{{ checksum "/var/portal/src/electron/.depshash" }} key: v17-src-cache-{{ checksum "/var/portal/src/electron/.depshash" }}
name: Persisting src cache name: Persisting src cache
step-make-src-cache-marker: &step-make-src-cache-marker step-make-src-cache-marker: &step-make-src-cache-marker
run: run:
@ -959,16 +991,16 @@ step-save-src-cache-marker: &step-save-src-cache-marker
save_cache: save_cache:
paths: paths:
- .src-cache-marker - .src-cache-marker
key: v18-src-cache-marker-{{ checksum "/var/portal/src/electron/.depshash" }} key: v17-src-cache-marker-{{ checksum "/var/portal/src/electron/.depshash" }}
step-save-src-cache-aks: &step-save-src-cache-aks step-save-src-cache-aks: &step-save-src-cache-aks
save_cache_aks: save_cache_aks:
step-name: Persisting src cache (aks) step-name: Persisting src cache (aks)
cache_key: v18-src-cache-$(shasum /var/portal/src/electron/.depshash | cut -f1 -d' ') cache_key: v17-src-cache-$(shasum /var/portal/src/electron/.depshash | cut -f1 -d' ')
cache_path: /var/portal cache_path: /var/portal
step-save-src-cache-marker-aks: &step-save-src-cache-marker-aks step-save-src-cache-marker-aks: &step-save-src-cache-marker-aks
save_cache_aks: save_cache_aks:
step-name: Persisting src cache marker (aks) step-name: Persisting src cache marker (aks)
cache_key: v18-src-cache-marker-$(shasum /var/portal/src/electron/.depshash | cut -f1 -d' ') cache_key: v17-src-cache-marker-$(shasum /var/portal/src/electron/.depshash | cut -f1 -d' ')
cache_path: .src-cache-marker cache_path: .src-cache-marker
step-maybe-early-exit-no-doc-change: &step-maybe-early-exit-no-doc-change step-maybe-early-exit-no-doc-change: &step-maybe-early-exit-no-doc-change
@ -1345,6 +1377,9 @@ commands:
checkout-and-assume-cache: checkout-and-assume-cache:
type: boolean type: boolean
default: false default: false
save-git-cache:
type: boolean
default: false
checkout-to-create-src-cache: checkout-to-create-src-cache:
type: boolean type: boolean
default: false default: false
@ -1404,6 +1439,11 @@ commands:
- maybe-restore-portaled-src-cache: - maybe-restore-portaled-src-cache:
halt-if-successful: << parameters.checkout-to-create-src-cache >> halt-if-successful: << parameters.checkout-to-create-src-cache >>
could-be-aks: << parameters.could-be-aks >> could-be-aks: << parameters.could-be-aks >>
- aks-specific-step:
circle:
- *step-maybe-restore-git-cache
aks:
- *step-maybe-restore-git-cache-aks
could-be-aks: << parameters.could-be-aks >> could-be-aks: << parameters.could-be-aks >>
- *step-set-git-cache-path - *step-set-git-cache-path
- *step-fix-known-hosts-linux - *step-fix-known-hosts-linux
@ -1419,6 +1459,15 @@ commands:
- *step-run-electron-only-hooks - *step-run-electron-only-hooks
- *step-generate-deps-hash-cleanly - *step-generate-deps-hash-cleanly
- *step-touch-sync-done - *step-touch-sync-done
- when:
condition: << parameters.save-git-cache >>
steps:
- aks-specific-step:
circle:
- *step-save-git-cache
aks:
- *step-save-git-cache-aks
could-be-aks: << parameters.could-be-aks >>
# Mark sync as done _after_ saving the git cache so that it is uploaded # Mark sync as done _after_ saving the git cache so that it is uploaded
# only when the src cache was not present # only when the src cache was not present
# Their are theoretically two cases for this cache key # Their are theoretically two cases for this cache key
@ -1664,6 +1713,7 @@ commands:
steps: steps:
- *step-checkout-electron - *step-checkout-electron
- *step-touch-sync-done - *step-touch-sync-done
- *step-maybe-restore-git-cache
- *step-set-git-cache-path - *step-set-git-cache-path
- *step-gclient-sync - *step-gclient-sync
- *step-delete-git-directories - *step-delete-git-directories
@ -1735,6 +1785,7 @@ jobs:
persist: false persist: false
build: false build: false
checkout: true checkout: true
save-git-cache: true
checkout-to-create-src-cache: true checkout-to-create-src-cache: true
artifact-key: 'nil' artifact-key: 'nil'
build-type: 'nil' build-type: 'nil'
@ -1774,6 +1825,7 @@ jobs:
persist: false persist: false
build: false build: false
checkout: true checkout: true
save-git-cache: true
checkout-to-create-src-cache: true checkout-to-create-src-cache: true
artifact-key: 'nil' artifact-key: 'nil'
build-type: 'nil' build-type: 'nil'
@ -1793,6 +1845,7 @@ jobs:
persist: false persist: false
build: false build: false
checkout: true checkout: true
save-git-cache: true
checkout-to-create-src-cache: true checkout-to-create-src-cache: true
artifact-key: 'nil' artifact-key: 'nil'
build-type: 'nil' build-type: 'nil'