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

Handle remote repo default branch #303

Merged
merged 1 commit into from
Aug 9, 2022

Conversation

alessandro-sorint
Copy link
Contributor

fix #275

Added action GetRepoInfo to get repo info.
Updated gateway api to return default branch into type ProjectResponse

@alessandro-sorint
Copy link
Contributor Author

@sgotti I didn't implement tests because gitea 1.8.3 hasn't api to change default repo branch. I can add them when we change gitea (and sdk) version

@sgotti
Copy link
Member

sgotti commented Feb 4, 2022

@alessandro-sorint Thanks for the PR. I don't think it's a good idea to call the remote source api everytime an agola project api is called. We should store the default branch in the configstore and add an api to let the user refresh the remote project info (that could be used also for other needs) and, as a future improvement, automatically update it when a call to the remote source api returns an updated default branch.

internal/services/gateway/api/project.go Show resolved Hide resolved
internal/services/gateway/gateway.go Outdated Show resolved Hide resolved
internal/services/gateway/api/project.go Outdated Show resolved Hide resolved
services/configstore/types/types.go Outdated Show resolved Hide resolved
@sgotti
Copy link
Member

sgotti commented Feb 4, 2022

@sgotti I didn't implement tests because gitea 1.8.3 hasn't api to change default repo branch. I can add them when we change gitea (and sdk) version

We definetly needs tests before merging. So you should update the gitea version and manually implement the gitea api request if not provided by the sdk (we are already doing something similar for some gitea apis) or find a way to update the gitea sdk (see #247 that's blocked).

@alessandro-sorint
Copy link
Contributor Author

alessandro-sorint commented Feb 4, 2022

@sgotti I didn't implement tests because gitea 1.8.3 hasn't api to change default repo branch. I can add them when we change gitea (and sdk) version

We definetly needs tests before merging. So you should update the gitea version and manually implement the gitea api request if not provided by the sdk (we are already doing something similar for some gitea apis) or find a way to update the gitea sdk (see #247 that's blocked).

I update gitea in this PR? It's ok the gitea v1.15.11?

@sgotti
Copy link
Member

sgotti commented Feb 7, 2022

@sgotti I didn't implement tests because gitea 1.8.3 hasn't api to change default repo branch. I can add them when we change gitea (and sdk) version

We definetly needs tests before merging. So you should update the gitea version and manually implement the gitea api request if not provided by the sdk (we are already doing something similar for some gitea apis) or find a way to update the gitea sdk (see #247 that's blocked).

I update gitea in this PR? It's ok the gitea v1.15.11?

Please open a new PR so we could check that there're no regressions in the tests.

@alessandro-sorint alessandro-sorint force-pushed the default_branch branch 2 times, most recently from c0d8213 to 3962b59 Compare February 15, 2022 10:24
@alessandro-sorint
Copy link
Contributor Author

@sgotti can you do the review please?

internal/services/gateway/api/project.go Outdated Show resolved Hide resolved
internal/services/gateway/api/project.go Outdated Show resolved Hide resolved
internal/services/gateway/api/project.go Outdated Show resolved Hide resolved
internal/services/gateway/api/project.go Outdated Show resolved Hide resolved
services/configstore/types/types.go Outdated Show resolved Hide resolved
internal/services/gateway/action/project.go Outdated Show resolved Hide resolved
internal/services/gateway/action/project.go Outdated Show resolved Hide resolved
tests/setup_test.go Show resolved Hide resolved
@alessandro-sorint alessandro-sorint force-pushed the default_branch branch 4 times, most recently from ce8f384 to 8199d1d Compare February 21, 2022 08:21
@alessandro-sorint alessandro-sorint force-pushed the default_branch branch 6 times, most recently from 774afbd to 6a6711b Compare February 24, 2022 15:49
@alessandro-sorint
Copy link
Contributor Author

Hi @sgotti can you review please?

@alessandro-sorint alessandro-sorint force-pushed the default_branch branch 3 times, most recently from 093c5c3 to f3e0bf6 Compare February 25, 2022 10:05
@alessandro-sorint alessandro-sorint changed the title Added DefaultBranch in git RepoInfo. Gateway: added default_branch in ProjectResponse and /projects/{projectref}/refreshremoterepo api to refresh repo info Feb 25, 2022
@alessandro-sorint alessandro-sorint changed the title Gateway: added default_branch in ProjectResponse and /projects/{projectref}/refreshremoterepo api to refresh repo info gateway: added default_branch in projectresponse and /projects/{projectref}/refreshremoterepo api to refresh repo info Mar 1, 2022
@alessandro-sorint alessandro-sorint force-pushed the default_branch branch 5 times, most recently from 1916e94 to eb31971 Compare March 2, 2022 16:17
@alessandro-sorint alessandro-sorint force-pushed the default_branch branch 3 times, most recently from 2bb922f to f4383b4 Compare March 29, 2022 09:47
@alessandro-sorint alessandro-sorint force-pushed the default_branch branch 2 times, most recently from daac0b1 to 5fa27c8 Compare August 5, 2022 15:52
@alessandro-sorint
Copy link
Contributor Author

Hi @sgotti can you review please?

internal/services/gateway/gateway.go Outdated Show resolved Hide resolved
internal/services/gateway/action/user.go Outdated Show resolved Hide resolved
internal/services/gateway/action/project.go Outdated Show resolved Hide resolved
internal/services/gateway/action/project.go Outdated Show resolved Hide resolved
@alessandro-sorint alessandro-sorint changed the title gateway: added default_branch in projectresponse and /projects/{projectref}/refreshremoterepo api to refresh repo info Handle remote repo default branch Aug 8, 2022
@alessandro-sorint alessandro-sorint force-pushed the default_branch branch 2 times, most recently from b660f14 to acaa0c7 Compare August 8, 2022 13:25
internal/services/gateway/action/project.go Outdated Show resolved Hide resolved
internal/services/gateway/api/project.go Outdated Show resolved Hide resolved
@alessandro-sorint
Copy link
Contributor Author

@sgotti can you restart the run please?

internal/services/gateway/action/project.go Outdated Show resolved Hide resolved
internal/services/gateway/action/project.go Outdated Show resolved Hide resolved
internal/services/gateway/action/project.go Outdated Show resolved Hide resolved
gateway: provide remote repo default branch project response. An empty default branch means we don't yet know the remote repo default branch value.

gateway: add api to refresh a project remote repo data.

configstore: add defaultBranch to the project type.
@sgotti sgotti merged commit 23c66d7 into agola-io:master Aug 9, 2022
@alessandro-sorint alessandro-sorint deleted the default_branch branch August 9, 2022 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get remote repository default branch
2 participants