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

Implement repo agents #4150

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

6543
Copy link
Member

@6543 6543 commented Sep 30, 2024

followup to #3539

@6543 6543 added the feature add new functionality label Sep 30, 2024
@6543 6543 added the build_pr_images If set, the CI will build images for this PR and push to Dockerhub label Oct 1, 2024
@woodpecker-bot
Copy link
Collaborator

woodpecker-bot commented Oct 1, 2024

Deployment of preview was successful: https://woodpecker-ci-woodpecker-pr-4150.surge.sh

@6543
Copy link
Member Author

6543 commented Oct 1, 2024

pull preview images should be published now, to be tested

Copy link

codecov bot commented Oct 2, 2024

Codecov Report

Attention: Patch coverage is 15.18987% with 134 lines in your changes missing coverage. Please review.

Project coverage is 26.97%. Comparing base (066926f) to head (0dc1b26).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
server/api/agent.go 0.00% 100 Missing ⚠️
server/store/mocks/store.go 0.00% 22 Missing ⚠️
server/router/api.go 0.00% 8 Missing ⚠️
...r/store/datastore/migration/019_add_repo_agents.go 76.92% 2 Missing and 1 partial ⚠️
server/grpc/auth_server.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4150      +/-   ##
==========================================
+ Coverage   26.53%   26.97%   +0.44%     
==========================================
  Files         379      380       +1     
  Lines       27555    27906     +351     
==========================================
+ Hits         7311     7528     +217     
- Misses      19575    19708     +133     
- Partials      669      670       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@qwerty287 qwerty287 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the repo is moved to a new owner? You would have to update the OrgID of all repo agents, right?

} // @name Agent

const (
IDNotSet = -1
agentFilterOrgID = "org-id"
IDNotSet = -1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put this var into a generic file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it used elsewhere?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I know, but it's a generic var. If it's called AgentIDNotSet or something similar it would fit here, but just IDNotSet is a generic name so it should be in a generic file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anbraten what was the exact reasoning for the comst name suggestion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was called SystemAgentOwnerID before which was misleading IMO. AgentIDNotSet would be fine as well.

server/api/agent.go Outdated Show resolved Hide resolved
@6543 6543 requested a review from qwerty287 October 6, 2024 20:15
@qwerty287
Copy link
Contributor

What about my comment above?

What happens if the repo is moved to a new owner? You would have to update the OrgID of all repo agents, right?

Copy link
Member

@anbraten anbraten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like to test and get feedback for org agents in addition with repo-id=... / repo=owner/name filter first with the 3.0 release as those filters should allow the exact same result while being more flexibel already. We should add some docs how org agents work in general and how they could be used with filters.

@qwerty287
Copy link
Contributor

Would like to test and get feedback for org agents in addition with repo-id=... / repo=owner/name filter first with the 3.0 release as those filters should allow the exact same result while being more flexibel already. We should add some docs how org agents work in general and how they could be used with filters.

There might he use cases where this is not applicable. E.g. you have admin access to a repo, but not to its org. That's a common usecase I think, and you still should be able to register an agent for that repo.


// Update all existing agents to be global agents
_, err = sess.Cols("repo_id").Update(&agents{
RepoID: model.IDNotSet,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you use DEFAULT in the xorm field?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build_pr_images If set, the CI will build images for this PR and push to Dockerhub feature add new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants