Skip to content

sazo/bitbucket-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Please read before usage

I forked the main repo and fixed the pull-request-created feature. We do use this i production so it works BUT use at own risk. This repo will only exist until the develop branch is released to the master branch in the main repo

bitbucket-plugin

Build Status

See details on wiki

Pipeline script

Pipeline code for building on pull-request create event. It merge from source to target in the PR.

properties([
    pipelineTriggers([
        [
            $class: 'BitBucketTrigger',
            triggers : [
                [
                    $class: 'PullRequestTriggerFilter',
                    actionFilter: [
                        $class: 'PullRequestCreatedActionFilter'
                    ]
                ]
            ]
        ]
    ])
])
node {
        def sourceBranch = ""
        def targetBranch = ""
        try{
            sourceBranch = "${BITBUCKET_SOURCE_BRANCH}";
            targetBranch = "${BITBUCKET_TARGET_BRANCH}";
        }catch(e){}

        if(sourceBranch == ""){
            sourceBranch = 'development'
        }

        if(targetBranch == ""){
            targetBranch = 'master'
        }

        checkout changelog: true, poll: true, scm: [
            $class: 'GitSCM',
            branches: [
                [name: '*/'+sourceBranch]
            ],
            doGenerateSubmoduleConfigurations: false,
            extensions: [
                 [
                    $class: 'PreBuildMerge',
                    options: [
                        fastForwardMode: 'FF',
                        mergeRemote: 'origin',
                        mergeStrategy: 'recursive',
                        mergeTarget: ''+targetBranch
                    ]
                ]
            ],
            submoduleCfg: [],
            userRemoteConfigs: [
                [
                    url: 'https://[user]@bitbucket.org/[org]/[repo].git']
                ]
            ]


        echo 'Some build steps'

}

Build snapshot with docker

# Mac and Linux users
docker run -it --rm -v $(pwd):/usr/src/mymaven -v mvn-data:/root/.m2 -w /usr/src/mymaven maven:alpine bash

# Windows users
docker run -it --rm -v /c/Users/[your profile folder name fx. bitbucket]:/usr/src/mymaven -v mvn-data:/root/.m2 -w /usr/src/mymaven maven:alpine bash

#Build the snapshot
mvn package -DskipTests

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%