-
Notifications
You must be signed in to change notification settings - Fork 5
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
add support for linking remote instances and projects initialization #22
Conversation
@elprans friendly ping :) |
It looks like the package index has been updated and it now includes the new CLI version, so after restarting the workflow everything went well! Workflow file PS. The explicit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main concern is that this mostly directed to using services
for edgedb. But this is a bit more annoying than what we want. I think it should work along the lines of:
- If
project-link: "edgedb://localhost:5656/"
is specified, it overrides everything below and just links the instance (no server install, no instance creation) - If
server-instance
is specified create that named instance (withserver-version
or stable) and link it as a project - With no params and existing
edgedb.toml
it should runproject init
- With
server-version: 1-beta4
andedgedb.toml
it should override server versionproject init --server-version=1-beta4
(this is "compatibility check mode" for CI) - With no
edgedb.toml
it should install stable or specified version of edgedb (same as now)
So example with service look like:
jobs:
test:
runs-on: ubuntu-latest
name: CI with EdgeDB CLI
services:
edgedb:
image: edgedb/edgedb:1-beta3
env:
EDGEDB_SERVER_INSECURE_DEV_MODE: 1
ports:
- 5656:5656
steps:
- uses: actions/checkout@v2
- uses: edgedb/setup-edgedb@v1
with:
project-link: edgedb://localhost:5656
- run: edgedb query "SELECT 'Hello from GitHub Actions!'"
(None: insecure dev mode allows empty password and generated self-signed cert, and project-link
with DSN allows connecting to remote instances too)
And we have project-init: false
to suppress initing/linking a project if edgedb.toml
is existing or server-instance
is specified.
But I defer final judgement to @elprans
action.yml
Outdated
description: > | ||
Boolean flag indicating whether the project should be linked with EdgeDB instance. | ||
Defaults to true. | ||
default: 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This linking by default is probably not backwards-compatible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine. We can call this setup-edgedb@V2.
README.md
Outdated
See [action.yml](action.yml) | ||
See [action.yml](action.yml) for the action's specification. | ||
|
||
Example (installs stable EdgeDB CLI and makes it available in `$PATH`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should include an example without server-version: none
? Our premise is that most people would use server installation by default and don't bother with writing their own "services" definition. Although, in that case we should use a version from edgedb.toml
rather than latest stable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The recommended and default way to use EdgeDB in CI is to use the instance set up by the action. Using "services"
is an advanced pattern that, I think, only makes sense if you want to use a custom EdgeDB server image.
@tailhook thanks for review! I'll change PR to apply your suggestions and change the examples so that they are more focused on using the server provided by action instead of services, but I have some questions.
Should this argument create a random instance name for instance/project linking process? IMO it's a bit confusing if we have a
I've checked out some PRs related to this change, but right now I haven't been able to check how I can work with it.
I'm not sure what I'm doing wrong, could you help me with this, please? |
Support for |
For random instance name -- probably. We have some default instance name for interactive As for
In (2), (3), (4) you can override So Sounds like we should also have
Ah, yes sorry. I've assumed that it would work because it's supported by server itself. But we have more logic in the container itself, so as @elprans said it will land soon.
Yes. Insecure dev mode for server only ignores the password checking. So yes |
What's the use case for this? |
Any use case that we haven't covered yet: edgedb.toml in subdirectory, or mulitple ones, using |
OK, but the server installation in that case would be unnecessary, but not harmful, so what's the benefit of adding the option? |
I've updated PR and implemented most of the suggestions (except for the This is due to an error that EdgeDB raises in the GitHub Actions environment when bootstrap process starts:
If I understood correctly, then right now the workflows for JS and the Go drivers are starting server manually with the Workflow for EdgeDB running in Workflow for EdgeDB created by project initialization with link to error line: https://github.com/nsidnev/edgedb-elixir/runs/3785060819#step:4:147 |
Speed of github action. We can wait for someone to ask, though.
The problem with that directory is not the directory per se, but that it means that there are no
And to have bootstrapping worked we have to pass same environment variable to project init:
And then check that exit status is Technically we can incorporate this to the CLI tool. But I'm not sure in what form. Because on actual user's machines presence of systemd daemon can depend on way they have been login, and maybe on other things. Some brainstorm on what we might do:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! I've let some tiny comments, but let's settle on the project init (as of comment above).
- uses: edgedb/setup-edgedb@v1 | ||
with: | ||
cli-version: nightly | ||
server-version: none |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this will no longer work as none
equals to non-specifying the version at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you omit server-version
in the workflow file, actions will use "stable"
as default value as it was before. I haven't changed this behavior from previous version. As a result, first example installs both CLI and server, while this one only installs the CLI. I think that's the equivalent of the cli-only
option you mentioned about above, no?
README.md
Outdated
|
||
Example (installs EdgeDB CLI with server, creates new EdgeDB instance and links it using `edgedb project`) | ||
NOTE: this assumes that repository for the project has already been initialized | ||
using `egedb project init` and `edged.toml` file exists in the repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using `egedb project init` and `edged.toml` file exists in the repository. | |
using `egedb project init` and `edgedb.toml` file exists in the repository. |
README.md
Outdated
- run: edgedb query "SELECT 'Hello from GitHub Actions!'" | ||
``` | ||
|
||
Example (same as above, but with custom instance name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can put instance-name: ci_edgedb_instance # optional
in the example above. Separate example makes only scrolling longer.
README.md
Outdated
- run: edgedb --version | ||
``` | ||
|
||
Example (installs EdgeDB CLI with server, creates new EdgeDB instance and links it using `edgedb project`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably have to put a better comment on the first example, explaining that it's behavior depends on edgedb.toml
, because they are the same and user has to carefully compare yaml contents and comments to figure out that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more explanations of behavior of the action in the README and to the first example
Co-authored-by: Paul Colomiets <[email protected]>
I think the first option is quite good, I like it. It doesn't look like it would be hard to implement, and it's similar to existing CLI command. This method can also be useful for adding support to systems that won't have systemd. |
@tailhook thanks for implementing
|
friendly ping :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! @fantix, please take a quick look too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very cool!
I think it's not working properly with CLI 1-rc1 (missing the edgedb project init --server-start-conf
option), but nightly works fine.
Co-authored-by: Elvis Pranskevichus <[email protected]>
Congratulations on the release of the new EdgeDB RC! I think now, when Just in case, to make sure everything will work correctly, I've created a new branch that will include an update to EdgeDB RC2, which will use this action with the latest stable version of the CLI. I haven't updated the driver code right now, but the current workflow with the latest stable version of the CLI works! |
Thanks, @nsidnev! I've also just merged CLI with the portable distribution installation method by default. So I think we should ensure that it works as well on the new nightly (will be released tomorrow). |
@tailhook I updated the workflow to use the nightly CLI and ran into serveral problems with new installation method:
|
I see
Ah, yes, sorry. Will fix that |
Just checked the action with the latest nightly CLI release. Everything works perfectly! Passed workflow: link |
Co-authored-by: Elvis Pranskevichus <[email protected]>
@tailhook I added new jobs to the test workflow to test new behavior and found 2 new error cases, the first of which could break existing projects after merging this PR:
These jobs are slightly modified examples from the README, and I can try to add them to this branch, but I'm not sure it's possible right now to make all jobs pass succesfully, at least because I also forgot that this action works on windows, so this PR won't work with it. I can try to add support for it, but I'd rather do it in a separate PR than this one. Workflow file: https://github.com/nsidnev/setup-edgedb/blob/3c3061f1aa7c86553a90219521c0a5d453e3032e/.github/workflows/test.yml |
Yes. This is done intentionally since Yes this is breaking change, and we think the scope things that will break is minimal before 1.0.
We'll release a new stable of CLI shortly. And the issue with runtime dirs I'm fixing in geldata/gel-cli#560
We are dropping windows support for server/instance/project commands in CLI and will work on that later. For now if someone needs windows they will have to use docker image manually. I mean setup-edgedb will not support windows for some time now (we should fix it in a month or so). |
setup-edgedb@v1 does not rely on |
So can I already change the command in this branch to always use the selector? Also, should I add new workflow jobs to this PR or is this something unnecessary right now? |
Yes.
I'm not sure I understand the question. |
Done. Right now everything except the stable CLI works fine!
Sorry. I added new jobs to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI is green with rc3 CLI up. I took another look at the option names and decided that project-link
should instead be server-dsn
. I also made project initialization on a linked instance conditional on edgedb.toml
like the non-linked branch.
Thank you very much for the contribution, @nsidnev. Great work! |
Awesome! Thanks for releasing new version, I've already changed my projects to use the new tag from original action.
Thanks, I was happy to help with that :) |
This PR adds support for
edgedb project
andedgedb instance link
in action! New inputs for this action try to mimic existing CLI flags and options where it's possible. I also added several examples of using the action in the README.Unfortunately, I wasn't able to successfully test it on real project as this action installs CLI version from August (link to index of nightly packages), and because of this
edgedb project init --link
exits with an error. I also looked at the nightly builds workflow in the EdgeDB CLI and it seems that they all completed successfully. Could it be that the package index requires manual updating?Example of failed workflow (with debug logs if necessary): https://github.com/nsidnev/edgedb-elixir/runs/3617122318#step:5:46
Refs #11