Repository navigation
215 lines (188 loc) · 7.26 KB
/
Copy pathpopulate-cache.yml
File metadata and controls
215 lines (188 loc) · 7.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This workflow creates cache with Maven dependencies for Ozone build.
name: populate-cache
on:
push:
branches:
- master
paths:
- '**/pnpm-lock.yaml'
- '**/pom.xml'
- 'dev-support/ci/populate-cache.sh'
- '.github/actions/setup-java-with-cache/action.yml'
- '.github/workflows/populate-cache.yml'
- '.mvn/extensions.xml'
- '.mvn/wrapper/maven-wrapper.properties'
workflow_call:
workflow_dispatch:
permissions: { }
concurrency:
group: cache-${{ github.sha }}
cancel-in-progress: false
env:
# variables are duplicated from ci.yml, please keep in sync
BUILD_ARGS: "-Pdist -Psrc -Dmaven.javadoc.skip=true -Drocks_tools_native"
JAVA_VERSION: 25 # JDK version used by CI build and tests; should match the JDK version in apache/ozone-runner image
MAVEN_ARGS: --batch-mode --settings ${{ github.workspace }}/dev-support/ci/maven-settings.xml -Ddevelocity.user.config=${{ github.workspace }}/.mvn/develocity-asf.xml
MAVEN_OPTS: -Daether.connector.http.connectionMaxTtl=25 -Daether.connector.http.retryHandler.count=5 -Daether.connector.http.retryHandler.intervalMax=30000
MVNW_VERBOSE: true
SKIP_APACHE_VERIFY_DOWNLOAD: false
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout project
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Setup Java
id: restore-cache
uses: $/.github/actions/setup-java-with-cache
with:
only-exact-hit: true
- name: Fetch dependencies
if: steps.restore-cache.outputs.cache-hit != 'true'
run: |
dev-support/ci/populate-cache.sh -T 1C
- name: Get versions
id: versions
run: |
source hadoop-ozone/dev-support/checks/_lib.sh
HADOOP_VERSION=$(get_version hadoop)
echo "HADOOP_VERSION=$HADOOP_VERSION" >> $GITHUB_ENV
RANGER_VERSION=$(get_version ranger)
echo "RANGER_VERSION=$RANGER_VERSION" >> $GITHUB_ENV
- name: Restore Hadoop
id: restore-hadoop
uses: apache/infrastructure-actions/stash/restore@restore/v1
with:
clean: true
path: ~/.cache/ozone
key: hadoop-${{ env.HADOOP_VERSION }}
- name: Get Hadoop
if: steps.restore-hadoop.outputs.stash-hit != 'true'
run: |
rm -fr ~/.cache/ozone
source hadoop-ozone/dist/src/main/compose/testlib.sh
import_keys https://downloads.apache.org/hadoop/common/KEYS
download_hadoop
- name: Stash Hadoop
if: steps.restore-hadoop.outputs.stash-hit != 'true'
uses: apache/infrastructure-actions/stash/save@save/v1
with:
path: ~/.cache/ozone
key: hadoop-${{ env.HADOOP_VERSION }}
retention-days: 90
- name: Restore Hadoop AWS dependencies
id: restore-hadoop-deps
uses: apache/infrastructure-actions/stash/restore@restore/v1
with:
path: ~/.cache/ozone/maven-repo
key: hadoop-${{ env.HADOOP_VERSION }}-deps
- name: Fetch Hadoop AWS dependencies
if: steps.restore-hadoop-deps.outputs.stash-hit != 'true'
run: |
# create custom local repo dir for Hadoop AWS dependencies
mkdir -p ~/.cache/ozone/maven-repo
bash hadoop-ozone/dist/src/main/compose/ozone/test-s3a.sh
env:
BUILD_ONLY: true
- name: Stash Hadoop AWS dependencies
if: steps.restore-hadoop-deps.outputs.stash-hit != 'true'
uses: apache/infrastructure-actions/stash/save@save/v1
with:
path: ~/.cache/ozone/maven-repo
key: hadoop-${{ env.HADOOP_VERSION }}-deps
retention-days: 90
- name: Restore Ranger
id: restore-ranger
uses: apache/infrastructure-actions/stash/restore@restore/v1
with:
clean: true
path: ~/.cache/ozone
key: ranger-${{ env.RANGER_VERSION }}
- name: Get Ranger
if: steps.restore-ranger.outputs.stash-hit != 'true'
run: |
rm -fr ~/.cache/ozone
source hadoop-ozone/dist/src/main/compose/testlib.sh
import_keys https://downloads.apache.org/ranger/KEYS
download_ranger
download_ranger_ozone_plugin
- name: Stash Ranger
if: steps.restore-ranger.outputs.stash-hit != 'true'
uses: apache/infrastructure-actions/stash/save@save/v1
with:
path: ~/.cache/ozone
key: ranger-${{ env.RANGER_VERSION }}
retention-days: 90
- name: Delete Ozone jars from repo
if: steps.restore-cache.outputs.cache-hit != 'true'
run: rm -fr ~/.m2/repository/org/apache/ozone
- name: List repo contents
if: always()
run: find ~/.m2 -type f | sort | xargs ls -lh
- name: Save cache for Maven dependencies
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v6
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/ozone
key: ${{ steps.restore-cache.outputs.cache-key }}
npm:
needs:
- build
runs-on: ubuntu-24.04
steps:
- name: Checkout project
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Setup Java
id: restore-cache
uses: $/.github/actions/setup-java-with-cache
with:
only-exact-hit: true
- name: Calculate cache key
id: cache-key
run: |
echo "value=${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"
- name: Restore NPM dependencies
id: restore-pnpm
uses: actions/cache/restore@v6
with:
path: |
~/.pnpm-store
key: ${{ steps.cache-key.outputs.value }}
lookup-only: true
- name: Fetch NPM dependencies
if: steps.restore-pnpm.outputs.cache-hit != 'true'
run: |
export MAVEN_ARGS="$MAVEN_ARGS --offline"
./mvnw -pl :ozone-recon com.github.eirslett:frontend-maven-plugin:install-node-and-pnpm
run_pnpm() {
./mvnw -pl :ozone-recon com.github.eirslett:frontend-maven-plugin:pnpm -Dfrontend.pnpm.arguments="$1"
}
run_pnpm "config set store-dir ~/.pnpm-store"
run_pnpm fetch
- name: Save NPM dependencies
if: steps.restore-pnpm.outputs.cache-hit != 'true'
uses: actions/cache/save@v6
with:
path: |
~/.pnpm-store
key: ${{ steps.cache-key.outputs.value }}