Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(docker): upgrade to ubuntu 24.04 and Python 3.12 #721

Merged
merged 2 commits into from
Aug 7, 2024
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
44 changes: 22 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on: [push, pull_request]

jobs:
lint-commitlint:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -33,10 +33,10 @@ jobs:
- name: Check commit message compliance of the pull request
if: github.event_name == 'pull_request'
run: |
./run-tests.sh --check-commitlint ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.number }}
./run-tests.sh --check-commitlint ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.number }}

lint-shellcheck:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

Expand All @@ -46,14 +46,14 @@ jobs:
./run-tests.sh --check-shellcheck

lint-black:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.12"

- name: Install Python dependencies
run: pip install black
Expand All @@ -62,15 +62,15 @@ jobs:
run: ./run-tests.sh --check-black

lint-flake8:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.12"

- name: Check compliance with pep8, pyflakes and circular complexity
run: |
Expand All @@ -79,14 +79,14 @@ jobs:
./run-tests.sh --check-flake8

lint-pydocstyle:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.12"

- name: Install Python dependencies
run: pip install pydocstyle
Expand All @@ -95,14 +95,14 @@ jobs:
run: ./run-tests.sh --check-pydocstyle

lint-check-manifest:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.12"

- name: Install Python dependencies
run: pip install check-manifest
Expand All @@ -111,7 +111,7 @@ jobs:
run: ./run-tests.sh --check-manifest

lint-dockerfile:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -120,7 +120,7 @@ jobs:
run: ./run-tests.sh --check-dockerfile

docker-build:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -131,14 +131,14 @@ jobs:
./run-tests.sh --check-docker-run

docs-cli-commands:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.12"

- name: Install Python dependencies
run: |
Expand All @@ -149,14 +149,14 @@ jobs:
run: ./run-tests.sh --check-cli-cmds

docs-cli-api:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.12"

- name: Install Python dependencies
run: |
Expand All @@ -167,14 +167,14 @@ jobs:
run: ./run-tests.sh --check-cli-api

docs-sphinx:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.12"

- name: Install Python dependencies
run: |
Expand All @@ -185,7 +185,7 @@ jobs:
run: ./run-tests.sh --check-sphinx

python-tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
testenv: [lowest, release]
Expand Down Expand Up @@ -219,14 +219,14 @@ jobs:
run: ./run-tests.sh --check-pytest

- name: Codecov Coverage
if: matrix.python-version == '3.8'
if: matrix.python == '3.12'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml

release-docker:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
if: >
vars.RELEASE_DOCKER == 'true' &&
github.event_name == 'push' &&
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
version: 2

build:
os: ubuntu-22.04
os: ubuntu-24.04
tools:
python: "3.8"
python: "3.12"

sphinx:
configuration: docs/conf.py
Expand Down
25 changes: 13 additions & 12 deletions Dockerfile
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: update also AppImage script

Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
# under the terms of the MIT License; see LICENSE file for more details.

# Use Ubuntu LTS base image
FROM docker.io/library/ubuntu:20.04
FROM docker.io/library/ubuntu:24.04

# Use default answers in installation commands
ENV DEBIAN_FRONTEND=noninteractive

# Use distutils provided by the standard Python library instead of the vendored one in
# setuptools, so that editable installations are stored in the right directory.
# See https://github.com/pypa/setuptools/issues/3301
ENV SETUPTOOLS_USE_DISTUTILS=stdlib
# Allow pip to install packages in the system site-packages dir
ENV PIP_BREAK_SYSTEM_PACKAGES=true

# Add sources to `/code` and work there
WORKDIR /code
Expand All @@ -24,23 +22,26 @@ COPY . /code
RUN apt-get update -y && \
apt-get install --no-install-recommends -y \
gcc \
libpython3.8 \
libpython3.12 \
python3-pip \
python3.8 \
python3.8-dev && \
# `pip3 install kubernetes` needed due to an old version of system pip3
pip3 install --no-cache-dir kubernetes '.[tests]' && \
python3.12 \
python3.12-dev && \
pip3 install --no-cache-dir '.[tests]' && \
apt-get remove -y \
gcc \
python3.8-dev && \
python3.12-dev && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /code /var/lib/apt/lists/*

# Delete default `ubuntu` user, as its UID (1000) clashes with REANA's default one
# See https://bugs.launchpad.net/cloud-images/+bug/2005129
RUN userdel -r ubuntu

# Run container as `reana` user with UID `1000`, which should match
# current host user in most situations
# hadolint ignore=DL3059
RUN adduser --uid 1000 reana --gid 0 && \
RUN useradd --uid 1000 --gid 0 --create-home reana && \
chown -R reana:root /home/reana
WORKDIR /home/reana

Expand Down
27 changes: 20 additions & 7 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,28 @@ check_commitlint () {
npx commitlint --from="$from" --to="$to"
found=0
while IFS= read -r line; do
if echo "$line" | grep -qP "\(\#$pr\)$"; then
true
elif echo "$line" | grep -qP "^chore\(.*\): release"; then
true
else
echo "✖ Headline does not end by '(#$pr)' PR number: $line"
commit_hash=$(echo "$line" | cut -d ' ' -f 1)
commit_title=$(echo "$line" | cut -d ' ' -f 2-)
commit_number_of_parents=$(git rev-list --parents "$commit_hash" -n1 | awk '{print NF-1}')
# (i) skip checking release commits generated by Release Please
if [ "$commit_number_of_parents" -le 1 ] && echo "$commit_title" | grep -qP "^chore\(.*\): release"; then
continue
fi
# (ii) check presence of PR number
if ! echo "$commit_title" | grep -qP "\(\#$pr\)$"; then
echo "✖ Headline does not end by '(#$pr)' PR number: $commit_title"
found=1
fi
done < <(git log "$from..$to" --format="%s")
# (iii) check absence of merge commits in feature branches
if [ "$commit_number_of_parents" -gt 1 ]; then
if echo "$commit_title" | grep -qP "^chore\(.*\): merge "; then
break # skip checking maint-to-master merge commits
else
echo "✖ Merge commits are not allowed in feature branches: $commit_title"
found=1
fi
fi
done < <(git log "$from..$to" --format="%H %s")
if [ $found -gt 0 ]; then
exit 1
fi
Expand Down
Loading