clone repo via rest API (OD-768)
crash opened 4 years 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 [email protected] -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 [email protected] -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 4 years 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' 4 years ago
    Previous Value Current Value
    Open
    Closed
  • OneDev commented 4 years ago

    State changed as code fixing the issue is committed

  • OneDev changed state to 'Released' 4 years ago
    Previous Value Current Value
    Closed
    Released
  • OneDev commented 4 years ago

    State changed as build #2755 is successful

  • crash commented 4 years 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/1
Type
Bug
Priority
Normal
Assignee
Affected Versions
Not Found
Issue Votes (0)
Watchers (4)
Reference
OD-768
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover