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

Fix GitHub Actions and support SSL #705

Open
nickevansuk opened this issue Nov 22, 2024 · 0 comments
Open

Fix GitHub Actions and support SSL #705

nickevansuk opened this issue Nov 22, 2024 · 0 comments

Comments

@nickevansuk
Copy link
Collaborator

nickevansuk commented Nov 22, 2024

host.docker.internal is not accessible via GitHub actions. There are two alternative approaches available, as below (which should be documented properly):

  1. Use a “container” for the job, which allows a “network-alias” to be configured, which can then be used to access the container (where the booking system resides) from the test suite. Full example here: https://github.com/openactive/OpenActive.Server.NET/blob/feature/docker-image/.github/workflows/docker-test-3.yml

  2. Use the static IP of 172.17.0.1, which can be used to access the host (where the booking system resides) from the test suite. This does not require a “container” to be used. Full example here: https://github.com/openactive/OpenActive.Server.NET/blob/feature/docker-image/.github/workflows/docker-test-4.yml

It should be possible to add host.docker.internal within docker-entrypoint.sh if the Docker container is running within a GitHub Action with something like the below, however there are issues with this as /etc/hosts is not available to the non-root user:

# Check if running inside a GitHub Action
if [ -n "$GITHUB_ACTIONS" ]; then
    echo "Running inside GitHub Actions. Adding host.docker.internal to /etc/hosts."
    echo "172.17.0.1 host.docker.internal" >> /etc/hosts
fi

A more robust solution would be to do something like the equivalent of docker create --add-host=host.docker.internal:host-gateway (where host-gateway replaces 172.17.0.1), within the GitHub action.yml. It's not clear if this is supported.

Additionally it should also be possible to trust host certificates, to allow reference implementation to be fully tested via Docker, as per https://serverfault.com/questions/1150886/docker-giving-container-access-to-hosts-ca-certs

@nickevansuk nickevansuk added test-request Request for a new test and removed test-request Request for a new test labels Nov 22, 2024
@nickevansuk nickevansuk moved this from 💡Ideas to ❗ High Priority Ideas in OpenActive Infrastructure Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ❗ High Priority Ideas
Development

No branches or pull requests

1 participant