Skip to content

Commit

Permalink
Single gitlab cache with pull-only behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
randomanderson committed Jun 14, 2021
1 parent 14671b9 commit 06513ad
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ variables:
image: datadog/dd-trace-java-docker-build:latest
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
cache:
key: '$CI_COMMIT_REF_SLUG' # Cache per branch
paths:
- .gradle/wrapper
- .gradle/caches

build:
cache:
key: '$CI_SERVER_VERSION' # Reset the cache every time gitlab is upgraded. ~Every couple months
paths:
- .gradle/wrapper
- .gradle/caches
policy: pull

build: &build
<<: *gradle_build
stage: build
script:
Expand All @@ -38,9 +40,21 @@ build:
- 'workspace/dd-java-agent/build/libs/*.jar'
- 'upstream.env'

build_with_cache:
<<: *build
rules:
- if: '$POPULATE_CACHE'
when: on_success
- when: manual
cache:
policy: push

deploy_to_reliability_env:
stage: deploy
when: on_success
rules:
- if: '$POPULATE_CACHE'
when: never
- when: on_success
trigger:
project: DataDog/datadog-reliability-env
branch: $DOWNSTREAM_BRANCH
Expand Down

0 comments on commit 06513ad

Please sign in to comment.