Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BitBucket Server Project #286

Closed
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@fejal
Copy link
Contributor

fejal commented Mar 5, 2019

Contribution type

New project type to support Bit Bucket Server in php-censor.

Description of change

This adds a preliminary project type that handles the following:

  1. Allows setting Project to Bitbucket Server.
  2. Assume basic Git can be used to access clones from Bit Bucket server.
  3. Sets up the listener in web hooks to fire a build pull requests when they are created in Bit Bucket server.

Known limitations:

  1. Does not get list of all commits included in a pull request.
  2. Clickable links in the header of the build screen do not map back to the bit bucket server when clicked. Need another configuration field in project setup to get this as the URL to the server will likely be different than the url to the repository on a typical bit bucket server setup.

fejal added some commits Mar 5, 2019

Show resolved Hide resolved src/BuildFactory.php Outdated
@corpsee

This comment has been minimized.

Copy link
Member

corpsee commented Mar 6, 2019

@fejal Good work! I will review the PR soon when I have free time. Thanks! 👍

@@ -15,6 +15,7 @@ class Project extends Model
const TYPE_GOGS = 'gogs';
const TYPE_HG = 'hg';
const TYPE_BITBUCKET_HG = 'bitbucket-hg';
const TYPE_BITBUCKET_SV = 'bitbucket-server';

This comment has been minimized.

@corpsee

corpsee Mar 8, 2019

Member

@fejal Could you rename const TYPE_BITBUCKET_SV to TYPE_BITBUCKET_SERVER please?

This comment has been minimized.

@fejal

fejal Mar 12, 2019

Author Contributor

Yes, will do.

@@ -147,7 +147,7 @@ function ($a) {
$shouldOutput = ($this->logExecOutput && ($this->verbose || 0 !== $status));
if ($shouldOutput && !empty($this->lastOutput)) {
if (($shouldOutput || true) && !empty($this->lastOutput)) {

This comment has been minimized.

@corpsee

This comment has been minimized.

@fejal

fejal Mar 12, 2019

Author Contributor

Oops, debugging. Need to remove that.

@@ -71,7 +71,7 @@ protected function write(array $record)
{
$message = (string)$record['message'];
$message = str_replace(['\/', '//'], '/', $message);
$message = str_replace($this->build->getBuildPath(), '<BUILD_PATH>/', $message);
//$message = str_replace($this->build->getBuildPath(), '<BUILD_PATH>/', $message);

This comment has been minimized.

@corpsee

This comment has been minimized.

@fejal

fejal Mar 12, 2019

Author Contributor

Had trouble setting the build path correctly but found the trouble was in how I set it in the config, not in the code. I'll restore this rather.

namespace PHPCensor\Model\Build;
use GuzzleHttp\Client;

This comment has been minimized.

@corpsee

corpsee Mar 8, 2019

Member

@fejal Could you remove useless namespaces (GuzzleHttp\Client, PHPCensor\Config, PHPCensor\Model\BuildError) please?

This comment has been minimized.

@fejal

fejal Mar 12, 2019

Author Contributor

Absolutely.

@@ -295,40 +295,4 @@ public function reportError(
parent::reportError($builder, $plugin, $message, $severity, $file, $lineStart, $lineEnd);
}

This comment has been minimized.

@corpsee

corpsee Mar 8, 2019

Member

Why? Method getDiffLineNumber used in method reportError (line 273).

This comment has been minimized.

@fejal

fejal Mar 12, 2019

Author Contributor

Oops removed that function from the wrong file when I was cleaning up the code for the initial push, will fix that.

This comment has been minimized.

@fejal

fejal Mar 12, 2019

Author Contributor

When cleaning up code for initial commit, (for functionality not implemented in this first patch) I removed getDiffLineNumber from the wrong file it appears.

@corpsee

This comment has been minimized.

Copy link
Member

corpsee commented Mar 11, 2019

#260.

corpsee added a commit that referenced this pull request Mar 12, 2019

@corpsee

This comment has been minimized.

Copy link
Member

corpsee commented Mar 12, 2019

@fejal Thank you! Good work. I merged your PR manually to master branch. The PR will be released with next minor release 1.1.0.

@corpsee corpsee closed this Mar 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.