Skip to content

Commit 9cd9db8

Browse files
authored
Merge pull request #695 from mamba-org/no-clobber-home
No clobber `$HOME` , GitHub Actions dependencies updates
2 parents cf9b7af + 50fdd53 commit 9cd9db8

5 files changed

Lines changed: 30 additions & 9 deletions

File tree

.github/workflows/push_latest.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ jobs:
176176
labels: |
177177
distro_id=${{ steps.set_image_variables.outputs.distro_id }}
178178
- name: Setup docker buildx
179-
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
179+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
180180
- name: Login to DockerHub
181181
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
182182
with:
@@ -237,7 +237,7 @@ jobs:
237237
labels: ${{ steps.get_metadata.outputs.labels}}
238238
cache-from: type=registry,ref=ghcr.io/mamba-org/micromamba-cache/cache:${{ steps.set_image_variables.outputs.tag }}
239239
cache-to: type=registry,ref=ghcr.io/mamba-org/micromamba-cache/cache:${{ steps.set_image_variables.outputs.tag }},mode=max
240-
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
240+
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
241241
with:
242242
name: ${{ steps.set_image_variables.outputs.tag }}.metadata
243243
path: ${{ steps.get_metadata.outputs.bake-file }}
@@ -255,7 +255,7 @@ jobs:
255255
with:
256256
persist-credentials: false
257257
- name: Get artifacts
258-
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
258+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
259259
with:
260260
path: artifacts
261261
pattern: '*.metadata'

.github/workflows/zizmor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
with:
2323
persist-credentials: false
2424

25-
- uses: hynek/setup-cached-uv@2a4a9b893253e16cf11e6def5f774336af2f80bc
25+
- uses: hynek/setup-cached-uv@ae460f75dcef535482cb6754a8ca5ad6aac63ce7
2626

2727
- name: Run zizmor 🌈
2828
run: uvx zizmor --format sarif . > results.sarif

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
This change log covers changes to the docker image and does not include
44
[changes to the micromamba program](https://github.com/mamba-org/mamba/blob/main/CHANGELOG.md).
55

6+
## 12 January 2026
7+
8+
- No longer clobber `$HOME` values passed via
9+
`docker run -e HOME ...` (for `$HOME` values other than `/`).
10+
611
## 20 December 2025
712

813
- Update CUDA v13.0.2 images to v13.1.0

_entrypoint.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ if [[ -f /etc/arg_mamba_user && "${MAMBA_USER}" != "$(cat "/etc/arg_mamba_user")
1212
exit 1
1313
fi
1414

15-
# if USER is not set and not root
16-
if [[ ! -v USER && $(id -u) -gt 0 ]]; then
17-
# should get here if 'docker run...' was passed -u with a numeric UID
18-
export USER="$MAMBA_USER"
19-
export HOME="/home/$USER"
15+
if [[ $(id -u) -gt 0 ]]; then
16+
if [[ ! -v USER ]]; then
17+
export USER="$MAMBA_USER"
18+
fi
19+
# If a user passes HOME="/", it will still get clobbered.
20+
# I don't have a good way to work around that.
21+
if [[ $HOME == "/" ]]; then
22+
export HOME="/home/$USER"
23+
fi
2024
fi
2125

2226
source _activate_current_env.sh

test/user.bats

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,15 @@ setup() {
130130
assert_success
131131
assert_output --partial "uid=1100(MaMbAmIcRo) gid=2000(MaMbAmIcRo) groups=2000(MaMbAmIcRo)"
132132
}
133+
134+
@test "docker run -e HOME="/foobar" ${MICROMAMBA_IMAGE} /bin/bash -c 'realpath ~'" {
135+
# shellcheck disable=SC2086
136+
run docker run $RUN_FLAGS -e HOME="/foobar" "${MICROMAMBA_IMAGE}" /bin/bash -c 'realpath ~'
137+
assert_output "/foobar"
138+
}
139+
140+
@test "docker run --user=1001:1001 -e HOME="/foobar" ${MICROMAMBA_IMAGE} /bin/bash -c 'realpath ~'" {
141+
# shellcheck disable=SC2086
142+
run docker run $RUN_FLAGS --user=1001:1001 -e HOME="/foobar" "${MICROMAMBA_IMAGE}" /bin/bash -c 'realpath ~'
143+
assert_output "/foobar"
144+
}

0 commit comments

Comments
 (0)