Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 126 additions & 41 deletions .github/workflows/tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,12 @@ jobs:
- name: lint-repo
run: |
"${GITHUB_WORKSPACE}"/ci/shared/tasks/lint-repo/task.bash
test-on-mysql-5-7:
test-repos-withoutdb:
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
runs-on: ubuntu-latest
needs: [repo-clone, determine-image-tag]
env:
BUILD_IMAGE: cloudfoundry/tas-runtime-mysql-5.7:${{ needs.determine-image-tag.outputs.go_version }}
DB_USER: root
DB_PASSWORD: password
BUILD_IMAGE: cloudfoundry/tas-runtime-build:${{ needs.determine-image-tag.outputs.go_version }}
steps:
- name: Download artifact
uses: actions/download-artifact@v4
Expand All @@ -138,36 +136,124 @@ jobs:
- name: build binaries
run: |
repo/.github/helpers/build.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: auctioneer-mysql
- name: auction
env:
DIR: src/code.cloudfoundry.org/auction
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: executor
env:
DIR: src/code.cloudfoundry.org/executor
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: diego-ssh
env:
DIR: src/code.cloudfoundry.org/diego-ssh
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: fileserver
env:
DIR: src/code.cloudfoundry.org/fileserver
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: healthcheck
env:
DIR: src/code.cloudfoundry.org/healthcheck
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: buildpackapplifecycle
env:
DIR: src/code.cloudfoundry.org/buildpackapplifecycle
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: cacheddownloader
env:
DIR: src/code.cloudfoundry.org/cacheddownloader
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: dockerapplifecycle
env:
DIR: src/code.cloudfoundry.org/dockerapplifecycle
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: ecrhelper
env:
DIR: src/code.cloudfoundry.org/ecrhelper
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: localdriver
env:
DIR: src/code.cloudfoundry.org/localdriver
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: operationq
env:
DIR: src/code.cloudfoundry.org/operationq
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: volman
env:
DIR: src/code.cloudfoundry.org/volman
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: workpool
env:
DIR: src/code.cloudfoundry.org/workpool
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
test-on-postgres:
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
runs-on: ubuntu-latest
needs: [repo-clone, determine-image-tag]
env:
BUILD_IMAGE: cloudfoundry/tas-runtime-postgres:${{ needs.determine-image-tag.outputs.go_version }}
DB_USER: postgres
DB_PASSWORD: ""
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: repo
- run: |
tar -xzvf repo-artifact.tar.gz
tar -xzvf ci-artifact.tar.gz
- name: pull image
run: docker pull "$BUILD_IMAGE"
- name: build binaries
run: |
repo/.github/helpers/build.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: auctioneer-postgres
env:
DIR: src/code.cloudfoundry.org/auctioneer
DB: mysql
DB: postgres
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: rep-mysql
- name: rep-postgres
env:
DIR: src/code.cloudfoundry.org/rep
DB: mysql
DB: postgres
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: route-emitter-mysql
- name: route-emitter-postgres
env:
DIR: src/code.cloudfoundry.org/route-emitter
DB: mysql
DB: postgres
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: cfdot-mysql
- name: cfdot-postgres
env:
DIR: src/code.cloudfoundry.org/cfdot
DB: mysql
DB: postgres
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
test-repos-withoutdb:
test-on-mysql-8-0:
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
runs-on: ubuntu-latest
needs: [repo-clone, determine-image-tag]
env:
BUILD_IMAGE: cloudfoundry/tas-runtime-build:${{ needs.determine-image-tag.outputs.go_version }}
BUILD_IMAGE: cloudfoundry/tas-runtime-mysql-8.0:${{ needs.determine-image-tag.outputs.go_version }}
DB_USER: root
DB_PASSWORD: password
steps:
- name: Download artifact
uses: actions/download-artifact@v4
Expand All @@ -181,39 +267,38 @@ jobs:
- name: build binaries
run: |
repo/.github/helpers/build.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: auction
env:
DIR: src/code.cloudfoundry.org/auction
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: executor
- name: auctioneer-mysql
env:
DIR: src/code.cloudfoundry.org/executor
DIR: src/code.cloudfoundry.org/auctioneer
DB: mysql
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: diego-ssh
- name: rep-mysql
env:
DIR: src/code.cloudfoundry.org/diego-ssh
DIR: src/code.cloudfoundry.org/rep
DB: mysql
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: fileserver
- name: route-emitter-mysql
env:
DIR: src/code.cloudfoundry.org/fileserver
DIR: src/code.cloudfoundry.org/route-emitter
DB: mysql
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: healthcheck
- name: cfdot-mysql
env:
DIR: src/code.cloudfoundry.org/healthcheck
DIR: src/code.cloudfoundry.org/cfdot
DB: mysql
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
test-on-postgres:
test-on-mysql-8-4:
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
runs-on: ubuntu-latest
needs: [repo-clone, determine-image-tag]
env:
BUILD_IMAGE: cloudfoundry/tas-runtime-postgres:${{ needs.determine-image-tag.outputs.go_version }}
DB_USER: postgres
DB_PASSWORD: ""
BUILD_IMAGE: cloudfoundry/tas-runtime-mysql-8.4:${{ needs.determine-image-tag.outputs.go_version }}
DB_USER: root
DB_PASSWORD: password
steps:
- name: Download artifact
uses: actions/download-artifact@v4
Expand All @@ -227,36 +312,36 @@ jobs:
- name: build binaries
run: |
repo/.github/helpers/build.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: auctioneer-postgres
- name: auctioneer-mysql
env:
DIR: src/code.cloudfoundry.org/auctioneer
DB: postgres
DB: mysql
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: rep-postgres
- name: rep-mysql
env:
DIR: src/code.cloudfoundry.org/rep
DB: postgres
DB: mysql
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: route-emitter-postgres
- name: route-emitter-mysql
env:
DIR: src/code.cloudfoundry.org/route-emitter
DB: postgres
DB: mysql
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
- name: cfdot-postgres
- name: cfdot-mysql
env:
DIR: src/code.cloudfoundry.org/cfdot
DB: postgres
DB: mysql
run: |
repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE"
test-on-mysql-8-0:
test-on-mysql-9-7:
if: contains(github.event.pull_request.labels.*.name, 'ready-to-run')
runs-on: ubuntu-latest
needs: [repo-clone, determine-image-tag]
env:
BUILD_IMAGE: cloudfoundry/tas-runtime-mysql-8.0:${{ needs.determine-image-tag.outputs.go_version }}
BUILD_IMAGE: cloudfoundry/tas-runtime-mysql-9.7:${{ needs.determine-image-tag.outputs.go_version }}
DB_USER: root
DB_PASSWORD: password
steps:
Expand Down
14 changes: 8 additions & 6 deletions src/code.cloudfoundry.org/cacheddownloader/file_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,6 @@ func (e *FileCacheEntry) expandedDirectory() (string, error) {
err = os.RemoveAll(e.FilePath)
if err != nil {
fmt.Fprintln(os.Stderr, "Unable to delete the cached file", err)
} else {
// GetDirectory doubled Size before calling here; tar is now gone so halve it
// back to reflect only the .tar.d on disk. Mirrors the symmetric halving in
// decrementFileInUseCount() which fires when the tar is deleted later.
e.Size = e.Size / 2
}
}
}
Expand Down Expand Up @@ -339,7 +334,8 @@ func (c *FileCache) GetDirectory(logger lager.Logger, cacheKey string) (string,
}

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

// If the tarball got deleted during expansion, halve the doubled size back
// down to reflect only the .tar.d now on disk.
if expanding && entry.fileDoesNotExist() {
entry.Size = entry.Size / 2
}

return dir, entry.CachingInfo, nil
}

Expand Down
Loading