I am trying to integrate into my bitbucket pipeline an automated tag creation
So basically I have a bash script:
# retrieve branch name
BRANCH_NAME=$(git branch | sed -n '/\* /s///p')
# remove prefix release
VERSION_BRANCH=$(echo "$BRANCH_NAME" | sed "s/$REGEXP_RELEASE//")
echo "Current version branch is $VERSION_BRANCH"
# retrieve the last commit on the branch
VERSION=$(git describe --tags --match=$VERSION_BRANCH* --abbrev=0)
# split into array
#get number parts and increase last one by 1
#create new tag
echo "Updating $VERSION to $NEW_TAG"
#get current hash and see if it already has a tag
GIT_COMMIT=`git rev-parse HEAD`
NEEDS_TAG=`git describe --contains $GIT_COMMIT`
#only tag if no tag already (would be better if the git describe command above could have a silent option)
if [ -z "$NEEDS_TAG" ]; then
echo "Tagged with $NEW_TAG (Ignoring fatal:cannot describe - this means commit is untagged) "
git tag $NEW_TAG
git push --tags
echo "Already a tag on this commit"
Then in my pipeline:
# This is a sample build configuration for Java (Maven). # Check our guides at https://confluence.atlassian.com/x/zd-5Mw for more examples. # Only use spaces to indent your .yml configuration. # ----- # You can specify a custom docker image from Docker Hub as your build environment. image: maven:3.3.9 pipelines: default: - step: caches: - maven script: # Modify the commands below to build your repository. - mvn clean package -Denv=uat branches: master: - step: caches: - maven script: # Modify the commands below to build your repository. - mvn clean package -Denv=uat - chmod +x tag.sh - ./tag.sh
I am getting this issue when pipeline is trying to push my new tag:
./tag.sh<1s+ ./tag.shCurrent version branch is masterUpdating master-1.0.2 to master-1.0.3fatal: cannot describe '493bf0b1aef120879af57e25d63dde24ad0c7de2'Tagged with master-1.0.3 (Ignoring fatal:cannot describe - this means commit is untagged)Warning: Permanently added the RSA host key for IP address '22.214.171.124' to the list of known hosts.Permission denied (publickey).fatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.
So what I don' t understand is why I am getting this issue and how to solve it.
But I did not understand as first I do not have access to the pipeline remote. And as the IP change I cannot add it as Known host.
Is there a way to do a push?
As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs