-
Notifications
You must be signed in to change notification settings - Fork 27
Refactor Docker Images, Evaluator Images Simple CI #823
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
Changes from 24 commits
4b1e0c1
6b80e5b
61fa33e
bf8ec57
a0b337e
1009628
25233f1
c323f44
fe00a11
a0d9156
527eaaf
a619225
dfc016e
76b3825
dd0e1d8
7537da6
bb9fec4
e21081f
f523239
8faa012
1fe0b1f
df15c62
8424e37
0e60ace
95a0109
a8c126d
254f02a
68eea93
52f0e86
c63b6b7
0199ceb
9ef32d5
7424d46
16f8252
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: Evaluator Docker Images | ||
|
|
||
| on: | ||
| pull_request: | ||
| merge_group: | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') && 'build' || github.sha }} | ||
| cancel-in-progress: ${{ github.event_name != 'merge_group' }} | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Detect changes | ||
| id: changed-files | ||
| uses: tj-actions/changed-files@v47.0.1 | ||
| with: | ||
| files: | | ||
| evaluator/images/** | ||
| .github/workflows/build-evaluator-images.yml | ||
|
|
||
| - name: Set up Docker Buildx | ||
| if: steps.changed-files.outputs.any_changed == 'true' | ||
| uses: docker/setup-buildx-action@v3 | ||
| with: | ||
| driver: docker | ||
|
|
||
| - name: Build images | ||
| if: steps.changed-files.outputs.any_changed == 'true' | ||
| run: | | ||
| python3 evaluator/images/build.py | ||
|
|
||
| # Summary job to enable easier handling of required status checks. | ||
| # On PRs, we need everything to be green, while deploy jobs are skipped. | ||
| # On master, we need everything to be green. | ||
| # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! | ||
| conclusion: | ||
|
||
| needs: [ build ] | ||
| # We need to ensure this job does *not* get skipped if its dependencies fail, | ||
| # because a skipped job is considered a success by GitHub. So we have to | ||
| # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run | ||
| # when the workflow is canceled manually. | ||
| if: ${{ !cancelled() }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Conclusion Images | ||
| run: | | ||
| # Print the dependent jobs to see them in the CI log | ||
| jq -C <<< '${{ toJson(needs) }}' | ||
| # Check if all jobs that we depend on (in the needs array) | ||
| # were either successful or skipped. | ||
| jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ concurrency: | |
| env: | ||
| # Configure a constant location for the uv cache | ||
| UV_CACHE_DIR: /tmp/.uv-cache | ||
| UV_VERSION: "0.9.20" | ||
| UV_VERSION: "0.10.0" | ||
|
|
||
|
|
||
| jobs: | ||
|
|
@@ -95,6 +95,9 @@ jobs: | |
|
|
||
| test-deployment-service: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: deployment_service/ | ||
|
|
||
| steps: | ||
| - name: Checkout sources | ||
|
|
@@ -114,32 +117,26 @@ jobs: | |
| working-directory: "deployment_service" | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: deployment_service/ | ||
| run: | | ||
| uv sync --frozen | ||
|
|
||
| - name: Ruff Linter | ||
| working-directory: deployment_service/ | ||
| run: uv run ruff check --output-format=github | ||
|
|
||
| - name: Ruff Formatter | ||
| if: success() || failure() | ||
| working-directory: deployment_service/ | ||
| run: uv run ruff format --check | ||
|
|
||
| - name: Check lockfile | ||
| if: success() || failure() | ||
| working-directory: deployment_service/ | ||
| run: uv lock --locked | ||
|
|
||
| - name: MyPy | ||
| if: success() || failure() | ||
| working-directory: deployment_service/ | ||
| run: | | ||
| uv run mypy --check . | ||
|
|
||
| - name: Run tests | ||
| working-directory: deployment_service/ | ||
| run: uv run pytest | ||
| env: | ||
| SECURITY__WEBHOOK_SECRET: "yoursecretvalue" | ||
|
|
@@ -166,21 +163,21 @@ jobs: | |
| - name: Build Kelvin Docker image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| cache-from: type=registry,ref=ghcr.io/mrlvsb/kelvin-ci-cache | ||
| cache-from: type=gha | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was the switch made?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Due to maintenance of the registry storage (LRU is used there automatically) and also the readability/visibility of that registry. Also this is official way and recommendation from GitHub and Docker. |
||
| # Only write the cache in the master branch or workflow_dispatch builds | ||
| # https://github.com/docker/build-push-action/issues/845#issuecomment-1512619265 | ||
| cache-to: ${{ (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') && 'type=registry,ref=ghcr.io/mrlvsb/kelvin-ci-cache,compression=zstd' || '' }} | ||
| cache-to: ${{ (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') && 'type=gha,mode=max' || '' }} | ||
| tags: ghcr.io/mrlvsb/kelvin:latest,ghcr.io/mrlvsb/kelvin:${{ github.sha }} | ||
| outputs: type=docker,dest=${{ runner.temp }}/kelvin.tar | ||
|
|
||
| - name: Build Deployment_service Docker image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: "{{defaultContext}}:deployment_service" | ||
| cache-from: type=registry,ref=ghcr.io/mrlvsb/deployment-ci-cache | ||
| cache-from: type=gha | ||
| # Only write the cache in the master branch or workflow_dispatch builds | ||
| # https://github.com/docker/build-push-action/issues/845#issuecomment-1512619265 | ||
| cache-to: ${{ (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') && 'type=registry,ref=ghcr.io/mrlvsb/deployment-ci-cache,compression=zstd' || '' }} | ||
| cache-to: ${{ (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') && 'type=gha,mode=max' || '' }} | ||
| tags: ghcr.io/mrlvsb/deployment:latest,ghcr.io/mrlvsb/deployment:${{ github.sha }} | ||
| outputs: type=docker,dest=${{ runner.temp }}/deployment.tar | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main issue that we have with the images is not that they break after we change them, but that they break when something external changes, most often
aptrepositories. So it would be great to run CI periodically to detect that sooner.One way of doing that is running them always in CI, without file change detection. That has the annoying property that it can break CI for unrelated PRs. Another possibility is to setup a cron, to run this e.g. once a week. I'd go with the cron for now (in addition to the existing triggers).