hirakiuc / tinybucket

A Ruby client library for Bitbucket REST API v2 with OAuth Authentication.
MIT License
33 stars 36 forks source link

Cannot create build status #127

Closed vincentsaluzzo closed 7 years ago

vincentsaluzzo commented 7 years ago

I'm trying to add build status with your gem but it fails.

bucket = Tinybucket.new
        repo = bucket.repo(owner, slug)

        commit = repo.commit(params[:repository_commit])
        commit.build_statuses.create(params[:build_key], {
          state: params[:in_progress] == true ? "INPROGRESS" : (params[:success] ? "SUCCESSFUL" : "FAILED"),
          name: params[:name],
          url: params[:url],
          description: params[:description]
        })

But when executing, I have this error :

POST https://api.bitbucket.org/2.0/repositories/#####/########/commit/d1fbedb297f3af889c21343feadb8e1770bc4116/statuses/build 400 {"type": "error", "error": {"fields": {"url": ["Enter a valid URL."]}, "message": "Bad request"}}

(I intentionally replaced slug and owner by hashtag)

Any idea ?

hirakiuc commented 7 years ago

Hi. 😄

NOTE: tinybucket just send a request to the Bitbucket REST API with passed parameters, without parameter validation.

The error response from Bitbucket REST API said {"url": ["Enter a valid URL."]}. 🤔

Did you check that params[:url] is a valid URL?

Ref: Bitbucket API document

vincentsaluzzo commented 7 years ago

Hi,

OMG, that's the error return from BitBucket. I think it was error generated by Ruby itself... I will try with a correct url !

vincentsaluzzo commented 7 years ago

That's it, sorry for that !