Skip to content

Commit 7a718dd

Browse files
authored
Fix ownership of files that docker uses in mounted directories (apache#46428)
The apache#46358 moved docker to another mounted directory - but this directory and all files in it are owned by host user. The directory and all files inside should be owned by root in order to properly reflect permissions of the files when building docker images. The change is now simplified. Rather than passing mount directory by variable and passing it through GitHub Actions, we hard-code the location of docker in cleanup_docker.sh script - we also incorporate changing ownership and showing disk space in the same cleanup_docker.sh script and make sure that script is only called in the "real" (not composite) actions at the beginning - right after the repository is checked out - previously that script was also called in composite actions and changing the repo to be writeable was done AFTER cleanup_docker.sh - which would not work as we want the /mnt directory to be still owned by the host user, but the docker storage should be still owned by root.
1 parent ca77120 commit 7a718dd

File tree

16 files changed

+15
-101
lines changed

16 files changed

+15
-101
lines changed

.github/actions/prepare_all_ci_images/action.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ inputs:
3131
runs:
3232
using: "composite"
3333
steps:
34-
- name: "Cleanup docker"
35-
run: ./scripts/ci/cleanup_docker.sh
36-
env:
37-
TARGET_DOCKER_VOLUME_LOCATION: ${{ inputs.docker-volume-location }}
38-
shell: bash
3934
# TODO: Currently we cannot loop through the list of python versions and have dynamic list of
4035
# tasks. Instead we hardcode all possible python versions and they - but
4136
# this should be implemented in stash action as list of keys to download.

.github/actions/prepare_breeze_and_image/action.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,13 @@ runs:
3939
using: "composite"
4040
steps:
4141
- name: "Cleanup docker"
42-
# Move docker space to second partition to have more space
4342
run: ./scripts/ci/cleanup_docker.sh
44-
env:
45-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
4643
shell: bash
4744
- name: "Install Breeze"
4845
uses: ./.github/actions/breeze
4946
with:
5047
use-uv: ${{ inputs.use-uv }}
5148
id: breeze
52-
- name: Check free space
53-
run: df -H
54-
shell: bash
55-
- name: Make /mnt/ directory writeable
56-
run: sudo chown -R ${USER} /mnt
57-
shell: bash
5849
- name: "Restore ${{ inputs.image-type }} docker image ${{ inputs.platform }}:${{ inputs.python }}"
5950
uses: apache/infrastructure-actions/stash/restore@1c35b5ccf8fba5d4c3fdf25a045ca91aa0cbc468
6051
with:

.github/actions/prepare_single_ci_image/action.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ inputs:
3535
runs:
3636
using: "composite"
3737
steps:
38-
- name: Check free space
39-
run: df -H
40-
shell: bash
41-
- name: Make /mnt/ directory writeable
42-
run: sudo chown -R ${USER} /mnt
43-
shell: bash
4438
- name: "Restore CI docker images ${{ inputs.platform }}:${{ inputs.python }}"
4539
uses: apache/infrastructure-actions/stash/restore@1c35b5ccf8fba5d4c3fdf25a045ca91aa0cbc468
4640
with:

.github/workflows/additional-ci-image-checks.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,7 @@ jobs:
142142
with:
143143
persist-credentials: false
144144
- name: "Cleanup docker"
145-
# Move docker space to second partition to have more space
146145
run: ./scripts/ci/cleanup_docker.sh
147-
env:
148-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
149146
- name: "Install Breeze"
150147
uses: ./.github/actions/breeze
151148
with:

.github/workflows/additional-prod-image-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ jobs:
116116
fetch-depth: 2
117117
persist-credentials: false
118118
- name: "Cleanup docker"
119-
# Move docker space to second partition to have more space
120119
run: ./scripts/ci/cleanup_docker.sh
121-
env:
122-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
123120
- name: "Prepare breeze & PROD image: ${{ inputs.default-python-version }}"
124121
uses: ./.github/actions/prepare_breeze_and_image
125122
with:

.github/workflows/basic-tests.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,7 @@ jobs:
7777
fetch-depth: 0
7878
persist-credentials: false
7979
- name: "Cleanup docker"
80-
# Move docker space to second partition to have more space
8180
run: ./scripts/ci/cleanup_docker.sh
82-
env:
83-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
8481
- name: "Install Breeze"
8582
uses: ./.github/actions/breeze
8683
with:
@@ -101,10 +98,7 @@ jobs:
10198
with:
10299
persist-credentials: false
103100
- name: "Cleanup docker"
104-
# Move docker space to second partition to have more space
105101
run: ./scripts/ci/cleanup_docker.sh
106-
env:
107-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
108102
- name: Setup pnpm
109103
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
110104
with:
@@ -171,10 +165,7 @@ jobs:
171165
with:
172166
persist-credentials: false
173167
- name: "Cleanup docker"
174-
# Move docker space to second partition to have more space
175168
run: ./scripts/ci/cleanup_docker.sh
176-
env:
177-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
178169
- name: "Setup node"
179170
uses: actions/setup-node@v4
180171
with:
@@ -242,10 +233,7 @@ jobs:
242233
with:
243234
persist-credentials: false
244235
- name: "Cleanup docker"
245-
# Move docker space to second partition to have more space
246236
run: ./scripts/ci/cleanup_docker.sh
247-
env:
248-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
249237
- name: "Install Breeze"
250238
uses: ./.github/actions/breeze
251239
with:
@@ -300,10 +288,7 @@ jobs:
300288
with:
301289
persist-credentials: false
302290
- name: "Cleanup docker"
303-
# Move docker space to second partition to have more space
304291
run: ./scripts/ci/cleanup_docker.sh
305-
env:
306-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
307292
- name: "Install Breeze"
308293
uses: ./.github/actions/breeze
309294
with:
@@ -382,10 +367,7 @@ jobs:
382367
with:
383368
persist-credentials: false
384369
- name: "Cleanup docker"
385-
# Move docker space to second partition to have more space
386370
run: ./scripts/ci/cleanup_docker.sh
387-
env:
388-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
389371
- name: "Install Breeze"
390372
uses: ./.github/actions/breeze
391373
with:

.github/workflows/ci-image-build.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,7 @@ jobs:
130130
with:
131131
persist-credentials: false
132132
- name: "Cleanup docker"
133-
# Move docker space to second partition to have more space
134133
run: ./scripts/ci/cleanup_docker.sh
135-
env:
136-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
137134
- name: "Install Breeze"
138135
uses: ./.github/actions/breeze
139136
with:
@@ -189,12 +186,6 @@ jobs:
189186
PUSH: ${{ inputs.push-image }}
190187
VERBOSE: "true"
191188
PLATFORM: ${{ inputs.platform }}
192-
- name: Check free space
193-
run: df -H
194-
shell: bash
195-
- name: Make /mnt/ directory writeable
196-
run: sudo chown -R ${USER} /mnt
197-
shell: bash
198189
- name: "Export CI docker image ${{ env.PYTHON_MAJOR_MINOR_VERSION }}"
199190
env:
200191
PLATFORM: ${{ inputs.platform }}

.github/workflows/ci-image-checks.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,7 @@ jobs:
324324
with:
325325
persist-credentials: false
326326
- name: "Cleanup docker"
327-
# Move docker space to second partition to have more space
328327
run: ./scripts/ci/cleanup_docker.sh
329-
env:
330-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
331328
- name: "Download docs prepared as artifacts"
332329
uses: actions/download-artifact@v4
333330
with:
@@ -408,10 +405,7 @@ jobs:
408405
fetch-depth: 2
409406
persist-credentials: false
410407
- name: "Cleanup docker"
411-
# Move docker space to second partition to have more space
412408
run: ./scripts/ci/cleanup_docker.sh
413-
env:
414-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
415409
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
416410
uses: actions/checkout@v4
417411
with:

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,7 @@ jobs:
147147
with:
148148
persist-credentials: false
149149
- name: "Cleanup docker"
150-
# Move docker space to second partition to have more space
151150
run: ./scripts/ci/cleanup_docker.sh
152-
env:
153-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
154151
- name: Fetch incoming commit ${{ github.sha }} with its parent
155152
uses: actions/checkout@v4
156153
with:

.github/workflows/finalize-tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ jobs:
104104
# Needed to perform push action
105105
persist-credentials: false
106106
- name: "Cleanup docker"
107-
# Move docker space to second partition to have more space
108107
run: ./scripts/ci/cleanup_docker.sh
109-
env:
110-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
111108
- name: "Set constraints branch name"
112109
id: constraints-branch
113110
run: ./scripts/ci/constraints/ci_branch_constraints.sh >> ${GITHUB_OUTPUT}
@@ -195,10 +192,7 @@ jobs:
195192
with:
196193
persist-credentials: false
197194
- name: "Cleanup docker"
198-
# Move docker space to second partition to have more space
199195
run: ./scripts/ci/cleanup_docker.sh
200-
env:
201-
TARGET_DOCKER_VOLUME_LOCATION: /mnt/var-lib-docker
202196
- name: "Free up disk space"
203197
shell: bash
204198
run: ./scripts/tools/free_up_disk_space.sh

0 commit comments

Comments
 (0)