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

ci: Use eclipse-mosquitto image instead of custom #147

Merged

Conversation

jpgrayson
Copy link
Contributor

A fundamental problem with service containers in GitHub Actions is that containers are started before the repository is checked out. This means that any configuration for the service that exists in the repo cannot simply be provided to the service container as volume mounts. 1

The custom mqttnio-mosquitto image solved this problem by pre-populating the mosquitto configuration from the mqtt-nio repo such that the container could be run in CI without needing access to the mqtt-nio checkout.

But this leaves the problem of having to manually keep the custom mqttnio-mosquitto image updated with any changes in the repo.

A workaround for containers starting before checkouts is to add an explicit container restart step after the checkout step.

Using this workaround allows CI to use the upstream/canonical eclipse-mosquitto image instead of a custom image. The mosquitto configuration from the repo is thus always up to date and no manual image build/push is required.

A fundamental problem with service containers in GitHub Actions is that
containers are started before the repository is checked out. This means
that any configuration for the service that exists in the repo cannot
simply be provided to the service container as volume mounts. [1]

The custom mqttnio-mosquitto image solved this problem by pre-populating
the mosquitto configuration from the mqtt-nio repo such that the
container could be run in CI without needing access to the mqtt-nio
checkout.

But this leaves the problem of having to manually keep the custom
mqttnio-mosquitto image updated with any changes in the repo.

A workaround for containers starting before checkouts is to add an
explicit container restart step after the checkout step.

Using this workaround allows CI to use the upstream/canonical
eclipse-mosquitto image instead of a custom image. The mosquitto
configuration from the repo is thus always up to date and no manual
image build/push is required.

[1]: https://github.com/orgs/community/discussions/42127
@codecov-commenter
Copy link

codecov-commenter commented Nov 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (345ef16) 79.04% compared to head (52c19ca) 78.92%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #147      +/-   ##
==========================================
- Coverage   79.04%   78.92%   -0.13%     
==========================================
  Files          22       22              
  Lines        2500     2500              
==========================================
- Hits         1976     1973       -3     
- Misses        524      527       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adam-fowler
Copy link
Collaborator

This is great. Not having to build a custom docker image makes maintenance a lot easier.

@adam-fowler adam-fowler merged commit 8dd684d into swift-server-community:main Nov 22, 2023
8 checks passed
@jpgrayson jpgrayson deleted the ci-with-eclipse-mosquitto branch November 28, 2023 14:36
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.

3 participants