Skip to content

Commit 1fc9bed

Browse files
authored
Merge pull request #1169 from cloudfoundry/gh-fix
fix gh actions with new modules and dir size calculation
2 parents 8ab220a + 796fdeb commit 1fc9bed

2 files changed

Lines changed: 134 additions & 47 deletions

File tree

.github/workflows/tests-workflow.yml

Lines changed: 126 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,12 @@ jobs:
117117
- name: lint-repo
118118
run: |
119119
"${GITHUB_WORKSPACE}"/ci/shared/tasks/lint-repo/task.bash
120-
test-on-mysql-5-7:
120+
test-repos-withoutdb:
121121
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
122122
runs-on: ubuntu-latest
123123
needs: [repo-clone, determine-image-tag]
124124
env:
125-
BUILD_IMAGE: cloudfoundry/tas-runtime-mysql-5.7:${{ needs.determine-image-tag.outputs.go_version }}
126-
DB_USER: root
127-
DB_PASSWORD: password
125+
BUILD_IMAGE: cloudfoundry/tas-runtime-build:${{ needs.determine-image-tag.outputs.go_version }}
128126
steps:
129127
- name: Download artifact
130128
uses: actions/download-artifact@v4
@@ -138,36 +136,124 @@ jobs:
138136
- name: build binaries
139137
run: |
140138
repo/.github/helpers/build.bash ${{ github.workspace }} "$BUILD_IMAGE"
141-
- name: auctioneer-mysql
139+
- name: auction
140+
env:
141+
DIR: src/code.cloudfoundry.org/auction
142+
run: |
143+
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
144+
- name: executor
145+
env:
146+
DIR: src/code.cloudfoundry.org/executor
147+
run: |
148+
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
149+
- name: diego-ssh
150+
env:
151+
DIR: src/code.cloudfoundry.org/diego-ssh
152+
run: |
153+
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
154+
- name: fileserver
155+
env:
156+
DIR: src/code.cloudfoundry.org/fileserver
157+
run: |
158+
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
159+
- name: healthcheck
160+
env:
161+
DIR: src/code.cloudfoundry.org/healthcheck
162+
run: |
163+
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
164+
- name: buildpackapplifecycle
165+
env:
166+
DIR: src/code.cloudfoundry.org/buildpackapplifecycle
167+
run: |
168+
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
169+
- name: cacheddownloader
170+
env:
171+
DIR: src/code.cloudfoundry.org/cacheddownloader
172+
run: |
173+
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
174+
- name: dockerapplifecycle
175+
env:
176+
DIR: src/code.cloudfoundry.org/dockerapplifecycle
177+
run: |
178+
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
179+
- name: ecrhelper
180+
env:
181+
DIR: src/code.cloudfoundry.org/ecrhelper
182+
run: |
183+
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
184+
- name: localdriver
185+
env:
186+
DIR: src/code.cloudfoundry.org/localdriver
187+
run: |
188+
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
189+
- name: operationq
190+
env:
191+
DIR: src/code.cloudfoundry.org/operationq
192+
run: |
193+
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
194+
- name: volman
195+
env:
196+
DIR: src/code.cloudfoundry.org/volman
197+
run: |
198+
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
199+
- name: workpool
200+
env:
201+
DIR: src/code.cloudfoundry.org/workpool
202+
run: |
203+
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
204+
test-on-postgres:
205+
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
206+
runs-on: ubuntu-latest
207+
needs: [repo-clone, determine-image-tag]
208+
env:
209+
BUILD_IMAGE: cloudfoundry/tas-runtime-postgres:${{ needs.determine-image-tag.outputs.go_version }}
210+
DB_USER: postgres
211+
DB_PASSWORD: ""
212+
steps:
213+
- name: Download artifact
214+
uses: actions/download-artifact@v4
215+
with:
216+
name: repo
217+
- run: |
218+
tar -xzvf repo-artifact.tar.gz
219+
tar -xzvf ci-artifact.tar.gz
220+
- name: pull image
221+
run: docker pull "$BUILD_IMAGE"
222+
- name: build binaries
223+
run: |
224+
repo/.github/helpers/build.bash ${{ github.workspace }} "$BUILD_IMAGE"
225+
- name: auctioneer-postgres
142226
env:
143227
DIR: src/code.cloudfoundry.org/auctioneer
144-
DB: mysql
228+
DB: postgres
145229
run: |
146230
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
147-
- name: rep-mysql
231+
- name: rep-postgres
148232
env:
149233
DIR: src/code.cloudfoundry.org/rep
150-
DB: mysql
234+
DB: postgres
151235
run: |
152236
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
153-
- name: route-emitter-mysql
237+
- name: route-emitter-postgres
154238
env:
155239
DIR: src/code.cloudfoundry.org/route-emitter
156-
DB: mysql
240+
DB: postgres
157241
run: |
158242
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
159-
- name: cfdot-mysql
243+
- name: cfdot-postgres
160244
env:
161245
DIR: src/code.cloudfoundry.org/cfdot
162-
DB: mysql
246+
DB: postgres
163247
run: |
164248
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
165-
test-repos-withoutdb:
249+
test-on-mysql-8-0:
166250
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
167251
runs-on: ubuntu-latest
168252
needs: [repo-clone, determine-image-tag]
169253
env:
170-
BUILD_IMAGE: cloudfoundry/tas-runtime-build:${{ needs.determine-image-tag.outputs.go_version }}
254+
BUILD_IMAGE: cloudfoundry/tas-runtime-mysql-8.0:${{ needs.determine-image-tag.outputs.go_version }}
255+
DB_USER: root
256+
DB_PASSWORD: password
171257
steps:
172258
- name: Download artifact
173259
uses: actions/download-artifact@v4
@@ -181,39 +267,38 @@ jobs:
181267
- name: build binaries
182268
run: |
183269
repo/.github/helpers/build.bash ${{ github.workspace }} "$BUILD_IMAGE"
184-
- name: auction
185-
env:
186-
DIR: src/code.cloudfoundry.org/auction
187-
run: |
188-
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
189-
- name: executor
270+
- name: auctioneer-mysql
190271
env:
191-
DIR: src/code.cloudfoundry.org/executor
272+
DIR: src/code.cloudfoundry.org/auctioneer
273+
DB: mysql
192274
run: |
193275
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
194-
- name: diego-ssh
276+
- name: rep-mysql
195277
env:
196-
DIR: src/code.cloudfoundry.org/diego-ssh
278+
DIR: src/code.cloudfoundry.org/rep
279+
DB: mysql
197280
run: |
198281
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
199-
- name: fileserver
282+
- name: route-emitter-mysql
200283
env:
201-
DIR: src/code.cloudfoundry.org/fileserver
284+
DIR: src/code.cloudfoundry.org/route-emitter
285+
DB: mysql
202286
run: |
203287
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
204-
- name: healthcheck
288+
- name: cfdot-mysql
205289
env:
206-
DIR: src/code.cloudfoundry.org/healthcheck
290+
DIR: src/code.cloudfoundry.org/cfdot
291+
DB: mysql
207292
run: |
208293
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
209-
test-on-postgres:
294+
test-on-mysql-8-4:
210295
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
211296
runs-on: ubuntu-latest
212297
needs: [repo-clone, determine-image-tag]
213298
env:
214-
BUILD_IMAGE: cloudfoundry/tas-runtime-postgres:${{ needs.determine-image-tag.outputs.go_version }}
215-
DB_USER: postgres
216-
DB_PASSWORD: ""
299+
BUILD_IMAGE: cloudfoundry/tas-runtime-mysql-8.4:${{ needs.determine-image-tag.outputs.go_version }}
300+
DB_USER: root
301+
DB_PASSWORD: password
217302
steps:
218303
- name: Download artifact
219304
uses: actions/download-artifact@v4
@@ -227,36 +312,36 @@ jobs:
227312
- name: build binaries
228313
run: |
229314
repo/.github/helpers/build.bash ${{ github.workspace }} "$BUILD_IMAGE"
230-
- name: auctioneer-postgres
315+
- name: auctioneer-mysql
231316
env:
232317
DIR: src/code.cloudfoundry.org/auctioneer
233-
DB: postgres
318+
DB: mysql
234319
run: |
235320
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
236-
- name: rep-postgres
321+
- name: rep-mysql
237322
env:
238323
DIR: src/code.cloudfoundry.org/rep
239-
DB: postgres
324+
DB: mysql
240325
run: |
241326
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
242-
- name: route-emitter-postgres
327+
- name: route-emitter-mysql
243328
env:
244329
DIR: src/code.cloudfoundry.org/route-emitter
245-
DB: postgres
330+
DB: mysql
246331
run: |
247332
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
248-
- name: cfdot-postgres
333+
- name: cfdot-mysql
249334
env:
250335
DIR: src/code.cloudfoundry.org/cfdot
251-
DB: postgres
336+
DB: mysql
252337
run: |
253338
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
254-
test-on-mysql-8-0:
339+
test-on-mysql-9-7:
255340
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
256341
runs-on: ubuntu-latest
257342
needs: [repo-clone, determine-image-tag]
258343
env:
259-
BUILD_IMAGE: cloudfoundry/tas-runtime-mysql-8.0:${{ needs.determine-image-tag.outputs.go_version }}
344+
BUILD_IMAGE: cloudfoundry/tas-runtime-mysql-9.7:${{ needs.determine-image-tag.outputs.go_version }}
260345
DB_USER: root
261346
DB_PASSWORD: password
262347
steps:

src/code.cloudfoundry.org/cacheddownloader/file_cache.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,6 @@ func (e *FileCacheEntry) expandedDirectory() (string, error) {
191191
err = os.RemoveAll(e.FilePath)
192192
if err != nil {
193193
fmt.Fprintln(os.Stderr, "Unable to delete the cached file", err)
194-
} else {
195-
// GetDirectory doubled Size before calling here; tar is now gone so halve it
196-
// back to reflect only the .tar.d on disk. Mirrors the symmetric halving in
197-
// decrementFileInUseCount() which fires when the tar is deleted later.
198-
e.Size = e.Size / 2
199194
}
200195
}
201196
}
@@ -339,7 +334,8 @@ func (c *FileCache) GetDirectory(logger lager.Logger, cacheKey string) (string,
339334
}
340335

341336
// Was it expanded before
342-
if entry.dirDoesNotExist() {
337+
expanding := entry.dirDoesNotExist()
338+
if expanding {
343339
// Do we have enough room to double the size?
344340
c.makeRoom(logger, entry.Size, cacheKey)
345341
entry.Size = entry.Size * 2
@@ -351,6 +347,12 @@ func (c *FileCache) GetDirectory(logger lager.Logger, cacheKey string) (string,
351347
return "", CachingInfoType{}, err
352348
}
353349

350+
// If the tarball got deleted during expansion, halve the doubled size back
351+
// down to reflect only the .tar.d now on disk.
352+
if expanding && entry.fileDoesNotExist() {
353+
entry.Size = entry.Size / 2
354+
}
355+
354356
return dir, entry.CachingInfo, nil
355357
}
356358

0 commit comments

Comments
 (0)