Skip to content

proposal : test 1 commit against different php version, modules ... #46

Open

Description

@vinpel

I want to be able to test my commit against 2 differents PHP configuration.

For me you need to :

  • inform php-censor about available php configuration
  • define php configuration to be tested agains in .php-censor.yml config
  • setup cron/worker to response to the correct PHP configuration

i propose a new variable "php_tags", it can be different version, différent plugin version ...

Change in YAMLs config file

The path of the php executable is not defined because the worker can be in another server, less dependance.

file : config.yaml

php-censor:
  language: en
  per_page: 10
  php_tags:
     - php56
     - php70
  worker:
      host: 169.137.666.3
      queue: php-censor-queue

In each project config file you set the list of tag to be build agains, it can be non set to keep backward compatibility

file : .php-censor.yaml

build_settings:
    verbose: true
    prefer_symlink: false
    allowed_warnings: 2
    php_tags: 
      - php56
      - php70

(can be added in the new environment section too (?) )

if tags not defined in the general config, make an error for the whole build before make beanstalkd queue.

So in our config we need to manage 3 build with different envirnoment :

  • one who will respond to php56 tag only
  • one who will respond to php70 tag only
  • one who will respond to build without tag

Builds with beanstalkd

in the previous exemple we can make worker search build for queue name like :
"php-censor-queue-%php_tags%"

[program:worker-php56]
startsecs = 0
command=/usr/bin/php56 /data/htdocs/php-censor/bin/console php-censor:worker php56
process_name=%(program_name)s_%(process_num)02d
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
user=apache
autostart=true
autorestart=true
environment=HOME="/data/htdocs/php-censor",USER="apache"
numprocs=1
startsecs=10
[program:worker-php70]
startsecs = 0
command=/usr/bin/php70 /data/htdocs/php-censor/bin/console php-censor:worker php70
process_name=%(program_name)s_%(process_num)02d
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
user=apache
autostart=true
autorestart=true
environment=HOME="/data/htdocs/php-censor",USER="apache"
numprocs=1
startsecs=10
[program:worker]
startsecs = 0
command=/data/htdocs/php-censor/bin/console php-censor:worker
process_name=%(program_name)s_%(process_num)02d
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
user=apache
autostart=true
autorestart=true
environment=HOME="/data/htdocs/php-censor",USER="apache"
numprocs=1
startsecs=10

Builds with cron

SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

* * * * * /path/to/php56 /path/to/php-censor/bin/console php-censor:run-builds php56
* * * * * /path/to/php56 /path/to/php-censor/bin/console php-censor:run-builds php70
* * * * * /path/to/php-censor/bin/console php-censor:run-builds

What do you think about this type of implementation ?

Activity

  1. corpsee commented on Mar 31, 2017

    @corpsee
    Member

    The idea is good and right, I also thought about this. But I see the implementation like this:

    1. This should be in the environment settings
    2. You don't need to make a special syntax for the PHP versions, it is better to implement the ability to send a specific environment to a specific worker (different queues, routs in the environment configuration etc.)
    env-php7:
      tag: php7
    env-php56:
      tag: php56

    Tag is the rout to specific group of workers with selfown queue etc.

    1. Runing different workers for the different PHP version with different routs (queue or info in DB for cron-workers).

    It seems to me that this will be a more universal option, which can be used not only for versions of PHP.

    P.S.: I would also transfer the environment settings to the build config (.php-censor.yml).

    @vinpel @ss-gxp What do you think about it?

  2. vinpel commented on Mar 31, 2017

    @vinpel
    MemberAuthor

    yes fine, it will be important to have a full exemple with config to be clear about this feature

  3. corpsee commented on Mar 31, 2017

    @corpsee
    Member

    I will think about it seriously soon and try to add examples. I don't insist on my vision, I just propose to consider all variants before implementing such huge feature. Thanks for the idea and description, @vinpel!

    @vinpel Is it just a proposal or are you planning to implement it by yourself?

  4. ss-gxp commented on Mar 31, 2017

    @ss-gxp
    Member

    P.S.: I would also transfer the environment settings to the build config (.php-censor.yml).

    I thought about it, but:

    • Until the project is cloned, it is impossible to know what environments are
    • After cloning, we must merge the specified branches, but default branch may not contain fresh config
    • When the committee in the branch, we need to know in what environments it is located

    In accordance with this, it will not be possible to place information about the environments and their links to the branches in the repository.

    As for the expansion of the configuration of the environment, I agree. Something like this

    env-name:
      vars:
        tag: php7
      branches:
        - feature-A
  5. ss-gxp commented on Mar 31, 2017

    @ss-gxp
    Member

    I probably did not quite understand, you're talking about the configuration dependent on the environment?

    env-name:
      tag: ...
      test:
        ...
  6. corpsee commented on Mar 31, 2017

    @corpsee
    Member

    @ss-gxp I understood you about build config (.php-censor.yml).

    About "configuration dependent on the environment", - No) I want to add different environment variables to the different environments (I didn't write about it in this topic) and routs to specific group of workers.

    env-name-1:
      tag: workers-group-1
      vars:
        - ENV_VAR: env-1
    env-name-2:
      tag: workers-group-2
      vars:
        - ENV_VAR: env-2

    Environment variables may be useful for different databases in different environments (for example).

  7. added this to the milestone on Sep 27, 2017
  8. modified the milestones: , Version 3.0.0 (major) on Jan 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions