Skip to content

Commit 829684a

Browse files
ci: Use the new image name for version >=26.1 (#4291)
Use the image from `ghcr.io/ansys/fluent` for 26.1 development and CI runs. --------- Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent f8ff1da commit 829684a

File tree

16 files changed

+126
-62
lines changed

16 files changed

+126
-62
lines changed

.ci/pull_fluent_image.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""
2+
Pull a Fluent Docker image based on the FLUENT_IMAGE_TAG environment variable.
3+
"""
4+
5+
import os
6+
import subprocess
7+
8+
from ansys.fluent.core.docker.utils import get_ghcr_fluent_image_name
9+
10+
11+
def pull_fluent_image():
12+
"""Pull Fluent Docker image and clean up dangling images."""
13+
fluent_image_tag = os.getenv("FLUENT_IMAGE_TAG", "latest")
14+
image_name = (
15+
f"ghcr.io/ansys/fluent@{fluent_image_tag}"
16+
if fluent_image_tag.startswith("sha256")
17+
else f"{get_ghcr_fluent_image_name(fluent_image_tag)}:{fluent_image_tag}"
18+
)
19+
subprocess.run(["docker", "pull", image_name], check=True)
20+
subprocess.run(["docker", "image", "prune", "-f"], check=True)
21+
22+
23+
if __name__ == "__main__":
24+
pull_fluent_image()

.ci/pull_fluent_image.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ permissions:
2222
issues: write
2323

2424
env:
25-
API_CODE_CACHE: 4
25+
API_CODE_CACHE: 5
2626
DOCUMENTATION_CNAME: "fluent.docs.pyansys.com"
2727
PACKAGE_NAME: "ansys-fluent-core"
2828
PACKAGE_NAMESPACE: "ansys.fluent.core"
@@ -429,13 +429,17 @@ jobs:
429429
if: steps.cache-api-code.outputs.cache-hit != 'true'
430430
run: make docker-pull
431431
env:
432-
FLUENT_IMAGE_TAG: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
432+
# FLUENT_IMAGE_TAG: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
433+
# Temporary until the stable image tag is update for the new image path
434+
FLUENT_IMAGE_TAG: v26.1.latest
433435

434436
- name: Run 26.1 API codegen
435437
if: steps.cache-api-code.outputs.cache-hit != 'true'
436438
run: make api-codegen
437439
env:
438-
FLUENT_IMAGE_TAG: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
440+
# FLUENT_IMAGE_TAG: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
441+
# Temporary until the stable image tag is update for the new image path
442+
FLUENT_IMAGE_TAG: v26.1.latest
439443

440444
- name: Print 26.1 Fluent version info
441445
run: |
@@ -486,11 +490,13 @@ jobs:
486490
version: 251
487491
- image-tag: v25.2.0
488492
version: 252
489-
- image-tag: v26.1.0
493+
- image-tag: v26.1.latest
490494
version: 261
491495
timeout-minutes: 60
492496
env:
493-
FLUENT_IMAGE_TAG: ${{ matrix.version == 261 && vars.FLUENT_STABLE_IMAGE_DEV || matrix.image-tag }}
497+
# FLUENT_IMAGE_TAG: ${{ matrix.version == 261 && vars.FLUENT_STABLE_IMAGE_DEV || matrix.image-tag }}
498+
# Temporary until the stable image tag is update for the new image path
499+
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}
494500

495501
steps:
496502
- uses: actions/checkout@v4

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
GITHUB_TOKEN: ${{ secrets.ADMIN_ACCESS_TOKEN }}
5151
if: github.ref == 'refs/heads/main'
5252
run: |
53-
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/ansys/pyfluent:${{ env.FLUENT_IMAGE_TAG }} | sed 's/.*@//')
53+
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/ansys/fluent:${{ env.FLUENT_IMAGE_TAG }} | sed 's/.*@//')
5454
gh variable set FLUENT_STABLE_IMAGE_DEV --body $DIGEST
5555
5656
- name: Remove all docker images

.github/workflows/test-run-dev-version-nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
GITHUB_TOKEN: ${{ secrets.ADMIN_ACCESS_TOKEN }}
100100
if: github.ref == 'refs/heads/main'
101101
run: |
102-
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/ansys/pyfluent:${{ env.FLUENT_IMAGE_TAG }} | sed 's/.*@//')
102+
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/ansys/fluent:${{ env.FLUENT_IMAGE_TAG }} | sed 's/.*@//')
103103
gh variable set FLUENT_STABLE_IMAGE_DEV --body $DIGEST
104104
105105
- name: Remove all docker images

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ version-info:
2020
@bash -c "git --no-pager log -n 1 --format='%h' | xargs -I hash sed -i 's/<id>/hash/g' src/ansys/fluent/core/__init__.py"
2121

2222
docker-pull:
23-
@bash .ci/pull_fluent_image.sh
23+
@python .ci/pull_fluent_image.py
2424

2525
docker-clean-images:
2626
@docker system prune --volumes -a -f
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use the new image name for version >=26.1

src/ansys/fluent/core/codegen/tuigen.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
from ansys.fluent.core import FluentMode, launch_fluent
5353
from ansys.fluent.core.codegen import StaticInfoType
5454
from ansys.fluent.core.codegen.data.fluent_gui_help_patch import XML_HELP_PATCH
55+
from ansys.fluent.core.docker.utils import get_ghcr_fluent_image_name
5556
from ansys.fluent.core.services.datamodel_tui import (
5657
convert_path_to_grpc_path,
5758
convert_tui_menu_to_func_name,
@@ -97,7 +98,7 @@ def _get_tui_docdir(mode: str):
9798
def _copy_tui_help_xml_file(version: str):
9899
if os.getenv("PYFLUENT_LAUNCH_CONTAINER") == "1":
99100
image_tag = os.getenv("FLUENT_IMAGE_TAG", "v25.1.0")
100-
image_name = f"ghcr.io/ansys/pyfluent:{image_tag}"
101+
image_name = f"{get_ghcr_fluent_image_name(image_tag)}:{image_tag}"
101102
container_name = uuid.uuid4().hex
102103
is_linux = platform.system() == "Linux"
103104
subprocess.run(

src/ansys/fluent/core/docker/docker_compose.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,19 @@
2626
import subprocess
2727
import uuid
2828

29+
from .utils import get_ghcr_fluent_image_name
30+
2931

3032
class ComposeBasedLauncher:
3133
"""Launch Fluent through docker or Podman compose."""
3234

3335
def __init__(self, *, container_dict):
3436
self._compose_name = f"pyfluent_compose_{uuid.uuid4().hex}"
3537
self._container_dict = container_dict
38+
image_tag = os.getenv("FLUENT_IMAGE_TAG")
3639
self._image_name = (
3740
container_dict.get("fluent_image")
38-
or f"ghcr.io/ansys/pyfluent:{os.getenv('FLUENT_IMAGE_TAG')}"
41+
or f"{get_ghcr_fluent_image_name(image_tag)}:{image_tag}"
3942
)
4043
self._container_source = self._set_compose_cmds()
4144
self._container_source.remove("compose")
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2+
# SPDX-License-Identifier: MIT
3+
#
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
"""
24+
Utility functions for working with Fluent Docker images.
25+
"""
26+
27+
28+
def get_ghcr_fluent_image_name(image_tag: str):
29+
"""
30+
Get the Fluent image name from GitHub registry based on the image tag.
31+
"""
32+
if image_tag >= "v26.1":
33+
return "ghcr.io/ansys/fluent"
34+
else:
35+
return "ghcr.io/ansys/pyfluent"

0 commit comments

Comments
 (0)