Skip to content

Commit c2f2802

Browse files
authored
Merge branch 'main' into nbclassic
2 parents 9f351bc + 0639149 commit c2f2802

File tree

16 files changed

+132
-68
lines changed

16 files changed

+132
-68
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ jobs:
5555

5656
- name: Build and upload to ghcr.io 📤
5757
id: build-upload
58-
uses: docker/bake-action@v5
58+
# We need to pin exact version here, since updates can break
59+
# the extract-image-names.sh script
60+
uses: docker/[email protected]
5961
with:
6062
push: true
6163
# Using provenance to disable default attestation so it will build only desired images:
@@ -71,9 +73,15 @@ jobs:
7173
build.json
7274
.github/workflows/env.hcl
7375
74-
- name: Set output variables
76+
- name: Set output image names
7577
id: bake_metadata
78+
# bake-action metadata output has gotten too big, so we first write it
79+
# to a file. See https://github.com/aiidalab/aiidalab-docker-stack/issues/491
7680
run: |
77-
.github/workflows/extract-image-names.sh | tee -a "${GITHUB_OUTPUT}" | awk -F'=' '{print $2}' | jq
78-
env:
79-
BAKE_METADATA: ${{ steps.build-upload.outputs.metadata }}
81+
cat << EOF > bake_metadata.json
82+
${{ steps.build-upload.outputs.metadata }}
83+
EOF
84+
images=$(.github/workflows/extract-image-names.sh bake_metadata.json)
85+
echo "images=${images}" >> "${GITHUB_OUTPUT}"
86+
# Pretty-print for GHA logs
87+
echo "$images" | jq

.github/workflows/extract-image-names.sh

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
set -euo pipefail
44

5+
metadata_file=$1
56
# Extract image names together with their sha256 digests
67
# from the docker/bake-action metadata output.
78
# These together uniquely identify newly built images.
89

9-
# The input to this script is a JSON string passed via BAKE_METADATA env variable
10+
# The input to this script is a json file (filename passed as first parameter to the script)
1011
# Here's example input (trimmed to relevant bits):
11-
# BAKE_METADATA: {
12+
# {
1213
# "base": {
1314
# "containerimage.descriptor": {
1415
# "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
@@ -35,23 +36,17 @@ set -euo pipefail
3536
# }
3637
# }
3738
#
38-
# Example output (real output is on one line):
39+
# Example output with trimmed SHAs (real output is on one line):
3940
#
40-
# images={
41-
# "BASE_IMAGE": "ghcr.io/aiidalab/base@sha256:8e57a52b924b67567314b8ed3c968859cad99ea13521e60bbef40457e16f391d",
42-
# "BASE_WITH_SERVICES_IMAGE": "ghcr.io/aiidalab/base-with-services@sha256:6753a809b5b2675bf4c22408e07c1df155907a465b33c369ef93ebcb1c4fec26",
43-
# "FULL_STACK_IMAGE": "ghcr.io/aiidalab/full-stack@sha256:85ee91f61be1ea601591c785db038e5899d68d5fb89e07d66d9efbe8f352ee48",
44-
# "LAB_IMAGE": "ghcr.io/aiidalab/lab@sha256:4d9be090da287fcdf2d4658bb82f78bad791ccd15dac9af594fb8306abe47e97"
41+
# {
42+
# "BASE_IMAGE": "ghcr.io/aiidalab/base@sha256:8e57a52b92",
43+
# "BASE_WITH_SERVICES_IMAGE": "ghcr.io/aiidalab/base-with-services@sha256:6753a809",
44+
# "FULL_STACK_IMAGE": "ghcr.io/aiidalab/full-stack@sha256:85ee91f61be",
45+
# "LAB_IMAGE": "ghcr.io/aiidalab/lab@sha256:4d9be090da2"
4546
# }
4647
#
4748
# This json output is later turned to environment variables using fromJson() GHA builtin
4849
# (e.g. BASE_IMAGE=ghcr.io/aiidalab/base@sha256:8e57a52b...)
4950
# and these are in turn read in the docker-compose.<target>.yml files for tests.
5051

51-
if [[ -z ${BAKE_METADATA-} ]];then
52-
echo "ERROR: Environment variable BAKE_METADATA is not set!"
53-
exit 1
54-
fi
55-
56-
images=$(echo "${BAKE_METADATA}" | jq -c '. as $base |[to_entries[] |{"key": (.key|ascii_upcase|sub("-"; "_"; "g") + "_IMAGE"), "value": [(.value."image.name"|split(",")[0]),.value."containerimage.digest"]|join("@")}] |from_entries')
57-
echo "images=$images"
52+
jq -c '. as $base |[to_entries[] |{"key": (.key|ascii_upcase|sub("-"; "_"; "g") + "_IMAGE"), "value": [(.value."image.name"|split(",")[0]),.value."containerimage.digest"]|join("@")}] |from_entries' $metadata_file

.github/workflows/main.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,11 @@ jobs:
5555
runsOn: ubuntu-22.04
5656
platforms: linux/amd64,linux/arm64
5757

58-
# To save arm64 runner resources, we run the tests only on main
59-
# and only for full-stack image (same for integration tests below).
6058
test-arm64:
61-
if: >-
62-
github.repository == 'aiidalab/aiidalab-docker-stack'
63-
&& (github.ref_type == 'tag' || github.ref_name == 'main')
6459
needs: build
6560
uses: ./.github/workflows/test.yml
6661
with:
67-
runsOn: buildjet-4vcpu-ubuntu-2204-arm
62+
runsOn: ubuntu-22.04-arm
6863
images: ${{ needs.build.outputs.images }}
6964
target: full-stack
7065
integration: false
@@ -74,16 +69,8 @@ jobs:
7469
needs: build
7570
strategy:
7671
fail-fast: false
77-
# Trick to exclude arm64 tests from PRs
78-
# https://github.com/orgs/community/discussions/26253
7972
matrix:
80-
runner: [ubuntu-22.04, buildjet-4vcpu-ubuntu-2204-arm]
81-
isPR:
82-
- ${{ github.event_name == 'pull_request' }}
83-
exclude:
84-
- isPR: true
85-
runner: buildjet-4vcpu-ubuntu-2204-arm
86-
73+
runner: [ubuntu-22.04, ubuntu-22.04-arm]
8774
uses: ./.github/workflows/test.yml
8875
with:
8976
runsOn: ${{ matrix.runner }}
@@ -120,7 +107,7 @@ jobs:
120107
needs: [publish-dockerhub]
121108

122109
steps:
123-
- uses: softprops/action-gh-release@v2.0.6
110+
- uses: softprops/action-gh-release@v2
124111
name: Create release
125112
with:
126113
generate_release_notes: true

.github/workflows/test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ jobs:
5151
cache: pip
5252

5353
- name: Install dependencies 📦
54-
run: |
55-
pip install -r requirements.txt
56-
pip freeze
54+
run: pip install -r requirements.txt
5755

5856
- name: Run tests
5957
run: pytest -s -m "${{ inputs.integration && 'integration' || 'not integration' }}" --target ${{inputs.target}}

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ci:
55
repos:
66

77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v4.6.0
8+
rev: v5.0.0
99
hooks:
1010
- id: check-json
1111
- id: end-of-file-fixer
@@ -18,14 +18,14 @@ repos:
1818
args: [--preserve-quotes]
1919

2020
- repo: https://github.com/astral-sh/ruff-pre-commit
21-
rev: v0.5.0
21+
rev: v0.9.2
2222
hooks:
2323
- id: ruff-format
2424
- id: ruff
2525
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
2626

2727
- repo: https://github.com/python-jsonschema/check-jsonschema
28-
rev: "0.28.6"
28+
rev: "0.31.0"
2929
hooks:
3030
- id: check-dependabot
3131
- id: check-github-workflows

build.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
"default": "3.9.13"
1111
},
1212
"AIIDA_VERSION": {
13-
"default": "2.5.1"
13+
"default": "2.6.3"
1414
},
1515
"AIIDALAB_VERSION": {
16-
"default": "24.07.0"
16+
"default": "24.09.0"
1717
},
1818
"AIIDALAB_HOME_VERSION": {
19-
"default": "23.03.1"
19+
"default": "25.01.0"
2020
}
2121
}
2222
}

bumpver.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpver]
2-
current_version = "v2024.1021"
2+
current_version = "v2025.1025"
33
version_pattern = "vYYYY.BUILD[-TAG]"
44
commit_message = "Bump version {old_version} -> {new_version}."
55
commit = true

requirements.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
docker
2+
requests
3+
pre-commit
4+
pytest~=7.0
5+
pytest-docker
6+
doit
7+
dunamai

requirements.txt

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
1-
docker
2-
requests
3-
pre-commit
4-
pytest~=7.0
5-
pytest-docker
6-
doit
7-
dunamai
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile --universal --python 3.9 requirements.in --annotation-style=line -o requirements.txt
3+
attrs==24.3.0 # via pytest-docker
4+
certifi==2024.12.14 # via requests
5+
cfgv==3.4.0 # via pre-commit
6+
charset-normalizer==3.4.1 # via requests
7+
cloudpickle==3.1.1 # via doit
8+
colorama==0.4.6 ; sys_platform == 'win32' # via pytest
9+
distlib==0.3.9 # via virtualenv
10+
docker==7.1.0 # via -r requirements.in
11+
doit==0.36.0 # via -r requirements.in
12+
dunamai==1.23.0 # via -r requirements.in
13+
exceptiongroup==1.2.2 ; python_full_version < '3.11' # via pytest
14+
filelock==3.17.0 # via virtualenv
15+
identify==2.6.6 # via pre-commit
16+
idna==3.10 # via requests
17+
importlib-metadata==8.6.1 # via doit
18+
iniconfig==2.0.0 # via pytest
19+
nodeenv==1.9.1 # via pre-commit
20+
packaging==24.2 # via dunamai, pytest
21+
platformdirs==4.3.6 # via virtualenv
22+
pluggy==1.5.0 # via pytest
23+
pre-commit==4.1.0 # via -r requirements.in
24+
pytest==7.4.4 # via pytest-docker, -r requirements.in
25+
pytest-docker==3.1.1 # via -r requirements.in
26+
pywin32==308 ; sys_platform == 'win32' # via docker
27+
pyyaml==6.0.2 # via pre-commit
28+
requests==2.32.3 # via docker, -r requirements.in
29+
tomli==2.2.1 ; python_full_version < '3.11' # via pytest
30+
urllib3==2.3.0 # via docker, requests
31+
virtualenv==20.29.1 # via pre-commit
32+
zipp==3.21.0 # via importlib-metadata

stack/base/Dockerfile

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ USER root
1010
# https://pymatgen.org/installation.html#installation-tips-for-optional-libraries
1111
# rsync: needed to support the new AiiDA backup command
1212
# povray: rendering engine used in aiidalab-widgets-base
13-
ENV EXTRA_APT_PACKAGES "curl povray rsync build-essential"
13+
# bc: needed to compute the resources for computer setup
14+
ENV EXTRA_APT_PACKAGES "curl povray rsync build-essential bc"
1415

1516
# For ARM64 we need to install erlang as it is not available on conda-forge
1617
# (this is needed later as rabbitmq dependency in base-with-services image,
@@ -41,18 +42,31 @@ RUN cat /opt/requirements.txt | xargs -I{} conda config --system --add pinned_pa
4142

4243
# Configure pip to use the same requirements file as constraints file.
4344
ENV PIP_CONSTRAINT /opt/requirements.txt
44-
# Ensure that pip installs packages to ~/.local by default
45-
ENV PIP_USER 1
45+
# Ensure that pip installs packages to '~/.local/lib/python3.X/site-packages/' by default
46+
# by implicitly passing the '--user' option to 'pip install'
47+
# Otherwise, pip would install into /opt/conda and such packages would be lost
48+
# when the container exits.
49+
# NOTE: We specifically chose the location '/opt/conda/pip.conf'
50+
# which represents the 'site' config file when VIRTUAL_ENV is not set, per:
51+
# https://pip.pypa.io/en/stable/topics/configuration/#configuration-files
52+
# Other locations such as '~/.config/pip/pip.conf' or '/etc/pip.conf' would interfere with virtual environments,
53+
# for example those used by pre-commit.
54+
# We can't use the PIP_USER env variable for the same reason.
55+
# To better understand this, try running `pip config debug` and see
56+
# https://github.com/aiidalab/aiidalab-docker-stack/issues/501
57+
COPY pip.conf "${CONDA_DIR}/pip.conf"
4658

4759
# Upgrade pip and mamba to latest
60+
# Update async_generator, certipy to satisfy `pip check`
61+
# https://github.com/aiidalab/aiidalab-docker-stack/issues/490
4862
# Install aiida-core and other shared requirements.
49-
RUN mamba update -y pip zstandard && \
63+
RUN mamba update -y pip zstandard async_generator certipy && \
5064
mamba install --yes \
5165
aiida-core==${AIIDA_VERSION} \
5266
mamba-bash-completion \
67+
traitlets=5.9.0 \
5368
&& mamba clean --all -f -y && \
54-
fix-permissions "${CONDA_DIR}" && \
55-
fix-permissions "/home/${NB_USER}"
69+
fix-permissions "${CONDA_DIR}"
5670

5771
# Enable verdi autocompletion.
5872
RUN mkdir -p "${CONDA_DIR}/etc/conda/activate.d" && \

0 commit comments

Comments
 (0)