Skip to content

Commit 2e5e1bd

Browse files
authored
Catch and log all exceptions during docker processing. (#104)
* Catch and log all exceptions during docker processing. * update workflows * update workflows
1 parent a07cd54 commit 2e5e1bd

5 files changed

Lines changed: 59 additions & 49 deletions

File tree

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
name: 'Prepare environment'
2-
description: 'Prepare environment'
2+
description: Install Poetry and Python dependencies
33

44
runs:
55
using: "composite"
66
steps:
7-
- name: Show ubuntu version
8-
run: lsb_release -a
9-
shell: bash
10-
- run: sudo apt-get update
11-
shell: bash
12-
- name: Setup libraries
13-
run: |
14-
sudo apt-get install -y \
15-
pipx
7+
- name: Setup PATH
8+
run: echo "/home/runner/.local/bin" >> $GITHUB_PATH
169
shell: bash
10+
1711
- name: Install Poetry
1812
run: pipx install poetry==$(head -n 1 .poetry-version)
1913
shell: bash
14+
2015
- uses: actions/setup-python@v5
2116
with:
2217
python-version-file: '.python-version'
2318
cache: 'poetry'
19+
2420
- name: Install dependencies
25-
run: poetry install --only main,dev --no-interaction --no-ansi
21+
run: poetry install --only main,dev --no-interaction --no-ansi --no-root
22+
shell: bash
23+
24+
- name: Report versions
25+
run: |
26+
poetry --version
27+
poetry run python --version
28+
poetry run ruff --version
2629
shell: bash

.github/workflows/auto-author-assign.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ on:
44
pull_request_target:
55
types: [ opened, reopened ]
66

7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref_name }}
9+
cancel-in-progress: false
10+
711
permissions:
812
pull-requests: write
913

1014
jobs:
1115
assign-author:
12-
runs-on: [self-hosted, small]
16+
runs-on: arc-runners-small
17+
timeout-minutes: 30
18+
if: ${{ !github.event.pull_request.assignee }}
1319
steps:
14-
- uses: toshimaru/auto-author-assign@v2.1.1
20+
- uses: toshimaru/auto-author-assign@v3.0.1

.github/workflows/auto-format.yml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,42 @@
11
name: Format code
2+
23
on:
34
pull_request:
45
push:
56
branches:
6-
- main
7+
- master
8+
paths-ignore:
9+
- .github/**
10+
workflow_dispatch:
711

812
concurrency:
913
group: ${{ github.workflow }}-${{ github.ref_name }}
10-
cancel-in-progress: false
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: write
18+
actions: write
1119

1220
jobs:
1321
format:
1422
name: Format and lint with ruff
15-
runs-on: [self-hosted, small]
23+
runs-on: arc-runners-small
24+
timeout-minutes: 30
1625
steps:
17-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@v6
1827
with:
1928
repository: ${{ github.event.pull_request.head.repo.full_name }}
2029
ref: ${{ github.event.pull_request.head.ref }}
2130

22-
- name: Install Poetry
23-
run: pipx install poetry==$(head -n 1 .poetry-version)
24-
25-
- uses: actions/setup-python@v5
26-
with:
27-
python-version-file: '.python-version'
28-
cache: 'poetry'
29-
30-
- name: Install dependencies
31-
run: poetry install --no-interaction --no-ansi --no-root
32-
33-
- name: Check files using the ruff formatter
34-
run: poetry run ruff format
31+
- uses: ./.github/workflows/actions/prepare
3532

36-
- name: Check files using the ruff linter
37-
run: poetry run ruff check --fix --unsafe-fixes --preview --exit-zero .
33+
- run: poetry run ruff check --fix --unsafe-fixes --preview --exit-zero .
34+
- run: poetry run ruff format .
3835

3936
- name: Commit changes
4037
uses: EndBug/add-and-commit@v9
4138
with:
39+
fetch: false
40+
default_author: github_actions
4241
message: 'Auto format'
43-
add: '*.py'
42+
add: '.'

.github/workflows/ci.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: Deploy
1+
name: CI
2+
23
on:
34
push:
45
branches:
5-
- 'master'
6+
- master
67
pull_request:
78

89
concurrency:
@@ -11,20 +12,21 @@ concurrency:
1112

1213
jobs:
1314
tests:
14-
name: Tests
15-
runs-on: [self-hosted, small]
16-
steps:
17-
- uses: actions/checkout@v4
15+
name: Tests
16+
runs-on: arc-runners-small
17+
timeout-minutes: 30
18+
steps:
19+
- uses: actions/checkout@v6
1820

19-
- uses: ./.github/workflows/actions/prepare
21+
- uses: ./.github/workflows/actions/prepare
2022

21-
- name: Login to Docker Hub
22-
uses: docker/login-action@v3
23-
with:
24-
registry: hyperskill.azurecr.io
25-
username: ${{ secrets.REGISTRY_USER }}
26-
password: ${{ secrets.REGISTRY_PASSWORD }}
23+
- name: Login to Docker Hub
24+
uses: docker/login-action@v3
25+
with:
26+
registry: hyperskill.azurecr.io
27+
username: ${{ secrets.REGISTRY_USER }}
28+
password: ${{ secrets.REGISTRY_PASSWORD }}
2729

28-
- run: docker pull hyperskill.azurecr.io/epicbox/python:3.11.5-c0347e7d1
30+
- run: docker pull hyperskill.azurecr.io/epicbox/python:3.11.5-c0347e7d1
2931

30-
- run: poetry run pytest .
32+
- run: poetry run pytest .

epicbox/sandboxes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def working_directory() -> Iterator[WorkingDirectory]:
313313
log.info("Creating new docker volume for working directory")
314314
try:
315315
volume = docker_client.volumes.create(volume_name)
316-
except (RequestException, DockerException) as e:
316+
except Exception as e:
317317
log.exception("Failed to create a docker volume")
318318
raise exceptions.DockerError(str(e)) from e
319319
log.info("New docker volume is created")

0 commit comments

Comments
 (0)