Slash in branch name in PR causing an error in a BitBucket pipeline

  • versions used

Cloud and BitBucket pipeline

  • error observed (wrap logs/code around triple quote ``` for proper formatting)

In the build setup step of the pipeline, we are getting:

<1s
+ umask 000
+ GIT_LFS_SKIP_SMUDGE=1 git clone --branch="feature_jaimelimon/ch1825/hiring-manager-should-receive-an-email-when" https://x-token-auth:$REPOSITORY_OAUTH_ACCESS_TOKEN@bitbucket.org/$BITBUCKET_REPO_FULL_NAME.git $BUILD_DIR
Cloning into '/opt/atlassian/pipelines/agent/build'...
fatal: Remote branch feature_jaimelimon/ch1825/hiring-manager-should-receive-an-email-when not found in upstream origin
  • steps to reproduce

Run the pipeline with a branch name that contains slashes. Our bitbucket-pipeline.yml file is:

image: node:10.15.3

clone:
  depth: full              # SonarCloud scanner needs the full history to assign issues properly

definitions:
  caches:
    sonar: ~/.sonar/cache  # Caching SonarCloud artifacts will speed up your build
  steps:
    - step: &build-test-sonarcloud
        name: Build, test and analyze on SonarCloud
        caches:
          - node
          - sonar
        script:
          - pipe: sonarsource/sonarcloud-scan:0.1.5
            variables:
              SONAR_TOKEN: ${SONAR_TOKEN}
              EXTRA_ARGS: '-Dsonar.test.inclusions="**/testing/**,**/*.test.js" -Dsonar.typescript.lcov.reportPaths=coverage/lcov.info'

pipelines:
  pull-requests:
    '**':
      - step: *build-test-sonarcloud
  • potential workaround

We could change our branch names, but that would require a change in other systems.

Hi,

Do you have any further logs for this ? Looks like is has nothing to do with SonarCloud IMO

Have you tried adding “refs/heads/” before your branch name ?

Thanks.
Mickaël

3 posts were split to a new topic: Invalid project key with Jenkins