From aaa006c1dc80c29ba5b2ac368645f8e7c93290e7 Mon Sep 17 00:00:00 2001 From: Fu Chen Date: Fri, 19 May 2023 11:20:49 +0800 Subject: [PATCH] [KYUUBI #4856] [INFRA] Add `restore-keys` for `action/cache` ### _Why are the changes needed?_ add `restore-keys` to restore the most recently maven binary [github docs](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key) > restore-keys allows you to specify a list of alternate restore keys to use when there is a cache miss on key. You can create multiple restore keys ordered from the most specific to least specific. The cache action searches the restore-keys in sequential order. When a key doesn't match directly, the action searches for keys prefixed with the restore key. If there are multiple partial matches for a restore key, the action returns the most recently created cache. logs from [github action](https://github.com/apache/kyuubi/actions/runs/5020359871/jobs/9001759790?pr=4856) (after we update the file `pom.xml` hash) ``` Prepare all required actions Getting action download info Run ./.github/actions/setup-maven Run actions/cachev3 Received 0 of 8173297 (0.0%), 0.0 MBs/sec Received 8173297 of 8173297 (100.0%), 6.5 MBs/sec Cache Size: ~8 MB (8173297 B) /usr/bin/tar -xf /home/runner/work/_temp/0e0ca716-97a4-4d83-af3b-9703003cdd33/cache.tzst -P -C /home/runner/work/kyuubi/kyuubi --use-compress-program unzstd Cache restored successfully Cache restored from key: setup-maven-e425be8ee60f158fc4f40b3c6b1a51cb2896e5c97dbbe7c61a96d91380342b89 Run build/mvn -v Using `mvn` from path: /usr/bin/mvn Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39) Maven home: /usr/share/apache-maven-3.8.8 Java version: 1.8.0_362, vendor: Temurin, runtime: /usr/lib/jvm/temurin-8-jdk-amd64/jre Default locale: en, platform encoding: UTF-8 OS name: "linux", version: "5.15.0-1037-azure", arch: "amd64", family: "unix" ``` ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [x] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request Closes #4856 from cfmcgrady/ga-cache. Closes #4856 779e9030e [Fu Chen] Update .github/actions/setup-maven/action.yaml d663b1a42 [Fu Chen] Revert "test cache restore" 3d3f16013 [Fu Chen] test cache restore d2d18b613 [Fu Chen] add restore-keys Authored-by: Fu Chen Signed-off-by: Cheng Pan --- .github/actions/setup-maven/action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/setup-maven/action.yaml b/.github/actions/setup-maven/action.yaml index 4aabd401f..0cb4b54c2 100644 --- a/.github/actions/setup-maven/action.yaml +++ b/.github/actions/setup-maven/action.yaml @@ -25,6 +25,7 @@ runs: with: path: build/apache-maven-* key: setup-maven-${{ hashFiles('pom.xml') }} + restore-keys: setup-maven- - name: Install Maven shell: bash run: build/mvn -v