Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Receiving error while executing git diff command in pipeline deployment

harshal chaudhary
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 25, 2020

Hi,

as part of conditional deployment in the bitbucket pipelines, i am trying to use git diff

i.e. git diff remotes/origin/${branch_1} remotes/origin/master -- $file

for each object and deploy only specific objects.

I have create a new branch , updated the pipeline with : 

clone:
depth: full

but the pipeline fails for my team mates deployment and works for me .below is the error that my team mate is seeing while deploying his branch :

+ GIT_LFS_SKIP_SMUDGE=1 retry 6 git clone --branch="develop" https://x-token-auth:$REPOSITORY_OAUTH_ACCESS_TOKEN@bitbucket.org/$BITBUCKET_REPO_FULL_NAME.git $BUILD_DIRCloning into '/opt/atlassian/pipelines/agent/build'...

 

error :

fatal: bad revision 'remotes/origin/feature/<branch_name>

 

 

 

1 answer

0 votes
ktomk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 27, 2020

Your teammate and you, you might build different revisions. If develop not yet contains the topic branch (e.g. it is not merged into it yet), I find it imaginable that the topic is not available in git as branch HEAD. See the `git clone` command, only the `develop` branch is cloned. All other branches may (must) not exist (there are no reference to them), therefore the topic branch (`remotes/origin/feature/<branch_name>`) is a bad revision, git can not resolve the name to a revision hash (or does not have cloned up to that revision hash, from top of my head I can't specifically say for git).

All in all, fetching the topic branch first in the pipeline might already solve the issue for your teammate as well. You might have run the pipeline on the topic branch directly, therefore it was cloned. Comparing the output for your build against the one of your colleague, might shed more light.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events