diff --git a/README.md b/README.md index 1519b6b..c01472f 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,12 @@ Pull manuale: docker pull gitea.dataprovider01.sandbox-cat-dat.simpl-europe.eu/j.r/application-consumption-demo-algorithm:optimized ``` +Se il nodo target e' amd64 e vedi errore "no matching manifest for linux/amd64": + +```bash +docker pull --platform linux/amd64 gitea.dataprovider01.sandbox-cat-dat.simpl-europe.eu/j.r/application-consumption-demo-algorithm@sha256:6cc8ab7c08f195cb65c689255418652fdf0094acaaa4ef63475d594039cda2ab +``` + ## Uso locale rapido ```bash diff --git a/deploy.yml b/deploy.yml index d16e500..a150041 100644 --- a/deploy.yml +++ b/deploy.yml @@ -39,5 +39,5 @@ - "Deploy completato" - "URL: http://{{ ansible_host }}:{{ app_port }}" - "Container: {{ container_name }}" - - "Image: {{ container_image }}:{{ image_tag }}" + - "Image: {{ container_image_ref }}" - "Digest atteso: sha256:6cc8ab7c08f195cb65c689255418652fdf0094acaaa4ef63475d594039cda2ab" diff --git a/group_vars/all.yml b/group_vars/all.yml index a533ffc..de40390 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -3,7 +3,10 @@ registry_url: gitea.dataprovider01.sandbox-cat-dat.simpl-europe.eu repository_name: j.r/application-consumption-demo-algorithm image_tag: optimized +image_digest: "sha256:6cc8ab7c08f195cb65c689255418652fdf0094acaaa4ef63475d594039cda2ab" +image_platform: "linux/amd64" container_image: "{{ registry_url }}/{{ repository_name }}" +container_image_ref: "{{ container_image ~ ('@' ~ image_digest if (image_digest | default('') | length > 0) else ':' ~ image_tag) }}" container_name: example-ml-app # App settings diff --git a/semaphore_dagster_config.example.yml b/semaphore_dagster_config.example.yml index ae79c0f..d6c384a 100644 --- a/semaphore_dagster_config.example.yml +++ b/semaphore_dagster_config.example.yml @@ -28,6 +28,8 @@ environment_variables: registry_url: "gitea.dataprovider01.sandbox-cat-dat.simpl-europe.eu" repository_name: "j.r/application-consumption-demo-algorithm" image_tag: "optimized" + image_digest: "sha256:6cc8ab7c08f195cb65c689255418652fdf0094acaaa4ef63475d594039cda2ab" + image_platform: "linux/amd64" greeting_message: "Hello from SemaphoreUI Demo" enable_health_check: "true" diff --git a/splash/tasks/main.yml b/splash/tasks/main.yml index 5971d71..5c17e56 100644 --- a/splash/tasks/main.yml +++ b/splash/tasks/main.yml @@ -16,16 +16,26 @@ name: "{{ container_name }}" state: absent -- name: Scarica immagine ML app - community.docker.docker_image: - name: "{{ container_image }}" - tag: "{{ image_tag }}" - source: pull +- name: Scarica immagine ML app (platform-aware) + block: + - name: Pull immagine Docker da registry + ansible.builtin.command: >- + docker pull{% if image_platform | default('') | length > 0 %} --platform {{ image_platform }}{% endif %} {{ container_image_ref }} + register: image_pull + changed_when: image_pull.rc == 0 + + rescue: + - name: Errore pull immagine con suggerimenti + ansible.builtin.fail: + msg: >- + Pull fallito per {{ container_image_ref }} su platform {{ image_platform | default('default') }}. + Verifica che il registry pubblichi un manifest compatibile con l'architettura host + (esempio linux/amd64) oppure ricostruisci l'immagine come multi-arch. - name: Avvia container ML app community.docker.docker_container: name: "{{ container_name }}" - image: "{{ container_image }}:{{ image_tag }}" + image: "{{ container_image_ref }}" state: started restart_policy: unless-stopped ports: diff --git a/undeploy.yml b/undeploy.yml index 035288e..80aa9d6 100644 --- a/undeploy.yml +++ b/undeploy.yml @@ -14,8 +14,7 @@ - name: Rimuovi immagine (opzionale) community.docker.docker_image: - name: "{{ container_image }}" - tag: "{{ image_tag }}" + name: "{{ container_image_ref }}" state: absent when: remove_image | bool