It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Tagging a release with Bitbucket Pipelines

Richard Hensman Aug 17, 2016

Hi 

I am trying to write a Bitbucket Pipelines script that automatically add a git tags to on the master branch

 

image: maven:3.3.3

pipelines:
  default:
    - step:
        script:
          - mvn clean install
  branches:
    master:
      - step:
          script:
            - mvn clean install
            - git tag THE_VERSION
            - git push

 

Pipelines gives me an error saying it is unable to authenticate to when it attempts the push

remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.
fatal: Authentication failed for 'https://x-token-auth:{access_token}@bitbucket.org/deepskyblue/xero-client.git/'

Anyone have any ideas how I get this working?

thanks

Richard

1 answer

0 votes
Alex Soto Aug 17, 2016

Part of my build process I also push back to the same repo.  Using an oauth token I run this command to set my remote with auth:

    git remote set-url origin https://x-token-auth:${BITBUCKET_TOKEN}@bitbucket.org/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}.git

The BITBUCKET_TOKEN env variable was something I generate in my scripts because they expire, so I need to generate a new one each build.

In my case, I also needed to setup the user config:

    git config --global user.email "builder@example.com"

    git config --global user.name "Build"

 

Then I could do whatever git operations I needed to do.

Richard Hensman Aug 26, 2016

Thanks Alex

Are you able to share the script you use to generate  BITBUCKET_TOKEN? I am confused how you do this.

 

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

1,960 views 1 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you