0

I have a self hosted runner running on Windows. I have a step in my pipeline to create a label and tag the current branch with that label.

I looked at long thread in this community that it should work. But it is not working.

The step is below:

- step:
  name: 'Tag the repo with build label'
  runs-on:
    - 'self.hosted'
    - 'windows'
    - 'aio'
  script:
    - echo "Tagging repo with label"
    if ( $Env:BITBUCKET_BRANCH -match "feature/*" )
    {
      ${BRANCH_PART} = "integration";
    }
    elseif ( $Env:BITBUCKET_BRANCH -match "release/*" )
    {
      ${BRANCH_PART} = "release";
    };
    ${RELEASE_CODENAME}="chicago";
    ${REPO_TAG} = "${BRANCH_PART}_${RELEASE_CODENAME}_$Env:BITBUCKET_BUILD_NUMBER";
    git tag -am "Tagging for build $Env:BITBUCKET_BUILD_NUMBER" "${REPO_TAG}";
    git remote set-url origin "$Env:BITBUCKET_GIT_HTTP_ORIGIN";
    git push --dry-run;
    echo git push origin "${REPO_TAG}";

I understand the script doesn't look like Bash script. It is because Windows runners run with Powershell as the parent shell. All those script lines are proper powershell script code.

The error I am seeing is this:

bash: /dev/tty: No such device or address

error: failed to execute prompt script (exit code 1)

fatal: could not read Username for 'https://bitbucket.org': No such file or directory

git

push

origin

integration_chicago_33
videoguy
  • 1,732
  • 2
  • 24
  • 49
  • You say this is a Powershell script, but the error is from bash. To track this down, you need to figure out where bash comes into this. Are you sure that the script you show here is the cause of the error? Do you see the output from the `echo "Tagging repo with label"` command? If so, you should add more `echo` commands to debug where the problem is. If not, then the error happens before the script you show here and you will need to do some research and debugging to find out where it happens. – Code-Apprentice Jun 30 '22 at 04:41
  • The git on Windows is msys/cygwin based utility right? Thats the reason the output looks like Bash. I had the same question when I saw the output if the job is running on wrong runner. It is not. – videoguy Jun 30 '22 at 13:08
  • That's a good point. I just assumed it is a native windows executable, but maybe it's not. Will you answer my other questions? – Code-Apprentice Jun 30 '22 at 22:16

0 Answers0