Skip to content

Commit 1d28aa9

Browse files
authored
Accept ToS in Conda CI (#994)
# Pull Request ## Title Accept ToS in Conda CI ______________________________________________________________________ ## Description Addresses a change in the latest version of conda to accept the terms of service automatically. ______________________________________________________________________ ## Type of Change - 🛠️ Bug fix ______________________________________________________________________ ## Testing CI Pipeline runs again. ______________________________________________________________________
1 parent 1bed08e commit 1d28aa9

18 files changed

Lines changed: 160 additions & 24 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
33

4-
FROM mcr.microsoft.com/vscode/devcontainers/base AS base
4+
# TODO: FIXME: Temporarily pin to bookworm until latest (trixie) base image is fully supported.
5+
# See Also:
6+
# - <https://github.com/microsoft/MLOS/issues/1002>
7+
# - .devcontainer/devcontainer.json
8+
FROM mcr.microsoft.com/vscode/devcontainers/base:bookworm AS base
59

610
# Add some additional packages for the devcontainer terminal environment.
711
USER root
@@ -80,6 +84,8 @@ RUN echo "Setup miniconda" \
8084
&& /opt/conda/bin/conda init \
8185
&& /opt/conda/bin/conda config --set channel_priority strict \
8286
&& /opt/conda/bin/conda info \
87+
&& /opt/conda/bin/conda config --show \
88+
&& /opt/conda/bin/conda tos accept --override-channels --channel defaults \
8389
&& /opt/conda/bin/conda update -v -y -n base -c conda-forge -c defaults --all \
8490
&& /opt/conda/bin/conda list -n base \
8591
&& /opt/conda/bin/conda install -v -y -n base -c conda-forge -c defaults conda-libmamba-solver \

.devcontainer/devcontainer.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,22 @@
3131
"features": {
3232
"ghcr.io/devcontainers/features/azure-cli:1": {},
3333
//"ghcr.io/devcontainers/features/conda:1": {},
34-
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
34+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
35+
// Note: this may be required when moving to Debian Trixie base image.
36+
// See Also:
37+
// - <https://github.com/microsoft/MLOS/issues/1002>
38+
// - .devcontainer/Dockerfile
39+
//"moby": false
40+
},
3541
"ghcr.io/devcontainers/features/github-cli:1": {},
3642
"ghcr.io/stuartleeks/dev-container-features/azure-cli-persistence:0": {},
3743
"ghcr.io/stuartleeks/dev-container-features/shell-history:0": {}
3844
},
45+
"forwardPorts": [
46+
// Make the nginx instance started as a part of `make doc` available to view
47+
// the coverage results.
48+
8080
49+
],
3950
// Use 'postCreateCommand' to run commands after the container is created.
4051
// "postCreateCommand": "python --version",
4152
// Configure tool-specific properties.

.devcontainer/scripts/run-devcontainer.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ docker run -it --rm \
5050
--env http_proxy="${http_proxy:-}" \
5151
--env https_proxy="${https_proxy:-}" \
5252
--env no_proxy="${no_proxy:-}" \
53+
--add-host host.docker.internal:host-gateway \
5354
mlos-devcontainer \
5455
$*

.github/workflows/devcontainer.yml

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,18 @@ jobs:
108108
timeout-minutes: 3
109109
run: |
110110
set -x
111+
gid=`id -g`
112+
docker_sock_gid=`stat -c '%g' /var/run/docker.sock`
113+
docker_gid=`getent group docker | cut -d: -f3 || echo 999`
114+
if [ -n "$docker_sock_gid" ]; then
115+
docker_gid=$docker_sock_gid
116+
echo "Using docker gid: $docker_gid"
117+
fi
118+
if [ "$docker_sock_gid" != "$docker_gid" ] && [ -n "$docker_sock_gid" != "$gid" ] && [ "$docker_sock_gid" != 0 ]; then
119+
echo "WARNING: docker.sock gid ($docker_sock_gid) does not match host docker group gid ($docker_gid) or user gid ($gid)." >&2
120+
fi
111121
docker run -d --rm --user root \
122+
--group-add $docker_sock_gid \
112123
--volume /var/run/docker.sock:/var/run/docker.sock \
113124
--env DOCKER_BUILDKIT=$DOCKER_BUILDKIT \
114125
--volume $(pwd):/workspaces/MLOS \
@@ -129,6 +140,28 @@ jobs:
129140
- name: Print some debug info from inside the container
130141
run: |
131142
docker exec --user vscode --env USER=vscode mlos-devcontainer printenv
143+
docker exec --user vscode --env USER=vscode mlos-devcontainer id
144+
docker exec --user vscode --env USER=vscode mlos-devcontainer ls -l /var/run/docker.sock
145+
docker exec --user vscode --env USER=vscode mlos-devcontainer stat /var/run/docker.sock
146+
147+
- name: Check that docker is usable inside the devcontainer
148+
timeout-minutes: 2
149+
run: |
150+
set -x
151+
docker_sock_gid=`stat -c '%g' /var/run/docker.sock`
152+
if ! [ -w /var/run/docker.sock ] \
153+
|| ! docker exec --user vscode --env USER=vscode mlos-devcontainer id -G | sed 's/ /\n/' | grep -q -w $docker_sock_gid
154+
then
155+
echo "ERROR: vscode user in container does not have access to docker.sock group (gid: $docker_sock_gid)" >&2
156+
exit 1
157+
fi
158+
docker exec --user vscode --env USER=vscode mlos-devcontainer docker version
159+
docker exec --user vscode --env USER=vscode mlos-devcontainer docker info
160+
docker exec --user vscode --env USER=vscode mlos-devcontainer docker buildx version
161+
if ! docker exec --user vscode --env USER=vscode mlos-devcontainer docker buildx ls | grep linux/; then
162+
echo "ERROR: docker buildx does not have linux builder available" >&2
163+
exit 1
164+
fi
132165
133166
- name: Check that github.com is in the ssh known_hosts file
134167
run: |
@@ -170,21 +203,26 @@ jobs:
170203
test_count=$(docker exec --user vscode --env USER=vscode mlos-devcontainer \
171204
conda run -n mlos python -m pytest -svxl -n auto --collect-only --rootdir /workspaces/MLOS -s --cache-clear \
172205
| grep -c '<Function ')
173-
if [ "${test_count:-0}" -lt 725 ]; then echo "Expected at least 725 tests, got '$test_count'" >&2; exit 1; fi
206+
# if [ "${test_count:-0}" -lt 800 ]; then echo "Expected at least 800 tests, got '$test_count'" >&2; exit 1; fi
174207
175208
# Now actually run the tests.
176209
docker exec --user vscode --env USER=vscode mlos-devcontainer make CONDA_INFO_LEVEL=-v test
177210
211+
- name: Upload coverage report as build artifact
212+
if: always() # ensures it runs even if tests fail
213+
uses: actions/upload-artifact@v4
214+
with:
215+
name: coverage-report
216+
path: coverage.xml
217+
178218
- name: Generate and test binary distribution files
179219
timeout-minutes: 10
180220
run: |
181221
set -x
182222
docker exec --user vscode --env USER=vscode mlos-devcontainer make CONDA_INFO_LEVEL=-v dist dist-test
183223
184224
- name: Test rebuilding the devcontainer in the devcontainer
185-
# FIXME:
186-
# timeout-minutes: 3
187-
timeout-minutes: 10
225+
timeout-minutes: 5
188226
run: |
189227
set -x
190228
git --no-pager diff --exit-code

.vscode/settings.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,5 +176,17 @@
176176
"githubPullRequests.experimental.chat": true,
177177
"github.copilot.chat.codesearch.enabled": true,
178178
"github.copilot.chat.copilotDebugCommand.enabled": true,
179-
"github.copilot.chat.reviewSelection.enabled": true
179+
"github.copilot.chat.reviewSelection.enabled": true,
180+
"python-envs.defaultEnvManager": "ms-python.python:conda",
181+
"python-envs.defaultPackageManager": "ms-python.python:conda",
182+
// Make the nginx instance started as a part of `make doc` available to view
183+
// the coverage results.
184+
"remote.localPortHost": "localhost",
185+
"remote.SSH.defaultForwardedPorts": [
186+
{
187+
"name": "nginx for doc viewing",
188+
"localPort": 8080,
189+
"remotePort": 8080
190+
}
191+
]
180192
}

conda-envs/mlos-3.10.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ dependencies:
2020
- python=3.10
2121
# See comments in mlos.yml.
2222
#- gcc_linux-64
23+
# Install an SMAC requirement pre-compiled from conda-forge.
24+
# See Also: https://github.com/microsoft/MLOS/issues/1001
25+
- pyrfr>=0.9.0
2326
- pip:
2427
- bump2version
2528
- check-jsonschema
@@ -30,7 +33,7 @@ dependencies:
3033
- pylint==3.3.7
3134
- tomlkit
3235
- mypy==1.15.0
33-
- pyright==1.1.400
36+
- pyright==1.1.406
3437
- pandas-stubs
3538
- types-beautifulsoup4
3639
- types-colorama

conda-envs/mlos-3.11.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ dependencies:
2020
- python=3.11
2121
# See comments in mlos.yml.
2222
#- gcc_linux-64
23+
# Install an SMAC requirement pre-compiled from conda-forge.
24+
# See Also: https://github.com/microsoft/MLOS/issues/1001
25+
- pyrfr>=0.9.0
2326
- pip:
2427
- bump2version
2528
- check-jsonschema
@@ -30,7 +33,7 @@ dependencies:
3033
- pylint==3.3.7
3134
- tomlkit
3235
- mypy==1.15.0
33-
- pyright==1.1.400
36+
- pyright==1.1.406
3437
- pandas-stubs
3538
- types-beautifulsoup4
3639
- types-colorama

conda-envs/mlos-3.12.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ dependencies:
2222
- python=3.12
2323
# See comments in mlos.yml.
2424
#- gcc_linux-64
25+
# Install an SMAC requirement pre-compiled from conda-forge.
26+
# See Also: https://github.com/microsoft/MLOS/issues/1001
27+
- pyrfr>=0.9.0
2528
- pip:
2629
- bump2version
2730
- check-jsonschema
@@ -32,7 +35,7 @@ dependencies:
3235
- pylint==3.3.7
3336
- tomlkit
3437
- mypy==1.15.0
35-
- pyright==1.1.400
38+
- pyright==1.1.406
3639
- pandas-stubs
3740
- types-beautifulsoup4
3841
- types-colorama

conda-envs/mlos-3.13.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ dependencies:
2222
- python=3.13
2323
# See comments in mlos.yml.
2424
#- gcc_linux-64
25+
# Install an SMAC requirement pre-compiled from conda-forge.
26+
# See Also: https://github.com/microsoft/MLOS/issues/1001
27+
- pyrfr>=0.9.0
2528
- pip:
2629
- bump2version
2730
- check-jsonschema
@@ -32,7 +35,7 @@ dependencies:
3235
- pylint==3.3.7
3336
- tomlkit
3437
- mypy==1.15.0
35-
- pyright==1.1.400
38+
- pyright==1.1.406
3639
- pandas-stubs
3740
- types-beautifulsoup4
3841
- types-colorama

conda-envs/mlos-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dependencies:
3333
- pylint==3.3.7
3434
- tomlkit
3535
- mypy==1.15.0
36-
- pyright==1.1.400
36+
- pyright==1.1.406
3737
- pandas-stubs
3838
- types-beautifulsoup4
3939
- types-colorama

0 commit comments

Comments
 (0)