runtime-local apis for project deployment
This PR adds 3 new APIs to support auto-deploy from UI.
-
DeployValidation- It does basic validation and returns a response which can indicate further action to be taken by the client-
is_authenticated- If false then client should redirect to/authto get user signed in, other fields in the response should be ignored, after login the validation should be done again to get latest info. Aredirectquery can be set with url that the runtime should redirect to after login -
is_github_connected- User does have not rill git app installed, so redirect user togit_grant_access_urlwhich is the next field. -
git_grant_access_url- git access url -
git_user_name- git user name, also the default git org for the user. -
git_user_orgs- git orgs that user is part of. Currently not used, we use the default org which is equivalent to git username -
is_git_repo- is the rill project folder a git repo ? meaning does it have .git folder. If this is true, then in first version we should just ask to continue in cli. -
git_url- first git remote of the git repo, only if is_git_repo is true. -
uncommited_changes- if its already a git repo then are there any uncommitted changes that are not pushed to remote git. In first version this is not used as we only allow deploying from folder that are not git repo -
rill_org_exists_as_git_user_name- If a rill org already exists as the git_user_name, this is useful because if no orgs exists for user then we auto create an org with git_user_name, so if this is true then ask user for a new org name. This is applicable only for new user those who don’t have any org. For existing user see next option. -
rill_user_orgs- User can choose a rill org to deploy to. -
local_project_name- Folder name of local project from whererill startis done
-
-
PushToGit- This is only used whenis_git_repois false and all other validation passes. This will create a git repo in the existing project folder from whererill startis done, auto commit all changes and push the project to git org namedgit_user_namein a project named the folder name of the local project. -
Deploy- Should be done when all DeployValidation passes and it accepts two parametersrill_organdrill_project_name. We will ask user to enter these, can be auto populated as per DeployValidation response.
-
Added few more fields to
DeployValidationResponse--
is_user_app_installed- If rill git app is installed on users personal account, may not be needed if user is deploying from another git organization justis_github_connectedshould be true -
user_app_permission- if user has provided read or write access to the rill git app on their personal account -
git_remote_found- ifis_git_repois true then if there exists a github remote -
is_repo_access_granted- when the local project has git remote meaningis_git_repois true andgit_remote_foundis also true then user should have give access to repo by authorizing app for the repo, if not redirect togit_grant_access_url -
organizations_with_app- List of orgs on which user has installed the rill app along with permission given. If user choses to push to one of these or deploy to one of this then we should - first have app installed and write permission for push and read permission for deploying. This list will not contain users' personal account name,git_user_nameanduser_app_permissioncan be used for this.
uncommitted_changesis change to enum and now haveUNCOMMITTED_CHANGES_UNSPECIFIEDto indicate we do not know the status so user should ensure repo is in sync with remote. -
-
PushToGitAPI also accepts org and repo name, this should only be done whengit_remote_foundis false. These are optional - if not set then default with user' personal org with name as local project name. If set then org should have git app installed with write permission, can be ideally checked withorganizations_with_appfield ofDeployValidationResponse -
DeployResponsenow returnsfrontend_urlwhich is the dashboard url and user can be redirected to it after api returns successfully
~~One issue I am seeing currently is that gitClient.Organizations.List(ctx, user.GithubUsername, nil) does not list all my orgs however when I explicitly do s.admin.Github.AppClient().Apps.FindOrganizationInstallation(ctx, "<org>") for that org it works.~~ Fixed