Skip to content

Commit 82bae77

Browse files
feat: Remove old Fluent version support (#4690)
## Context Fluent versions before 24.2 are not currently supported by Ansys. So, we don't need to support those old versions in PyFluent. Also, as patches are not released for those Fluent versions, we shouldn't point users to use those versions. ## Change Summary 1. Restrict the supported Fluent versions to 24.2 - 26.2 in code. I've included next dev version as it has been requested. 2. Update the minimum supported Fluent version to 24.2 in doc. 3. Added a CI script `.ci\docker_data_cleaner.py` to remove all docker data except the supported Fluent images. The script will be run before and after every job that starts a Fluent container. Currently, the self-hosted runners don't have the sufficient space to cache all supported Fluent images, but that won't be a problem anymore. I've also deleted other docker-related cleanup scripts. ## Rationale We have aligned the supported Fluent version range with the versions supported by Ansys. ## Impact Package size will be reduced. CI speedup is expected. --------- Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com>
1 parent 146355d commit 82bae77

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+794
-1943
lines changed

.ci/docker_data_cleaner.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""
2+
Script to clean up all docker data except for specified images.
3+
Run this script before and after each job that starts the Fluent docker container.
4+
Must set the FLUENT_STABLE_IMAGE_DEV environment variable to the dev image sha256 value.
5+
"""
6+
7+
import os
8+
import subprocess
9+
10+
IMAGE_TAGS_TO_RETAIN = ["v24.2.5", "v25.1.4", "v25.2.3"]
11+
12+
13+
def clean_docker_data():
14+
"""Cleans up all docker data except for specified images.
15+
16+
Raises
17+
------
18+
OSError
19+
If FLUENT_STABLE_IMAGE_DEV environment variable is not set.
20+
"""
21+
# Stop and remove all containers
22+
container_ids = subprocess.check_output(["docker", "ps", "-aq"]).decode().split()
23+
for container_id in container_ids:
24+
subprocess.run(["docker", "rm", "-f", container_id], check=True)
25+
26+
# Remove all images except those in IMAGE_TAGS_TO_RETAIN and the dev image
27+
images_to_retain = [f"ghcr.io/ansys/fluent:{tag}" for tag in IMAGE_TAGS_TO_RETAIN]
28+
dev_image_sha = os.getenv("FLUENT_STABLE_IMAGE_DEV")
29+
if not dev_image_sha:
30+
raise OSError("FLUENT_STABLE_IMAGE_DEV environment variable is not set.")
31+
32+
images_output = subprocess.check_output(
33+
[
34+
"docker",
35+
"images",
36+
"--format",
37+
"{{.Repository}}:{{.Tag}} {{.ID}}",
38+
"--no-trunc",
39+
]
40+
).decode()
41+
for line in images_output.splitlines():
42+
image, image_id = line.strip().split()
43+
if image not in images_to_retain and image_id != dev_image_sha:
44+
subprocess.run(["docker", "rmi", "-f", image_id], check=True)
45+
46+
# Remove everything else (networks, volumes)
47+
subprocess.run(["docker", "system", "prune", "-f", "--volumes"], check=True)
48+
49+
50+
if __name__ == "__main__":
51+
clean_docker_data()

.github/workflows/ci.yml

Lines changed: 37 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ jobs:
160160
with:
161161
python-version: ${{ env.PYTHON_VERSION }}
162162

163+
- name: Clean Docker Data
164+
run: make docker-clean-all-except-supported-images
165+
env:
166+
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
167+
163168
- name: Install OS packages
164169
run: |
165170
sudo apt-get update
@@ -259,9 +264,10 @@ jobs:
259264
path: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}.zip
260265
retention-days: 7
261266

262-
- name: Remove all docker images
263-
if: always()
264-
run: make docker-clean-images
267+
- name: Clean Docker Data
268+
run: make docker-clean-all-except-supported-images
269+
env:
270+
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
265271

266272
build:
267273
name: Build
@@ -278,6 +284,11 @@ jobs:
278284
with:
279285
python-version: ${{ env.MAIN_PYTHON_VERSION }}
280286

287+
- name: Clean Docker Data
288+
run: make docker-clean-all-except-supported-images
289+
env:
290+
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
291+
281292
- name: Cache pip
282293
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
283294
with:
@@ -313,75 +324,9 @@ jobs:
313324
path: src/ansys/fluent/core/generated
314325
# Combined cache key for all versions:
315326
# API-Code-<Cache version>-<PyFluent version>-<First Fluent release version>-<Last Fluent release version>-<Fluent dev version>-<Hash of codegen files>
316-
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v23.1.0-v25.2.3-${{ vars.FLUENT_STABLE_IMAGE_DEV }}-${{ hashFiles('src/ansys/fluent/core/codegen/**') }}
327+
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-v24.2.0-v25.2.3-${{ vars.FLUENT_STABLE_IMAGE_DEV }}-${{ hashFiles('src/ansys/fluent/core/codegen/**') }}
317328
lookup-only: false # zizmor: ignore[cache-poisoning]
318329

319-
- name: Pull 23.1 Fluent docker image
320-
if: steps.cache-api-code.outputs.cache-hit != 'true'
321-
run: make docker-pull
322-
env:
323-
FLUENT_IMAGE_TAG: v23.1.0
324-
325-
- name: Run 23.1 API codegen
326-
if: steps.cache-api-code.outputs.cache-hit != 'true'
327-
run: make api-codegen
328-
env:
329-
FLUENT_IMAGE_TAG: v23.1.0
330-
PYFLUENT_CODEGEN_SKIP_BUILTIN_SETTINGS: 1
331-
332-
- name: Print 23.1 Fluent version info
333-
run: |
334-
cat src/ansys/fluent/core/generated/fluent_version_231.py
335-
python -c "from src.ansys.fluent.core.generated.solver.settings_231 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
336-
337-
- name: Remove all docker images
338-
if: always()
339-
run: make docker-clean-images
340-
341-
- name: Pull 23.2 Fluent docker image
342-
if: steps.cache-api-code.outputs.cache-hit != 'true'
343-
run: make docker-pull
344-
env:
345-
FLUENT_IMAGE_TAG: v23.2.0
346-
347-
- name: Run 23.2 API codegen
348-
if: steps.cache-api-code.outputs.cache-hit != 'true'
349-
run: make api-codegen
350-
env:
351-
FLUENT_IMAGE_TAG: v23.2.0
352-
PYFLUENT_CODEGEN_SKIP_BUILTIN_SETTINGS: 1
353-
354-
- name: Print 23.2 Fluent version info
355-
run: |
356-
cat src/ansys/fluent/core/generated/fluent_version_232.py
357-
python -c "from src.ansys.fluent.core.generated.solver.settings_232 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
358-
359-
- name: Remove all docker images
360-
if: always()
361-
run: make docker-clean-images
362-
363-
- name: Pull 24.1 Fluent docker image
364-
if: steps.cache-api-code.outputs.cache-hit != 'true'
365-
run: make docker-pull
366-
env:
367-
FLUENT_IMAGE_TAG: v24.1.0
368-
369-
- name: Run 24.1 API codegen
370-
if: steps.cache-api-code.outputs.cache-hit != 'true'
371-
run: make api-codegen
372-
env:
373-
FLUENT_IMAGE_TAG: v24.1.0
374-
PYFLUENT_CODEGEN_SKIP_BUILTIN_SETTINGS: 1
375-
376-
- name: Print 24.1 Fluent version info
377-
run: |
378-
cat src/ansys/fluent/core/generated/fluent_version_241.py
379-
python -c "from src.ansys.fluent.core.generated.solver.settings_241 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
380-
381-
- name: Remove all docker images
382-
if: always()
383-
run: make docker-clean-images
384-
385330
- name: Pull 24.2 Fluent docker image
386331
if: steps.cache-api-code.outputs.cache-hit != 'true'
387332
run: make docker-pull
@@ -400,10 +345,6 @@ jobs:
400345
cat src/ansys/fluent/core/generated/fluent_version_242.py
401346
python -c "from src.ansys.fluent.core.generated.solver.settings_242 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
402347
403-
- name: Remove all docker images
404-
if: always()
405-
run: make docker-clean-images
406-
407348
- name: Pull 25.1 Fluent docker image
408349
if: steps.cache-api-code.outputs.cache-hit != 'true'
409350
run: make docker-pull
@@ -422,10 +363,6 @@ jobs:
422363
cat src/ansys/fluent/core/generated/fluent_version_251.py
423364
python -c "from src.ansys.fluent.core.generated.solver.settings_251 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
424365
425-
- name: Remove all docker images
426-
if: always()
427-
run: make docker-clean-images
428-
429366
- name: Pull 25.2 Fluent docker image
430367
if: steps.cache-api-code.outputs.cache-hit != 'true'
431368
run: make docker-pull
@@ -444,10 +381,6 @@ jobs:
444381
cat src/ansys/fluent/core/generated/fluent_version_252.py
445382
python -c "from src.ansys.fluent.core.generated.solver.settings_252 import SHASH; print(f'SETTINGS_HASH = {SHASH}')"
446383
447-
- name: Remove all docker images
448-
if: always()
449-
run: make docker-clean-images
450-
451384
- name: Pull 26.1 Fluent docker image
452385
if: steps.cache-api-code.outputs.cache-hit != 'true'
453386
run: make docker-pull
@@ -484,9 +417,10 @@ jobs:
484417
dist/*.tar.gz
485418
retention-days: 7
486419

487-
- name: Remove all docker images
488-
if: always()
489-
run: make docker-clean-images
420+
- name: Clean Docker Data
421+
run: make docker-clean-all-except-supported-images
422+
env:
423+
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
490424

491425
test:
492426
name: Unit Testing
@@ -497,12 +431,6 @@ jobs:
497431
fail-fast: false
498432
matrix:
499433
include:
500-
- image-tag: v23.1.0
501-
version: 231
502-
- image-tag: v23.2.0
503-
version: 232
504-
- image-tag: v24.1.0
505-
version: 241
506434
- image-tag: v24.2.5
507435
version: 242
508436
- image-tag: v25.1.4
@@ -526,6 +454,11 @@ jobs:
526454
with:
527455
python-version: ${{ env.MAIN_PYTHON_VERSION }}
528456

457+
- name: Clean Docker Data
458+
run: make docker-clean-all-except-supported-images
459+
env:
460+
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
461+
529462
- name: Download package
530463
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
531464
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
@@ -564,20 +497,17 @@ jobs:
564497
make install-test
565498
make unittest-dev-${MATRIX_VERSION}
566499
567-
- name: Cleanup previous docker containers
568-
if: always()
569-
run: make cleanup-previous-docker-containers
570-
571500
- name: Upload 25.2 Coverage Artifacts
572501
if: matrix.image-tag == 'v25.2.3'
573502
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
574503
with:
575504
name: coverage_report
576505
path: ./htmlcov
577506

578-
- name: Remove all docker images
579-
if: always()
580-
run: make docker-clean-images
507+
- name: Clean Docker Data
508+
run: make docker-clean-all-except-supported-images
509+
env:
510+
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
581511

582512
nightly-dev-test:
583513
name: Release Testing
@@ -596,6 +526,11 @@ jobs:
596526
with:
597527
python-version: ${{ env.MAIN_PYTHON_VERSION }}
598528

529+
- name: Clean Docker Data
530+
run: make docker-clean-all-except-supported-images
531+
env:
532+
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
533+
599534
- name: Cache pip
600535
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
601536
with:
@@ -651,13 +586,10 @@ jobs:
651586
env:
652587
FLUENT_IMAGE_TAG: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
653588

654-
- name: Cleanup previous docker containers
655-
if: always()
656-
run: make cleanup-previous-docker-containers
657-
658-
- name: Remove all docker images
659-
if: always()
660-
run: make docker-clean-images
589+
- name: Clean Docker Data
590+
run: make docker-clean-all-except-supported-images
591+
env:
592+
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
661593

662594
release:
663595
name: Release

.github/workflows/doc-build-dev-nightly.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ jobs:
3838
with:
3939
python-version: "3.11"
4040

41+
- name: Clean Docker Data
42+
run: make docker-clean-all-except-supported-images
43+
env:
44+
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
45+
4146
- name: Install OS packages
4247
run: |
4348
sudo apt update
@@ -128,9 +133,10 @@ jobs:
128133
path: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}.zip
129134
retention-days: 7
130135

131-
- name: Remove all docker images
132-
if: always()
133-
run: make docker-clean-images
136+
- name: Clean Docker Data
137+
run: make docker-clean-all-except-supported-images
138+
env:
139+
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
134140

135141
deploy_dev_docs:
136142
name: "Deploy Documentation"

.github/workflows/doc-build-release.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ jobs:
4040
with:
4141
python-version: "3.11"
4242

43+
- name: Clean Docker Data
44+
run: make docker-clean-all-except-supported-images
45+
env:
46+
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
47+
4348
- name: Install OS packages
4449
run: |
4550
sudo apt update
@@ -90,9 +95,10 @@ jobs:
9095
path: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}.zip
9196
retention-days: 7
9297

93-
- name: Remove all docker images
94-
if: always()
95-
run: make docker-clean-images
98+
- name: Clean Docker Data
99+
run: make docker-clean-all-except-supported-images
100+
env:
101+
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
96102

97103
deploy_release_docs:
98104
name: "Deploy Release Documentation"

.github/workflows/execute-examples-weekly.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ jobs:
4747
with:
4848
python-version: ${{ env.PYTHON_VERSION }}
4949

50+
- name: Clean Docker Data
51+
run: make docker-clean-all-except-supported-images
52+
env:
53+
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
54+
5055
- name: Cache pip
5156
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
5257
with:
@@ -203,10 +208,7 @@ jobs:
203208
# env:
204209
# FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}
205210

206-
- name: Cleanup previous docker containers
207-
if: always()
208-
run: make cleanup-previous-docker-containers
209-
210-
- name: Remove all docker images
211-
if: always()
212-
run: make docker-clean-images
211+
- name: Clean Docker Data
212+
run: make docker-clean-all-except-supported-images
213+
env:
214+
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}

.github/workflows/force-update-stable-Fluent-image-version.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ jobs:
4343
env:
4444
FLUENT_IMAGE_TAG: ${{ env.FLUENT_IMAGE_TAG }}
4545

46-
- name: Cleanup previous docker containers
47-
if: always()
48-
run: make cleanup-previous-docker-containers
49-
5046
- name: Update Fluent image
5147
env:
5248
GITHUB_TOKEN: ${{ secrets.ADMIN_ACCESS_TOKEN }}
@@ -55,7 +51,3 @@ jobs:
5551
run: |
5652
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/ansys/fluent:${IMAGE_TAG} | sed 's/.*@//')
5753
gh variable set FLUENT_STABLE_IMAGE_DEV --body $DIGEST
58-
59-
- name: Remove all docker images
60-
if: always()
61-
run: make docker-clean-images

0 commit comments

Comments
 (0)