Skip to content

BitbucketService fails on post tag #1145

@frxncodominguez

Description

@frxncodominguez

Describe the bug
We run a pipeline to build code from a repository and then publish that tag into the repository. We create a custom stage to be able to publish the tag in the related commit and the curl command execution fails returning 404.
I was checking the bitbucket API documentation and it seems that the URL has changed from the one that runs in the 'postTag' method.

To Reproduce
Steps to reproduce the behavior:

  1. Create stage for post tag
def stagePostTagOnRepository(def context) {
  stage('Post build tag on repository') {
    def bitbucket = ServiceRegistry.instance.get(BitbucketService)
    bitbucket.postTag(context.componentId, context.gitCommit, "0.1")
  }
}
  1. Execute pipeline

Expected behavior
The tag being published in the repository.

Affected version (please complete the following information):

  • OpenShift: 4.x
  • OpenDevStack 4.x

Log Output (ensure to remove any confidential information like tokens, project names, etc.

[Pipeline] sh (Post git tag to branch)
+ curl --fail -sS --request POST --header 'Authorization: Bearer ****' --header 'Content-Type: application/json' --data '{
                                     "force": "true",
                                     "message": "",
                                     "name": "0.2.0",
                                     "startPoint": "xxxx",
                                     "type": LIGHTWEIGHT
                                 }' https://xxxxxxx/api/1.0/projects/xxxxxxx/repos/xxxxxxx/tags
curl: (22) The requested URL returned error: 404 

Additional context
Based on the official documentation, I tried the following URL http://{baseurl}/rest/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags and the tag was published without any problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions