Projects onedev server Issues #768
#768  clone repo via rest API
Released
crash opened 6 months ago

Hi, I'm new to OneDev but totally in love with it, great work, thank you!

Anyway, I'm making a script to auto-clone an existing external repo (for example on github) to my onedev instance via REST API.

After studying the documentation I did imagine this solution:

#Step 1 - create the project

curl -u user:token -d@create.json -H "Content-Type: application/json" https://my.one.dev/api/projects

#Step 2 - add the .onedev-buildspec.yml file to the newly created project with a PullRepository step

curl -u user:token -d@clone.json -H "Content-Type: application/json" https://my.one.dev/api/repositories/25/files/master/.onedev-buildspec.yml

and here comes the troubles: the server complains because still no master (or any other) branch exist in an empty project, so I thought to create it through the /api/repositories/{projectId}/branches endpoint, but looking at the documentation a commit revision is mandatory

{
    "revision" : "46c001b04cba0ca41588841f1ca32f50b582ee9b",
    "branchName" : "string"
}

Unfortunately since the repository is still empty I don't have any revision to specify, so basically i'm stuck :D

What am I missing?

Robin Shen commented 6 months ago

Thanks for using OneDev. It is verified to be a bug. The editFile endpoint should allow files being created against empty repository. Will be addressed in next patch release.

OneDev changed state to 'Closed' 6 months ago
Previous Value Current Value
Open
Closed
OneDev commented 6 months ago

State changed as code fixing the issue is committed

OneDev changed state to 'Released' 6 months ago
Previous Value Current Value
Closed
Released
OneDev commented 6 months ago

State changed as build #2755 (7.3.5) is successful

crash commented 5 months ago

Wow, a fix released in less than 24hours, you’re blazing fast - I’m impressed.

I can confirm everything works as expected now.

Thank you.

issue 1 of 1
Type
Bug
Priority
Normal
Assignee
Seen Builds
Issue Votes (0)
Watchers (4)
Reference
issue onedev/server#768
Please wait...
Page is in error, reload to recover