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

feat: Add and edit github connection #5263

Merged
merged 38 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7c7c0f5
Adding backend API to fetch connected repos
AdityaHegde Jul 12, 2024
f157c1e
Merge branch 'main' into adityahegde/connect-to-github
AdityaHegde Jul 12, 2024
3caebf5
Cleanup
AdityaHegde Jul 12, 2024
708237b
Basics of github connection UI
AdityaHegde Jul 12, 2024
7028a51
Add connecting to github UI
AdityaHegde Jul 15, 2024
c0a5baf
Merge branch 'main' into adityahegde/connect-to-github-ui
AdityaHegde Jul 16, 2024
8f8879e
Add github url edit button
AdityaHegde Jul 16, 2024
64e2d30
Avoid unnessary calls
AdityaHegde Jul 17, 2024
c57aa21
Merge branch 'main' into adityahegde/connect-to-github-ui
AdityaHegde Jul 17, 2024
ec24980
Adjust github url edit button
AdityaHegde Jul 17, 2024
546266e
PR comments
AdityaHegde Jul 18, 2024
53c1b1a
Fix invalidations
AdityaHegde Jul 19, 2024
fc2bce3
Fix moving to github connection
AdityaHegde Jul 22, 2024
5c3358f
Merge branch 'main' into adityahegde/connect-to-github-ui
AdityaHegde Jul 22, 2024
08b0376
Regenerate from proto
AdityaHegde Jul 22, 2024
21afe75
Refactor to use a single class
AdityaHegde Jul 22, 2024
9012e9f
Merge branch 'main' into adityahegde/connect-to-github-ui
AdityaHegde Jul 22, 2024
1139185
Fix lint
AdityaHegde Jul 23, 2024
58ca0c3
Update error colors in user invite
AdityaHegde Jul 23, 2024
f402534
Fix a page refresh after updating project
AdityaHegde Jul 23, 2024
9a99b5c
Update github repo selector modal
AdityaHegde Jul 24, 2024
b5d6cdc
Push to github for the 1st time
AdityaHegde Jul 25, 2024
61504ea
Happy path for push to github
AdityaHegde Jul 26, 2024
af24d8b
Handle existing content
AdityaHegde Jul 26, 2024
69e8508
Fix lint and always push
AdityaHegde Jul 26, 2024
88d387e
Update based on mocks
AdityaHegde Jul 29, 2024
83d60f8
Update connection to handle updating to new repo
AdityaHegde Jul 29, 2024
079b2b1
Merge branch 'main' into adityahegde/connect-to-github-ui
AdityaHegde Jul 29, 2024
ce868ee
Cleanup
AdityaHegde Jul 29, 2024
f09758d
Fix copy on edit
AdityaHegde Jul 29, 2024
be44162
Ignore .git folder
AdityaHegde Jul 29, 2024
6f8caba
Add telemetry
AdityaHegde Jul 30, 2024
0c17b50
Fix issues around overwrite
AdityaHegde Jul 30, 2024
f31a127
Merge branch 'main' into adityahegde/connect-to-github-ui
AdityaHegde Jul 30, 2024
880f729
PR comments
AdityaHegde Jul 30, 2024
ce5ea9b
Add autoclose on github connection confirmation
AdityaHegde Jul 31, 2024
bfeca3b
PR comments
AdityaHegde Jul 31, 2024
f6c95a7
UI PR comments
AdityaHegde Jul 31, 2024
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
446 changes: 441 additions & 5 deletions admin/server/github.go

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions admin/server/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ func (s *Server) UpdateProject(ctx context.Context, req *adminv1.UpdateProjectRe
return nil, fmt.Errorf("cannot set both github_url and archive_asset_id")
}
githubURL := proj.GithubURL
githubInstID := proj.GithubInstallationID
archiveAssetID := proj.ArchiveAssetID
if req.GithubUrl != nil {
// If changing the Github URL, check github app is installed and caller has access on the repo
Expand All @@ -528,7 +529,9 @@ func (s *Server) UpdateProject(ctx context.Context, req *adminv1.UpdateProjectRe
return nil, status.Error(codes.Unauthenticated, "not authenticated as a user")
}

_, err = s.getAndCheckGithubInstallationID(ctx, *req.GithubUrl, claims.OwnerID())
instID, err := s.getAndCheckGithubInstallationID(ctx, *req.GithubUrl, claims.OwnerID())
// github installation ID might change, so make sure it is updated
githubInstID = &instID
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -562,7 +565,7 @@ func (s *Server) UpdateProject(ctx context.Context, req *adminv1.UpdateProjectRe
Public: valOrDefault(req.Public, proj.Public),
ArchiveAssetID: archiveAssetID,
GithubURL: githubURL,
GithubInstallationID: proj.GithubInstallationID,
GithubInstallationID: githubInstID,
Subpath: valOrDefault(req.Subpath, proj.Subpath),
ProdVersion: valOrDefault(req.ProdVersion, proj.ProdVersion),
ProdBranch: valOrDefault(req.ProdBranch, proj.ProdBranch),
Expand Down
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions proto/gen/rill/admin/v1/admin.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,46 @@ paths:
type: string
tags:
- AdminService
/v1/organizations/{organization}/projects/{project}/connect-to-github:
post:
summary: |-
Connects a rill managed project to github.
Replaces the contents of the remote repo with the contents of the project.
operationId: AdminService_ConnectProjectToGithub
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/v1ConnectProjectToGithubResponse'
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/rpcStatus'
parameters:
- name: organization
in: path
required: true
type: string
- name: project
in: path
required: true
type: string
- name: body
in: body
required: true
schema:
type: object
properties:
repo:
type: string
branch:
type: string
subpath:
type: string
force:
type: boolean
tags:
- AdminService
/v1/organizations/{organization}/projects/{project}/credentials:
post:
summary: GetDeploymentCredentials returns runtime info and access token on behalf of a specific user, or alternatively for a raw set of JWT attributes
Expand Down Expand Up @@ -3216,6 +3256,8 @@ definitions:
type: string
url:
type: string
defaultBranch:
type: string
protobufAny:
type: object
properties:
Expand Down Expand Up @@ -3387,6 +3429,8 @@ definitions:
items:
type: object
$ref: '#/definitions/v1Expression'
v1ConnectProjectToGithubResponse:
type: object
v1CreateAlertResponse:
type: object
properties:
Expand Down
Loading
Loading