Monorepo for Tangled tangled.org

appview: update state, ingester, middleware, and resolver for repo DID #1140

open opened by oyster.cafe targeting master from oyster.cafe/tangled-core: master
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:3fwecdnvtcscjnrx2p4n7alz/sh.tangled.repo.pull/3mgprvt2eon22
+11 -13
Interdiff #2 #3
appview/ingester.go

This file has not been changed.

appview/middleware/middleware.go

This file has not been changed.

appview/reporesolver/resolver.go

This file has not been changed.

appview/state/git_http.go

This file has not been changed.

+11 -13
appview/state/knotstream.go
··· 90 90 } 91 91 92 92 if record.RepoDid == nil || *record.RepoDid == "" { 93 - logger.Error("gitRefUpdate missing repoDid, skipping", "owner_did", record.OwnerDid, "repo_name", record.RepoName) 93 + logger.Error("gitRefUpdate missing repoDid, skipping", "repo_name", record.RepoName) 94 94 return fmt.Errorf("gitRefUpdate missing repoDid") 95 95 } 96 96 ··· 154 154 } 155 155 pushedBranch := ref.Short() 156 156 157 - repos, err := db.GetRepos( 158 - d, 159 - 0, 160 - orm.FilterEq("did", record.RepoDid), 161 - orm.FilterEq("name", record.RepoName), 162 - ) 163 - if err != nil || len(repos) != 1 { 157 + if record.RepoDid == nil || *record.RepoDid == "" { 158 + return 159 + } 160 + 161 + repo, err := db.GetRepoByDid(d, *record.RepoDid) 162 + if err != nil { 164 163 return 165 164 } 166 - repo := repos[0] 167 165 168 166 siteConfig, err := db.GetRepoSiteConfig(d, repo.RepoAt().String()) 169 167 if err != nil || siteConfig == nil { ··· 187 185 Trigger: models.SiteDeployTriggerPush, 188 186 } 189 187 190 - deployErr := sites.Deploy(ctx, cfClient, knotHost, record.RepoDid, record.RepoName, siteConfig.Branch, siteConfig.Dir) 188 + deployErr := sites.Deploy(ctx, cfClient, knotHost, *record.RepoDid, record.RepoName, siteConfig.Branch, siteConfig.Dir) 191 189 if deployErr != nil { 192 - logger.Error("sites: R2 sync failed on push", "repo", record.RepoDid+"/"+record.RepoName, "err", deployErr) 190 + logger.Error("sites: R2 sync failed on push", "repo", repo.RepoIdentifier(), "err", deployErr) 193 191 deploy.Status = models.SiteDeployStatusFailure 194 192 deploy.Error = deployErr.Error() 195 193 } else { ··· 197 195 } 198 196 199 197 if err := db.AddSiteDeploy(d, deploy); err != nil { 200 - logger.Error("sites: failed to record deploy", "repo", record.RepoDid+"/"+record.RepoName, "err", err) 198 + logger.Error("sites: failed to record deploy", "repo", repo.RepoIdentifier(), "err", err) 201 199 } 202 200 203 201 if deployErr == nil { 204 - logger.Info("site deployed to r2", "repo", record.RepoDid+"/"+record.RepoName) 202 + logger.Info("site deployed to r2", "repo", repo.RepoIdentifier()) 205 203 } 206 204 } 207 205
appview/state/router.go

This file has not been changed.

appview/state/star.go

This file has not been changed.

appview/state/state.go

This file has not been changed.

appview/validator/label.go

This file has not been changed.

History

14 rounds 2 comments
sign up or login to add to the discussion
1 commit
expand
appview: DID-based routing, state/handler/middleware updates
no conflicts, ready to merge
expand 0 comments
1 commit
expand
appview: DID-based routing, state/handler/middleware updates
expand 0 comments
1 commit
expand
appview: DID-based routing, state/handler/middleware updates
expand 2 comments

appview/state/state.go:631 won't this eventually redirect to /{owner}/{reponame}?

wdym by eventually? I was thinking to keep this in, so that we don't simply error out if someone does decide to be clever and link to their git repo by repoDID, we should render the page anyway to reward them for being clever instead of punishing heh

1 commit
expand
appview: DID-based routing, state/handler/middleware updates
expand 0 comments
1 commit
expand
appview: DID-based routing, state/handler/middleware updates
expand 0 comments
1 commit
expand
appview: update state, ingester, middleware, and resolver for repo DID
expand 0 comments
1 commit
expand
appview: update state, ingester, middleware, and resolver for repo DID
expand 0 comments
1 commit
expand
appview: update state, ingester, middleware, and resolver for repo DID
expand 0 comments
1 commit
expand
appview: update state, ingester, middleware, and resolver for repo DID
expand 0 comments
1 commit
expand
appview: update state, ingester, middleware, and resolver for repo DID
expand 0 comments
1 commit
expand
appview: update state, ingester, middleware, and resolver for repo DID
expand 0 comments
1 commit
expand
appview: update state, ingester, middleware, and resolver for repo DID
expand 0 comments
1 commit
expand
appview: update state, ingester, middleware, and resolver for repo DID
expand 0 comments
1 commit
expand
appview: update state, ingester, middleware, and resolver for repo DID
expand 0 comments