Skip to content

Detect docker_stack presence from swarm services, not docker ps. - #1072

Open
gerases wants to merge 2 commits into
puppetlabs:mainfrom
gerases:main
Open

gerases wants to merge 2 commits into
puppetlabs:mainfrom
gerases:main

Conversation

@gerases

@gerases gerases commented Sep 11, 2026 •

Copy link
Copy Markdown

docker ps only lists containers on this node, so a stack with replicas
elsewhere looked missing and was redeployed every agent run. exists? now
compares compose services to docker stack services, strips a Swarm
digest pin from the image name, and treats a failed stack query as
absent. Compose files are loaded with Puppet::Util::Yaml.safe_load and
version 3.8 is accepted.

Fixes #968
Fixes #973

Summary

Provide a detailed description of all the changes present in this pull request.

Additional Context

Add any additional context about the problem here.

  • Root cause and the steps to reproduce. (If applicable)
  • Thought process behind the implementation.

Related Issues (if any)

Mention any related issues or pull requests.

Checklist

  • 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified. (For example puppet apply)

@gerases
gerases requested a review from a team as a code owner September 11, 2026 20:12
@CLAassistant

CLAassistant commented Sep 11, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

docker ps only lists containers on this node, so a stack with replicas
elsewhere looked missing and was redeployed every agent run. exists? now
compares compose services to `docker stack services`, strips a Swarm
digest pin from the image name, and treats a failed stack query as
absent. Compose files are loaded with Puppet::Util::Yaml.safe_load and
version 3.8 is accepted.

Fixes puppetlabs#968
Fixes puppetlabs#973
@gerases

gerases commented Sep 11, 2026

Copy link
Copy Markdown
Author

@skyamgarp, this fixes the docker_stack provider, would appreciate a review and if possible a merge.

@jst-cyr

jst-cyr commented Sep 14, 2026

Copy link
Copy Markdown
Member

@gerases: It seems that there are some syntax issues found by the Rubocop testing:

Error: Style/BlockDelimiters: Prefer `do...end` for multi-line blocks without chaining. ([https://rubystyle.guide#single-line-blocks](https://rubystyle.guide/#single-line-blocks))
Error: Style/RegexpLiteral: Use `%r` around regular expression. ([https://rubystyle.guide#percent-r](https://rubystyle.guide/#percent-r))

@gerases

gerases commented Sep 14, 2026

Copy link
Copy Markdown
Author

@jst-cyr, let me know if anything else is needed. Thank you!

@jst-cyr

jst-cyr commented Sep 14, 2026

Copy link
Copy Markdown
Member

@gerases : Thank you! Spec tests are passing, so I'll kick off some acceptance tests.

@jst-cyr

jst-cyr commented Sep 14, 2026

Copy link
Copy Markdown
Member

Running CI tests for this PR here: #1073

@jst-cyr

jst-cyr commented Sep 15, 2026

Copy link
Copy Markdown
Member

Acceptance Test Results: https://github.com/puppetlabs/puppetlabs-docker/actions/runs/34889231355?pr=1073

Mostly green, but failures on CentOS-7, CentOS-8, Debian-10, Debian-11, and Ubuntu-20.04. I have compared these failures and they match identically to the failures against main that we are seeing in the nightly acceptance tests. This PR does not seem to be introducing new failures.

This still requires an engineering review, but testing seems good!

This branch has not been deployed

No deployments
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 this pull request may close these issues.

docker_stack uses outdated way of using psych's YAML.safe_load docker_stack incorrectly determines if the stack is deployed

3 participants