-
Notifications
You must be signed in to change notification settings - Fork 8
Add-velo #17
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
base: master
Are you sure you want to change the base?
Add-velo #17
Conversation
| - **`default_repo_type`**: Set to `github` (default for all repositories) | ||
| - **`repo_type`**: Per-repository field to override the default | ||
|
|
||
| Currently migrated repositories: | ||
| - `discoverd` - set to `gerrit` | ||
| - `bctid` - set to `gerrit` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we do a dynamic discovery of the system based on the reponame?
no auth required
curl -X 'GET' \
'https://repometadata.infra.corp.arista.io/repos/code.arista.io%2Fefw%2Fbctid' \
-H 'accept: application/json' 2>/dev/null | jq .Metadata.URL.HTTP
"https://github.com/untangle/bctid.git"
and gettit example
curl -X 'GET' \
'https://repometadata.infra.corp.arista.io/repos/code.arista.io%2Fefw%2Fin-eos' \
-H 'accept: application/json' 2>/dev/null | jq .Metadata.URL.HTTP
"https://gerrit.corp.arista.io/a/efw/in-eos"
it requires only curl and jq (can be ported to wget most likely)
| if args.repositories: | ||
| repositories = args.repositories | ||
| # When repositories are specified directly, we need to get their info | ||
| # For now, assume they're all GitHub unless we can look them up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the MD doc, I described a way to determine the repo.
kskrzypczyn-arista
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not find the endpoint in the docs
It didn't work for me in the browser
| if repo_type == "gerrit": | ||
| # For Gerrit, create a change directly | ||
| success, change_id = create_pr(repository, branch_to, "", branch_from, repo_type) | ||
| if not success: | ||
| print("Unable to create Gerrit change - merge manually pls") | ||
| exit(1) | ||
| else: | ||
| print(f"Created Gerrit change: {change_id}") | ||
| else: | ||
| # For GitHub, create branch then PR | ||
| success, new_branch = create_branch(repository, branch_from, branch_to, repo_type) | ||
| if success is False: | ||
| print("Unable to create new branch - merge manually pls") | ||
| exit(1) | ||
| # Last, open a PR against the branch_to | ||
| success = create_pr(repository, branch_to, new_branch, branch_from, repo_type) | ||
| if success is False: | ||
| print("Unable to create PR - merge manually pls") | ||
| exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create_pr has an arc for Gerrit already. It looks like we need handling logic here and in all the methods. It looks a bit redundant,
Could we do in alternative way?
- create_branch for Gerrit always returns
True, "" - then we keep the same old logic
if not success(for Gerrit it will never trigger) - then we call
create_prwhich for Gerrit ignores thenew_branchparameter so we can pass here the empty string fromcreate_branch, and it will work
I think it would simplify the logic
lib/gerrit_api.py
Outdated
| project = repository.replace("/", "%2F") | ||
|
|
||
| # Get commits in branch_from not in branch_to (ahead) | ||
| url_ahead = f"{GERRIT_BASE_URL}/a/projects/{project}/branches/{branch_from}/commits?n=1000" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The part of the link works for me
https://gerrit.corp.arista.io/a/projects/efw%2Fdiscoverd/branches/master/
but when I do
https://gerrit.corp.arista.io/a/projects/efw%2Fdiscoverd/branches/master/commits?n=1000
I'm getting
Not found: commits
Should we use
https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-reflog ?
lib/gerrit_api.py
Outdated
| return None, None, None | ||
|
|
||
| # Get commit IDs | ||
| commits_from_ids = {c.get('commit') for c in commits_from} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not find the commits endpoint, if we use reflog endpoint there will be no "commit" member
lib/gerrit_api.py
Outdated
| ) -> Tuple[bool, str]: | ||
| """ | ||
| Attempt to merge branch_from into branch_to. | ||
| TODO: implement this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically can be base on automerge being enabled?
lib/gerrit_api.py
Outdated
| auth = get_gerrit_auth() | ||
|
|
||
| post_data = { | ||
| "project": repository, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be using project here I think
lib/gerrit_api.py
Outdated
| post_data = { | ||
| "project": repository, | ||
| "subject": f"Merge {branch_from} into {branch_to}", | ||
| "branch": branch_to, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a topic here to enable RITS run?
No description provided.