Avoid caching of Keycloak artifacts (#17465)
Also, only create the cache on build, not when running the tests Closes #17461
This commit is contained in:
parent
837c64de3d
commit
4bfa3c7a1a
2 changed files with 29 additions and 18 deletions
11
.github/actions/build-keycloak/action.yml
vendored
11
.github/actions/build-keycloak/action.yml
vendored
|
@ -32,6 +32,8 @@ runs:
|
||||||
- id: maven-cache
|
- id: maven-cache
|
||||||
name: Maven cache
|
name: Maven cache
|
||||||
uses: ./.github/actions/maven-cache
|
uses: ./.github/actions/maven-cache
|
||||||
|
with:
|
||||||
|
create-cache-if-it-doesnt-exist: true
|
||||||
|
|
||||||
- id: phantomjs-cache
|
- id: phantomjs-cache
|
||||||
name: PhantomJS cache
|
name: PhantomJS cache
|
||||||
|
@ -44,9 +46,10 @@ runs:
|
||||||
- id: build-keycloak
|
- id: build-keycloak
|
||||||
name: Build Keycloak
|
name: Build Keycloak
|
||||||
shell: bash
|
shell: bash
|
||||||
|
# By using "dependency:resolve", it will download all dependencies used in later stages for running the tests
|
||||||
run: |
|
run: |
|
||||||
MVN_HTTP_CONFIG="-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120"
|
MVN_HTTP_CONFIG="-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120"
|
||||||
./mvnw install -nsu -B -e -DskipTests -DskipExamples $MVN_HTTP_CONFIG
|
./mvnw install dependency:resolve -nsu -B -e -DskipTests -DskipExamples $MVN_HTTP_CONFIG
|
||||||
|
|
||||||
- id: compress-keycloak-maven-repository
|
- id: compress-keycloak-maven-repository
|
||||||
name: Compress Keycloak Maven artifacts
|
name: Compress Keycloak Maven artifacts
|
||||||
|
@ -74,9 +77,3 @@ runs:
|
||||||
name: keycloak-dist
|
name: keycloak-dist
|
||||||
path: quarkus/dist/target/keycloak*.tar.gz
|
path: quarkus/dist/target/keycloak*.tar.gz
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
- id: maven-cache-cleanup
|
|
||||||
name: Maven cache cleanup
|
|
||||||
if: steps.maven-cache.outputs.cache-hit != 'true'
|
|
||||||
shell: bash
|
|
||||||
run: rm -rf ~/.m2/repository/org/keycloak
|
|
||||||
|
|
36
.github/actions/maven-cache/action.yml
vendored
36
.github/actions/maven-cache/action.yml
vendored
|
@ -1,6 +1,14 @@
|
||||||
name: Maven Cache
|
name: Maven Cache
|
||||||
description: Caches Maven artifacts
|
description: Caches Maven artifacts
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
create-cache-if-it-doesnt-exist:
|
||||||
|
description: >
|
||||||
|
Only those callers which fill the cache with the right contents should set this to true to avoid creating a cache
|
||||||
|
which contains too few or too many entries.
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
|
@ -12,20 +20,26 @@ runs:
|
||||||
- id: cache-maven-repository
|
- id: cache-maven-repository
|
||||||
name: Maven cache
|
name: Maven cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
|
if: inputs.create-cache-if-it-doesnt-exist == 'true'
|
||||||
with:
|
with:
|
||||||
path: ~/.m2/repository
|
# Two asterisks are needed to make the follow-up exclusion work
|
||||||
|
# see https://github.com/actions/toolkit/issues/713 for the upstream issue
|
||||||
|
path: |
|
||||||
|
~/.m2/repository/*/*
|
||||||
|
!~/.m2/repository/org/keycloak
|
||||||
key: ${{ steps.weekly-cache-key.outputs.key }}
|
key: ${{ steps.weekly-cache-key.outputs.key }}
|
||||||
|
|
||||||
- id: check-maven-cache
|
- id: restore-maven-repository
|
||||||
name: Check cache has no Keycloak artifacts
|
name: Maven cache
|
||||||
if: steps.cache-maven-repository.outputs.cache-hit == 'true'
|
uses: actions/cache/restore@v3
|
||||||
shell: bash
|
if: inputs.create-cache-if-it-doesnt-exist == 'false'
|
||||||
run: |
|
with:
|
||||||
if ( stat ~/.m2/repository/org/keycloak &>/dev/null ); then
|
# Two asterisks are needed to make the follow-up exclusion work
|
||||||
echo "Found org/keycloak artifacts in Maven repository cache"
|
# see https://github.com/actions/toolkit/issues/713 for the upstream issue
|
||||||
ls ~/.m2/repository/org/keycloak
|
path: |
|
||||||
exit 1
|
~/.m2/repository/*/*
|
||||||
fi
|
!~/.m2/repository/org/keycloak
|
||||||
|
key: ${{ steps.weekly-cache-key.outputs.key }}
|
||||||
|
|
||||||
- name: Cache Maven Wrapper
|
- name: Cache Maven Wrapper
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
|
|
Loading…
Reference in a new issue