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: add support for multiple hostnames #54

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ Installing Cypress with favorite package manager works great locally. However, m
ddev restart
```

> [!NOTE]
> If you change `additional_hostnames` or `additional_fqdns`, you have to re-run `ddev add-on get tyler36/ddev-cypress`

- Run cypress via `ddev cypress-open` or `ddev cypress-run` (headless).

We recommend running `ddev cypress-open` first to create configuration and support files.
Expand Down
4 changes: 0 additions & 4 deletions docker-compose.cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,5 @@ services:
# Allow X11 forwarding
- /tmp/.X11-unix:/tmp/.X11-unix

external_links:
# Resolve links via DDEV router
- "ddev-router:${DDEV_HOSTNAME}"

entrypoint: /bin/bash
working_dir: /e2e
32 changes: 32 additions & 0 deletions install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,35 @@ global_files:


post_install_actions:
- |
#ddev-nodisplay
#ddev-description:Checking docker-compose.cypress_extras.yaml for changes
if [ -f docker-compose.cypress_extras.yaml ] && ! grep -q '#ddev-generated' docker-compose.cypress_extras.yaml; then
echo "Existing docker-compose.cypress_extras.yaml does not have #ddev-generated, so can't be updated"
exit 2
fi
- |
#ddev-nodisplay
#ddev-description:Adding all hostnames to the cypress container to make them available
cat <<-END >docker-compose.cypress_extras.yaml
#ddev-generated
services:
cypress:
external_links:
{{- $cypress_hostnames := splitList "," (env "DDEV_HOSTNAME") -}}
{{- range $i, $n := $cypress_hostnames }}
- "ddev-router:{{- replace (env "DDEV_TLD") "\\${DDEV_TLD}" (replace (env "DDEV_PROJECT") "\\${DDEV_PROJECT}" $n) -}}"
{{- end }}
END

removal_actions:
- |
#ddev-nodisplay
#ddev-description:Remove docker-compose.cypress_extras.yaml file
if [ -f docker-compose.cypress_extras.yaml ]; then
if grep -q '#ddev-generated' docker-compose.cypress_extras.yaml; then
rm -f docker-compose.cypress_extras.yaml
else
echo "Unwilling to remove '$DDEV_APPROOT/.ddev/docker-compose.cypress_extras.yaml' because it does not have #ddev-generated in it; you can manually delete it if it is safe to delete."
fi
fi