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

Use the docker-compose-plugin via 'docker compose' instead of 'docker-compose' #975

Merged
merged 14 commits into from
Jul 4, 2024

Conversation

nathanlcarlson
Copy link
Contributor

@nathanlcarlson nathanlcarlson commented Apr 11, 2024

Summary

Use the docker-compose-plugin via 'docker compose' instead of 'docker-compose'

From https://docs.docker.com/compose/install/

Docker's documentation refers to and describes Compose V2 functionality. Effective July 2023, Compose V1 stopped receiving updates and is no longer in new Docker Desktop releases. Compose V2 has replaced it and is now integrated into all current Docker Desktop versions. For more information, see Migrate to Compose V2.

Additional Context

Based on #902. Created my own PR to hopefully get this resolved sooner.

Related Issues (if any)

#891

Checklist

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

@nathanlcarlson nathanlcarlson requested a review from a team as a code owner April 11, 2024 16:40
@CLAassistant
Copy link

CLAassistant commented Apr 11, 2024

CLA assistant check
All committers have signed the CLA.

@nathanlcarlson
Copy link
Contributor Author

@nathanlcarlson
Copy link
Contributor Author

pdk update will apply some changes. I'm not sure if the tests want those changes or not. I've opted to make this up-to-date with main rather than apply those changes. I've used pdk test unit as the test command. I'm not sure what that will run exactly.

@nathanlcarlson
Copy link
Contributor Author

I've done some basic manual testing of this now, both with a fresh start of a compose project and with a running compose project.

Copy link
Collaborator

@smortex smortex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to focus on a single point for each PR (to minimize the changes to review) with commits that change a single aspect at a time (to make review easier).

For example 91ab09c does multiple things:

  • It updates PDK-related files (IMHO this should not be part of this PR unless if it fix CI failure)
  • It update lib/puppet/provider/docker_compose/ruby.rb to remove unused code (which should be part of this PR).

Do you think you can rework this PR and adjust the commits you add on top of #975 to only finish the work that was started by @davidphay, ignoring the PDK stuff, and without the merge commit? Maybe it is enough to have the CI green 😉

Thanks!

.rubocop.yml Outdated Show resolved Hide resolved
@nathanlcarlson
Copy link
Contributor Author

Sure I can do those things. Please fix your CONTRIBUTING.md.

@nathanlcarlson
Copy link
Contributor Author

I've made a proper mess by reverting commits that I'd merged. I'll figure out a better way.

Copy link
Contributor

@kenyon kenyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A rebase on main will get rid of the merge commit.

There are changes in early commits that are then removed in later commits. It would be good to clean up the commit history.

manifests/compose.pp Outdated Show resolved Hide resolved
@nathanlcarlson
Copy link
Contributor Author

Aren't changes to previous commits the nature of applying requested changes? Besides remaking the branch and PR altogether I'd have to really stretch my git abilities to make it appear such that it was all done as desired from the beginning.

@nathanlcarlson
Copy link
Contributor Author

I suppose maybe you want me to squash the commits together selectively? I can try that.

@nathanlcarlson
Copy link
Contributor Author

Looking into squashing it, I'm not sure that will comply with "commits that change a single aspect at a time". I won't do anything without further advisement.

@kenyon
Copy link
Contributor

kenyon commented Apr 16, 2024

Use interactive rebase to edit the commit history. I'm not saying squash all of the changes into one commit, unless that is what makes the most sense.

@nathanlcarlson
Copy link
Contributor Author

nathanlcarlson commented Apr 16, 2024

Unfortunately it really only made sense to me to make it into a single commit.

Copy link
Contributor

@kenyon kenyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The be_include to include changes should be a separate commit, since they are unrelated to the other changes.

A couple of comments, otherwise looks good.

manifests/compose.pp Outdated Show resolved Hide resolved
manifests/compose.pp Outdated Show resolved Hide resolved
@nathanlcarlson
Copy link
Contributor Author

I removed the be_include changes altogether as neither my pdk validate and pdk test unit complained about it after reverting.

@kenyon
Copy link
Contributor

kenyon commented Apr 17, 2024

Looks OK, just need to get someone from Perforce to approve the workflow run to see test results.

@rwaffen
Copy link

rwaffen commented Apr 18, 2024

Nice work! I'm curious about this change too!

@nathanlcarlson
Copy link
Contributor Author

I've realized that my problem is not with the standalone docker-compose, but rather with the version that is installed by default. This brings me to consider this PR a bit unnecessary after all. It would be nice to have the compose plugin installed as a package as it is then managed and updated as any other package would be on Linux. This seems to come at the expense of Windows Server support, which seems like a poor trade off. Supporting both the package-based and the standalone compose strategies seems like a lot as well.

Perhaps upgrading the default installed version of the standalone docker-compose may be a preferable path forward? Either way I think I am leaning towards closing this PR unless someone with Windows Server knowledge sees a different path forward for it.

@kenyon
Copy link
Contributor

kenyon commented Apr 21, 2024

@nathanlcarlson standalone docker-compose has been deprecated for a while (if I'm understanding you correctly), so I don't think there is any upgrading to do for that.

@smortex
Copy link
Collaborator

smortex commented Apr 21, 2024

Perhaps upgrading the default installed version of the standalone docker-compose may be a preferable path forward?

IMHO default versions are not great because bumping them is a backwards-incompatible change, so it basically never happens. When they are installed as packages, the default value of present is reasonable because it allows to follow package updates and still allow users to pin a specific version if they have to. I like it a lot.

It would be nice to have the compose plugin installed as a package as it is then managed and updated as any other package would be on Linux.

💯

I understand there are 2 issues here:

  1. the installation method is not great; and
  2. the default version is not great.

Improving the installation method being backwards-incompatible, changing the version it install by default looks fine to me.

Upgrading to the next major version of the modules for users of docker-compose would require to:

  • Manually remove the docker-compose program that the older version of the module installed (or maybe we can automate this removal);
  • Explicitly indicate which version of the docker-compose-plugin to install if needed.

This feels reasonable to me.

@nathanlcarlson
Copy link
Contributor Author

@kenyon Ahh, yes, I see that the Docker site reports it as "not recommended and is only supported for backward compatibility purposes".

I've applied some changes that attempt to repair and cleanup the acceptance tests.

manifests/compose.pp Show resolved Hide resolved
manifests/compose.pp Outdated Show resolved Hide resolved
manifests/compose.pp Outdated Show resolved Hide resolved
manifests/compose.pp Outdated Show resolved Hide resolved
manifests/compose.pp Show resolved Hide resolved
@rwaffen
Copy link

rwaffen commented May 31, 2024

is there something that could be done to help to move this forward?

@nathanlcarlson
Copy link
Contributor Author

is there something that could be done to help to move this forward?

I was waiting for @smortex to reply on my response to their comments. I can clean up duplicate code, but I made a couple points about the other comments.

@smortex
Copy link
Collaborator

smortex commented Jun 1, 2024

I was waiting for @smortex to reply on my response to their comments. I can clean up duplicate code, but I made a couple points about the other comments.

Dang! Too many notifications :-) I don't "own" the code, so feel free to add changes which allow other contributors to provide feedback too, and do not wait for me as my availability is somewhat sparse currently :-D I will reply at the right location to your points.

@ghost
Copy link

ghost commented Jun 13, 2024

Any news here? Any help needed? Would be great to get this finally resolved.

@nathanlcarlson
Copy link
Contributor Author

I've pushed some commits that attempt to make the requested changes.

@smortex smortex self-requested a review June 20, 2024 00:18
Copy link
Contributor

@Ramesh7 Ramesh7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes looks good to me, but will wait for @smortex @kenyon feedback here.

Copy link
Contributor

@kenyon kenyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did some tests with this code on a node where I use docker_compose, worked for me!

@Ramesh7 Ramesh7 merged commit 6a566e1 into puppetlabs:main Jul 4, 2024
21 of 26 checks passed
@kenyon kenyon mentioned this pull request Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants