Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

Commit

Permalink
Provides a solution for caching build dependencies for maven gradle (#77
Browse files Browse the repository at this point in the history
)

* Add caches for mvn/gradle resources - in light of concourse 3.3.0

* Remove M2_REPO param

* Use symlink for cache instead of setting Maven/Gradle env vars

* Rename hidden folders for caches
  • Loading branch information
Mark Alston authored and marcingrzejszczak committed Sep 11, 2017
1 parent aba2253 commit 6a78cc1
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 41 deletions.
1 change: 0 additions & 1 deletion concourse/credentials-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ app-url: git@github.com:marcingrzejszczak/github-webhook.git
app-branch: master
tools-scripts-url: https://github.com/spring-cloud/spring-cloud-pipelines.git
tools-branch: master
maven-local-dir: m2/rootfs

app-memory-limit: 256m
java-buildpack-url: https://github.com/cloudfoundry/java-buildpack.git#v3.8.1
Expand Down
16 changes: 0 additions & 16 deletions concourse/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ resources:
uri: ((tools-scripts-url))
branch: ((tools-branch))

- name: m2
type: docker-image
source:
repository: springcloud/spring-pipeline-m2

jobs:
- name: generate-version
public: true
Expand All @@ -48,7 +43,6 @@ jobs:
- aggregate:
- get: tools
- get: repo
- get: m2
- get: version
resource: version
passed:
Expand All @@ -71,7 +65,6 @@ jobs:
- aggregate:
- get: tools
- get: repo
- get: m2
- get: version
resource: version
passed:
Expand All @@ -89,7 +82,6 @@ jobs:
- aggregate:
- get: tools
- get: repo
- get: m2
- get: version
resource: version
passed:
Expand All @@ -109,7 +101,6 @@ jobs:
- aggregate:
- get: tools
- get: repo
- get: m2
- get: version
resource: version
passed:
Expand All @@ -128,7 +119,6 @@ jobs:
- aggregate:
- get: tools
- get: repo
- get: m2
- get: version
resource: version
passed:
Expand All @@ -148,7 +138,6 @@ jobs:
- aggregate:
- get: tools
- get: repo
- get: m2
- get: version
resource: version
passed:
Expand All @@ -167,7 +156,6 @@ jobs:
- aggregate:
- get: tools
- get: repo
- get: m2
- get: version
resource: version
passed:
Expand All @@ -187,7 +175,6 @@ jobs:
- aggregate:
- get: tools
- get: repo
- get: m2
- get: version
resource: version
passed:
Expand All @@ -206,7 +193,6 @@ jobs:
- aggregate:
- get: tools
- get: repo
- get: m2
- get: version
resource: version
passed:
Expand All @@ -231,7 +217,6 @@ jobs:
- aggregate:
- get: tools
- get: repo
- get: m2
- get: version
resource: version
passed:
Expand All @@ -249,7 +234,6 @@ common-params: &common-params
BUILD_OPTIONS: ((build-options))
GIT_EMAIL: ((git-email))
GIT_NAME: ((git-name))
M2_REPO: ((maven-local-dir))
M2_SETTINGS_REPO_ID: ((m2-settings-repo-id))
M2_SETTINGS_REPO_PASSWORD: ((m2-settings-repo-password))
M2_SETTINGS_REPO_USERNAME: ((m2-settings-repo-username))
Expand Down
4 changes: 3 additions & 1 deletion concourse/tasks/build-and-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ inputs:
- name: tools
- name: repo
- name: version
- name: m2
outputs:
- name: out
caches:
- path: gradle
- path: maven
run:
path: /bin/bash
args:
Expand Down
4 changes: 3 additions & 1 deletion concourse/tasks/build-api-compatibility-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ inputs:
- name: tools
- name: repo
- name: version
- name: m2
outputs:
- name: out
caches:
- path: gradle
- path: maven
run:
path: /bin/bash
args:
Expand Down
25 changes: 11 additions & 14 deletions concourse/tasks/generate-settings.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/bin/bash

mkdir -p ${HOME}/.m2
mkdir -p ${HOME}/.gradle
M2_HOME="${HOME}/.m2"
M2_CACHE="${ROOT_FOLDER}/maven"
GRADLE_HOME="${HOME}/.gradle"
GRADLE_CACHE="${ROOT_FOLDER}/gradle"

ROOT_IN_M2_RESOURCE="${ROOT_FOLDER}/${M2_REPO}/root"
export M2_HOME="${ROOT_IN_M2_RESOURCE}/.m2"
export NEW_LOCAL_REPO="${M2_HOME}/repository/"
[[ -d $M2_CACHE && ! -d $M2_HOME ]] && ln -s $M2_CACHE $M2_HOME
[[ -d $GRADLE_CACHE && ! -d $GRADLE_HOME ]] && ln -s $GRADLE_CACHE $GRADLE_HOME

cat > ${HOME}/.m2/settings.xml <<EOF
echo "Writing maven settings to [${M2_HOME}/settings.xml]"

cat > $M2_HOME/settings.xml <<EOF
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -25,18 +28,12 @@ cat > ${HOME}/.m2/settings.xml <<EOF
EOF
echo "Settings xml written"

export GRADLE_USER_HOME="${ROOT_IN_M2_RESOURCE}/.gradle"

echo "Writing gradle.properties to [${GRADLE_USER_HOME}/gradle.properties]"
echo "Writing gradle.properties to [${GRADLE_HOME}/gradle.properties]"

cat > ${GRADLE_USER_HOME}/gradle.properties <<EOF
cat > $GRADLE_HOME/gradle.properties <<EOF
repoUsername=${M2_SETTINGS_REPO_USERNAME}
repoPassword=${M2_SETTINGS_REPO_PASSWORD}
EOF
echo "gradle.properties written"

echo "Moving [${NEW_LOCAL_REPO}] [${HOME}] folder"
mv ${NEW_LOCAL_REPO} ${HOME}/.m2/repository
mv ${M2_HOME}/wrapper ${HOME}/.m2/wrapper
4 changes: 3 additions & 1 deletion concourse/tasks/prod-complete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ inputs:
- name: tools
- name: repo
- name: version
- name: m2
outputs:
- name: out
caches:
- path: gradle
- path: maven
run:
path: /bin/bash
args:
Expand Down
4 changes: 3 additions & 1 deletion concourse/tasks/prod-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ inputs:
- name: tools
- name: repo
- name: version
- name: m2
outputs:
- name: out
caches:
- path: gradle
- path: maven
run:
path: /bin/bash
args:
Expand Down
4 changes: 3 additions & 1 deletion concourse/tasks/stage-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ inputs:
- name: tools
- name: repo
- name: version
- name: m2
outputs:
- name: out
caches:
- path: gradle
- path: maven
run:
path: /bin/bash
args:
Expand Down
4 changes: 3 additions & 1 deletion concourse/tasks/stage-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ inputs:
- name: tools
- name: repo
- name: version
- name: m2
outputs:
- name: out
caches:
- path: gradle
- path: maven
run:
path: /bin/bash
args:
Expand Down
4 changes: 3 additions & 1 deletion concourse/tasks/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ inputs:
- name: tools
- name: repo
- name: version
- name: m2
outputs:
- name: out
caches:
- path: gradle
- path: maven
run:
path: /bin/bash
args:
Expand Down
4 changes: 3 additions & 1 deletion concourse/tasks/test-rollback-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ inputs:
- name: tools
- name: repo
- name: version
- name: m2
outputs:
- name: out
caches:
- path: gradle
- path: maven
run:
path: /bin/bash
args:
Expand Down
4 changes: 3 additions & 1 deletion concourse/tasks/test-rollback-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ inputs:
- name: tools
- name: repo
- name: version
- name: m2
outputs:
- name: out
caches:
- path: gradle
- path: maven
run:
path: /bin/bash
args:
Expand Down
4 changes: 3 additions & 1 deletion concourse/tasks/test-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ inputs:
- name: tools
- name: repo
- name: version
- name: m2
outputs:
- name: out
caches:
- path: gradle
- path: maven
run:
path: /bin/bash
args:
Expand Down

0 comments on commit 6a78cc1

Please sign in to comment.