Running convex run in a CI environment
Can I run
convex run
in a CI environment without logging in? Maybe there's a way to expose an auth token here?
The reason for this is running my migrations when the convex funcitons successfully deploy8 Replies
convex run will use the CONVEX_DEPLOY_KEY environment variable, so this should work the same as a deploy. (it also unofficially accepts a --url and using the --admin-key flag to pass a deploy key, explicitly this won't go away but it is not in help) it sounds it would be helpful for it to accept a deploy key as well.
Ahhh nice thanks
@ballingt Is the admin key exposed rn? It doesn't seem to have a place in the dash
Ah no not really, the admin key is the credential for login that grants access to your entire account, you can find it in .convex/config.json in your home directory.
To avoid using the admin key for this you could make your migration a public mutation and require a password, e.g. a value you deploy to your instance as an environment variable or hardcoded secret
Ahh gotcha cool that's a neat idea I can do that
@Chad Maycumber @lee just pointed out to me that you can use the deploy key as a more limited scope admin key! If the CONVEX_DEPLOY_KEY environment variable is set this should just work without any flags, so
npx convex run --prod --no-push migrations:myInternalMigration
🔥
Not sure this is working for me. Try to shoot over a screenshot but I'm still getting prompted for a login even when CONVEX_DEPLOY_KEY is defined in the environment
Ah you're right, I has a confused test setup!
@Chad Maycumber sorry about this! We'll make this work with a CONVEX_DEPLOY_KEY envvar, that's very sensible.
Cool that would be awesome