1

I am having trouble getting a bitbucket pipeline to run correctly, it keeps throwing a permission denied error and I can't for the life of me see why?

This is my composer file:

{
"name": "pswebsolutionsltd/psadoptables",
"description": "Framework for Building Adoptable Sites",
"version": "0.0.1",
"type": "project",
"homepage": "https://www.pswebsolutions.co.uk/",
"authors": [
    {
        "name": "Paul Cook",
        "email": "paul.cook@pswebsolutions.co.uk",
        "homepage": "https://www.pswebsolutions.co.uk/"
    }
],
"support": {
    "issues": "https://bitbucket.org/pswebsolutionsltd/psadoptables/issues?status=new&status=open",
    "wiki": "https://bitbucket.org/pswebsolutionsltd/psadoptables/wiki/",
    "source": "https://bitbucket.org/pswebsolutionsltd/psadoptables/src"
},
"scripts": {
    "test": [
        "@clean",
        "@load",
        "@clearCache",
        "@phpCS",
        "@phpUnit",
        "@phpDoc"
    ],
    "clean": "composer clear-cache",
    "load": "composer dump-autoload -o",
    "clearCache": "rm -rf cache && mkdir cache",
    "phpUnit": "phpunit --configuration phpunit.xml tests",
    "phpDoc": "phpdoc",
    "phpCS": "phpcs --config-set default_standard PSR2 phpcs src/ --extensions=php && phpcs tests/ --extensions=php",
    "phpCBF": "phpcbf ./ --extensions=php"
},
"autoload": {
    "psr-4": {
      "AdoptableFramework\\": "src/",
      "AdoptableFramework\\Tests\\": "tests/",
      "AdoptableFramework\\Extend\\": "src/extend/"
    }
},
"require": {
    "matthiasmullie/minify": "^1.3"
},
"require-dev": {
    "phpunit/phpunit": "5.7",
    "phpdocumentor/phpdocumentor": "2.*",
    "squizlabs/php_codesniffer": "3.*"
}

}

This is my bitbucket pipeline config file:

P S Adoptable build configuration for PHP.

pipelines:
  default:
    - step:
        name: php56-mysql57
        image: php:5.6-apache
        script:
          # update apt
          - apt-get update && apt-get install -y unzip

          # install mysqli
          - apt-get install -y mysql-client
          - docker-php-ext-install mysqli

          # install and configure composer
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - composer install --no-interaction --no-progress --prefer-dist
          - composer test
        services:
          - mysql57
definitions:
  services:
    mysql57:
      image: mysql:5.7
      environment:
        MYSQL_DATABASE: psadoptables
        MYSQL_ROOT_PASSWORD: root

The output is:

sh: 1: phpcs: Permission denied
Script phpcs --config-set default_standard PSR2 phpcs src/ --extensions=php && phpcs tests/ --extensions=php handling the phpCS event returned with error code 126

Is there some trick I am missing? Any help would be greatly appreciated!

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
  • I'm not sure if this is your problem, but your PHPCS command has two calls to PHPCS: `phpcs --config-set default_standard PSR2 phpcs src/ --extensions=php && phpcs tests/ --extensions=php` When you probably wanted `phpcs --config-set default_standard PSR2 && phpcs src/ --extensions=php && phpcs tests/ --extensions=php`. You could also write this as one command if that helps: `phpcs --standard=PSR2 --extensions=php src/ tests/` – Greg Sherwood Dec 07 '17 at 02:22
  • Thanks for the advice, i've updated my composer.json file with your feedback. Thank you! – Paul Sonny Cook Dec 07 '17 at 11:48

1 Answers1

0

I would suspect the permission of composer in /usr/local/bin or the directory itself. For debugging you could add a "ls -l /usr/local/bin/composer" in the pipeline config, right after the installation of composer.

Animesh
  • 227
  • 2
  • 9