Skip to content
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

Cannot parse event from line: 'build service php' [docker_compose_v2] #778

Closed
pgassmann opened this issue Jan 24, 2024 · 6 comments · Fixed by #779
Closed

Cannot parse event from line: 'build service php' [docker_compose_v2] #778

pgassmann opened this issue Jan 24, 2024 · 6 comments · Fixed by #779

Comments

@pgassmann
Copy link

SUMMARY

docker_compose_v2 unparsed output when compose decides that it needs to (re)build an image.

[WARNING]: Cannot parse event from line: 'build service php'. Please report this at https://github.com/ansible-collections/community.docker/issues/new?assignees=&labels=&projects=&template=bug_report.md
[WARNING]: Cannot parse event from line: '==> ==> writing image dryRun-47425e4490d1548713efea3b8a6f5d778e4b1766'. Please report this at https://github.com/ansible-collections/community.docker/issues/new?assignees=&labels=&projects=&template=bug_report.md
[WARNING]: Cannot parse event from line: '==> ==> naming to matomo-php'. Please report this at https://github.com/ansible-collections/community.docker/issues/new?assignees=&labels=&projects=&template=bug_report.md

output of manual execution:

root@web1 /container/matomo # docker compose up -d --dry-run
[+] Building 0.0s (0/0)                                                                                                                                                                                                                                                                                                                                                    docker:default
[+] Running 6/0
 ✔ DRY-RUN MODE -    build service php                                                                                                                                                                                                                                                                                                                                               0.0s 
 ✔ DRY-RUN MODE -  ==> ==> writing image dryRun-47425e4490d1548713efea3b8a6f5d778e4b1766                                                                                                                                                                                                                                                                                             0.0s 
 ✔ DRY-RUN MODE -  ==> ==> naming to matomo-php                                                                                                                                                                                                                                                                                                                                      0.0s 
 ⠋ DRY-RUN MODE -  Container matomo_db_1                                                 Recreated                                                                                                                                                                                                                                                                                   0.0s 
 ⠋ DRY-RUN MODE -  Container matomo_web_1                                                Recreated                                                                                                                                                                                                                                                                                   0.0s 
 ⠋ DRY-RUN MODE -  Container matomo_php_1                                                Recreated                                                                                                                                                                                                                                                                                   0.0s 
 ✔ DRY-RUN MODE -  Container 3dae350d9ee_matomo-db-1                                     Started                                                                                                                                                                                                                                                                                     0.0s 
 ✔ DRY-RUN MODE -  Container d6a12006dd9_matomo-web-1                                    Started                                                                                                                                                                                                                                                                                     0.0s 
 ✔ DRY-RUN MODE -  Container 5135cd81ea8_matomo-php-1                                    Started     

The docker-compose.yml has a service with build: configuration

version: '3.7'

services:
  php:
    build: ./php
    restart: always
#...

Context: the service is already running, started with legacy docker-compose, now docker compose wants to rebuild and recreate.

Additional note: @felixfontein It would be helpful for debugging, if the exact command the docker_compose_v2 module executes, is printed in the debug output.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

docker_compose_v2

ANSIBLE VERSION
(ansible) pgassmann@home:~/git/ansible$ ansible --version
ansible [core 2.16.2]
  config file = /home/pgassmann/git/ansible/ansible.cfg
  configured module search path = ['/home/pgassmann/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/pgassmann/.local/share/virtualenvs/ansible-GSJhdB0r/lib/python3.10/site-packages/ansible
  ansible collection location = /home/pgassmann/git/ansible/collections
  executable location = /home/pgassmann/.local/share/virtualenvs/ansible-GSJhdB0r/bin/ansible
  python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/home/pgassmann/.local/share/virtualenvs/ansible-GSJhdB0r/bin/python)
  jinja version = 3.1.3
  libyaml = True
(ansible) pgassmann@home:~/git/ansible$ ansible-community --version
Ansible community version 9.1.0
COLLECTION VERSION
community.docker 3.7.0
(from current main branch,  commit b5391c79713d345584259664315549520e9e6b33)
collection install git+https://github.com/ansible-collections/community.docker.git
CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
TASK [teamapps.general.webserver : docker compose up (stats-test.example.com in /container/matomo)] ******************************************************************************************************************************************************************************
task path: /home/pgassmann/git/example/example-ansible/collections/ansible_collections/teamapps/general/roles/webserver/tasks/main.yml:120
[WARNING]: Cannot parse event from line: 'build service php'. Please report this at https://github.com/ansible-collections/community.docker/issues/new?assignees=&labels=&projects=&template=bug_report.md
[WARNING]: Cannot parse event from line: '==> ==> writing image dryRun-47425e4490d1548713efea3b8a6f5d778e4b1766'. Please report this at https://github.com/ansible-collections/community.docker/issues/new?assignees=&labels=&projects=&template=bug_report.md
[WARNING]: Cannot parse event from line: '==> ==> naming to matomo-php'. Please report this at https://github.com/ansible-collections/community.docker/issues/new?assignees=&labels=&projects=&template=bug_report.md
changed: [web1.example.com] => changed=true 
  actions:
  - id: matomo_php_1
    status: Recreate
    what: container
  - id: matomo_db_1
    status: Recreate
    what: container
  - id: matomo_web_1
    status: Recreate
    what: container
  - id: d6a12006dd9_matomo-web-1
    status: Starting
    what: container
  - id: 5135cd81ea8_matomo-php-1
    status: Starting
    what: container
  - id: 3dae350d9ee_matomo-db-1
    status: Starting
    what: container
  containers:
  - Command: '"docker-entrypoint.sh --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-allowed-packet=64M"'
    CreatedAt: 2024-01-15 18:43:03 +0000 UTC
    ExitCode: 0
    Health: healthy
    ID: 33dae350d9ee303a0bfacf60a76f91624b9bb635627e61d80b985e04c062e7a3
    Image: mariadb:10.11
    Labels:
      com.docker.compose.config-hash: 2ed3cd48ba2ce805bd2f9f117b93278c6e0ec3269d02f1fb95c4898f4ed2f98c
      com.docker.compose.container-number: '1'
      com.docker.compose.oneoff: 'False'
      com.docker.compose.project: matomo
      com.docker.compose.project.config_files: /container/matomo/docker-compose.yml
      com.docker.compose.project.working_dir: /container/matomo
      com.docker.compose.service: db
      com.docker.compose.version: 1.29.2
      org.opencontainers.image.authors: MariaDB Community
      org.opencontainers.image.base.name: docker.io/library/ubuntu:jammy
      org.opencontainers.image.description: MariaDB Database for relational SQL
      org.opencontainers.image.documentation: https://hub.docker.com/_/mariadb/
      org.opencontainers.image.licenses: GPL-2.0
      org.opencontainers.image.ref.name: ubuntu
      org.opencontainers.image.source: https://github.com/MariaDB/mariadb-docker
      org.opencontainers.image.title: MariaDB Database
      org.opencontainers.image.url: https://github.com/MariaDB/mariadb-docker
      org.opencontainers.image.vendor: MariaDB Community
      org.opencontainers.image.version: 10.11.6
    LocalVolumes: '0'
    Mounts: /container/matomo/db
    Name: matomo_db_1
    Names:
    - matomo_db_1
    Networks:
    - matomo_code-network
    Ports: 3306/tcp
    Project: matomo
    Publishers:
    - Protocol: tcp
      PublishedPort: 0
      TargetPort: 3306
      URL: ''
    RunningFor: 8 days ago
    Service: db
    Size: 0B
    State: running
    Status: Up 23 hours (healthy)
  - Command: '"docker-php-entrypoint php-fpm"'
    CreatedAt: 2024-01-15 18:43:03 +0000 UTC
    ExitCode: 0
    Health: ''
    ID: 65135cd81ea866022927d4b103305c7f529b5c82b054fcd86de8722b05c10c32
    Image: matomo_php
    Labels:
      com.docker.compose.config-hash: f43dd46d67b3fadd6243f149e33a2486fe7a99e136af6a1fe1cf2cd50c7439f8
      com.docker.compose.container-number: '1'
      com.docker.compose.oneoff: 'False'
      com.docker.compose.project: matomo
      com.docker.compose.project.config_files: /container/matomo/docker-compose.yml
      com.docker.compose.project.working_dir: /container/matomo
      com.docker.compose.service: php
      com.docker.compose.version: 1.29.2
    LocalVolumes: '0'
    Mounts: /container/matomo/php/fpm-custom.ini,/container/matomo/php/php-override.ini,/container/matomo/code
    Name: matomo_php_1
    Names:
    - matomo_php_1
    Networks:
    - matomo_code-network
    Ports: 9000/tcp
    Project: matomo
    Publishers:
    - Protocol: tcp
      PublishedPort: 0
      TargetPort: 9000
      URL: ''
    RunningFor: 8 days ago
    Service: php
    Size: 0B
    State: running
    Status: Up 23 hours
  - Command: '"/docker-entrypoint.sh nginx -g ''daemon off;''"'
    CreatedAt: 2024-01-22 06:23:20 +0000 UTC
    ExitCode: 0
    Health: ''
    ID: 7d6a12006dd90c50bbf364971f0e38bc5c162d2c5bd1b17a3d7f8b7870407fec
    Image: nginxinc/nginx-unprivileged:1.25-alpine3.18
    Labels:
      com.docker.compose.config-hash: 9ef2cee82a541bb121c79d5403af195cfc57c51b5cbc5fcefce9f4bfbd4936f3
      com.docker.compose.container-number: '1'
      com.docker.compose.oneoff: 'False'
      com.docker.compose.project: matomo
      com.docker.compose.project.config_files: /container/matomo/docker-compose.yml
      com.docker.compose.project.working_dir: /container/matomo
      com.docker.compose.service: web
      com.docker.compose.version: 1.29.2
      maintainer: NGINX Docker Maintainers <docker-maint@nginx.com>
      org.opencontainers.image.created: '2024-01-22T01:16:47.910Z'
      org.opencontainers.image.description: Unprivileged NGINX Dockerfiles
      org.opencontainers.image.licenses: Apache-2.0
      org.opencontainers.image.revision: 87e29d2ba0bcec34c36f85611f03aebcda591dbb
      org.opencontainers.image.source: https://github.com/nginxinc/docker-nginx-unprivileged
      org.opencontainers.image.title: docker-nginx-unprivileged
      org.opencontainers.image.url: https://github.com/nginxinc/docker-nginx-unprivileged
      org.opencontainers.image.version: 1.25.3-alpine
    LocalVolumes: '0'
    Mounts: /container/matomo/code,/container/matomo/site.conf
    Name: matomo_web_1
    Names:
    - matomo_web_1
    Networks:
    - webproxy
    - matomo_code-network
    Ports: 8080/tcp
    Project: matomo
    Publishers:
    - Protocol: tcp
      PublishedPort: 0
      TargetPort: 8080
      URL: ''
    RunningFor: 2 days ago
    Service: web
    Size: 0B
    State: running
    Status: Up 23 hours
  images:
  - ContainerName: matomo_db_1
    ID: sha256:29b7ba1d0a4610f56ae808609034e68dfefef4d1f9b47878da9552ba9d33486d
    Repository: mariadb
    Size: 403704765
    Tag: '10.11'
  - ContainerName: matomo_php_1
    ID: sha256:b6c1d4f9b79f5c60b75b246591a1f49828c474daa3ae15ba8f77765dece88e1a
    Repository: matomo_php
    Size: 591708798
    Tag: latest
  - ContainerName: matomo_web_1
    ID: sha256:1bccdc244b6d8f1b3cd0285cb5bc409ee903dbead52e4247e73efc4382f61d64
    Repository: nginxinc/nginx-unprivileged
    Size: 47651142
    Tag: 1.25-alpine3.18
  invocation:
    module_args:
      api_version: auto
      build: policy
      ca_path: null
      cli_context: null
      client_cert: null
      client_key: null
      dependencies: true
      docker_cli: null
      docker_host: unix:///var/run/docker.sock
      env_files: null
      profiles: null
      project_name: null
      project_src: /container/matomo
      pull: policy
      recreate: auto
      remove_images: null
      remove_orphans: true
      remove_volumes: false
      services: null
      state: present
      timeout: null
      tls: false
      tls_hostname: null
      validate_certs: false
  stderr: |2-
     DRY-RUN MODE -    build service php
     DRY-RUN MODE -  ==> ==> writing image dryRun-47425e4490d1548713efea3b8a6f5d778e4b1766
     DRY-RUN MODE -  ==> ==> naming to matomo-php
     DRY-RUN MODE -  Container matomo_php_1  Recreate
     DRY-RUN MODE -  Container matomo_db_1  Recreate
     DRY-RUN MODE -  Container matomo_web_1  Recreate
     DRY-RUN MODE -  Container matomo_php_1  Recreated
     DRY-RUN MODE -  Container matomo_db_1  Recreated
     DRY-RUN MODE -  Container matomo_web_1  Recreated
     DRY-RUN MODE -  Container d6a12006dd9_matomo-web-1  Starting
     DRY-RUN MODE -  Container d6a12006dd9_matomo-web-1  Started
     DRY-RUN MODE -  Container 5135cd81ea8_matomo-php-1  Starting
     DRY-RUN MODE -  Container 5135cd81ea8_matomo-php-1  Started
     DRY-RUN MODE -  Container 3dae350d9ee_matomo-db-1  Starting
     DRY-RUN MODE -  Container 3dae350d9ee_matomo-db-1  Started
@pgassmann pgassmann changed the title Cannot parse event from line when docker_compose_v2 executes build of image Cannot parse event from line: 'build service php' [docker_compose_v2] Jan 24, 2024
@pgassmann
Copy link
Author

It's just a warning. the module works properly.

The information could be parsed and added to the actions:

actions:
  - id: matomo-php
    status: build
    what: image
  - id: matomo_php_1
    status: Recreate
    what: container

@felixfontein
Copy link
Collaborator

Which version of Docker Compose are you using?

@felixfontein
Copy link
Collaborator

Hmm I was pretty sure that I already added code to handle these output messages, but apparently I didn't.

@felixfontein
Copy link
Collaborator

Interestingly I only get these errors in dry-run mode, not with a regular run. I guess I have to add some more special cases then... 🤷 (Still wishing for docker/compose#10872...)

@felixfontein
Copy link
Collaborator

Something else: there is only any indication that the image is built in dry-run mode. In regular mode, there's no indication that the image built happened (except that you see a build log in stdout, but parsing these... an even worse idea).

@felixfontein
Copy link
Collaborator

I filed docker/compose#11403 for the missing non-dry-run indication that the image got built.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants