jenkinsci / bitbucket-push-and-pull-request-plugin

Plugin for Jenkins v2.138.2 or later, that triggers job builds on Bitbucket's push and pull request events.
https://plugins.jenkins.io/bitbucket-push-and-pull-request
MIT License
47 stars 50 forks source link

repos are not getting clone #348

Open uttarwar-yogesh opened 4 days ago

uttarwar-yogesh commented 4 days ago

git config remote.origin.url git@bitbucket.org:/pdm-devops.git # timeout=10 Fetching upstream changes from git@bitbucket.org:/pdm-devops.git git --version # timeout=10 git --version # 'git version 1.8.3.1' using GIT_SSH to set credentials Service account for Bitbucket Verifying host key using known hosts file git fetch --tags --progress git@bitbucket.org:/pdm-devops.git +refs/heads/:refs/remotes/origin/ # timeout=10 git rev-parse 39d827632d35^{commit} # timeout=10 ERROR: Checkout failed hudson.plugins.git.GitException: Command "git rev-parse 39d827632d35^{commit}" returned status code 128: stdout: 39d827632d35^{commit}

stderr: fatal: ambiguous argument '39d827632d35^{commit}': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]'

drodbar commented 1 day ago

We are currently hitting the same error when using Bitbucket PPR in conjunction with Jenkins shared libraries.

We have configured our pipeline to skip default checkouts, but something is trying to checkout our shared library (the only git repository checked out within the workspace of our Jenkins pipeline) using BPPR commit hash before switching repositories.

This is the minimal configuration to reproduce the error

@Library('my-shared-library') _

properties([
    pipelineTriggers([
        [
            $class: 'BitBucketPPRTrigger',
            triggers: [
                [
                    $class: 'BitBucketPPRRepositoryTriggerFilter',
                    actionFilter: [
                        $class: 'BitBucketPPRRepositoryPushActionFilter',
                        triggerAlsoIfNothingChanged: true,
                        triggerAlsoIfTagPush: false,
                        allowedBranches: 'master',
                        isToApprove: true
                    ]
                ]
            ]
        ]
    ])
])
pipeline {
    agent any
    options {
        skipDefaultCheckout()
    }
    stages {
        stage('Checkout source') {
            steps {
                checkout([
                    $class: 'GitSCM',
                    branches: [[name: 'master']],
                    userRemoteConfigs: [[
                        url: "git@bitbucket.org:my-company/repo-test.git"                    ]]
                ])
            }
        }
        stage('Test') {
            steps {
                script {
                    println "Successful build!"
                }
            }
        }
    }
}

Downgrading to version 3.0.3 of the plugin fixed our issues.

viyullas commented 1 day ago

Same here