Skip to content

Initial implementation CI environments#41

Closed
ss-gxp wants to merge 9 commits into
php-censor:masterfrom
ss-gxp:environments
Closed

Initial implementation CI environments#41
ss-gxp wants to merge 9 commits into
php-censor:masterfrom
ss-gxp:environments

Conversation

@ss-gxp

@ss-gxp ss-gxp commented Mar 24, 2017

Copy link
Copy Markdown
Member

The environment can include several branches.
When commit to a branch, builds all environments in which the branch enters.
When build the environment, the branches related to it merge into it.
If no environment is specified, it should work as before.

Builds:
ci-env-1

Build view:
ci-env-2

Edit project
ci-env-3

@corpsee corpsee self-requested a review March 25, 2017 01:58
@corpsee

corpsee commented Mar 25, 2017

Copy link
Copy Markdown
Member

Excellent work, @ss-gxp! Thank you 🍺. I will look at this feature soon.
Can you add the short documentation (for environments configuration format) and make rebase on current master branch?

@corpsee

corpsee commented Mar 25, 2017

Copy link
Copy Markdown
Member

And it would be great if you could fix the tests according your changes. See https://travis-ci.org/corpsee/php-censor/jobs/214704570

@bochkovprivate

Copy link
Copy Markdown
Contributor

Useful feature.

I have a number of solutions in my project. Solutions differ with each other by the database structure and the set of modules included.
Each time I submit a new commit I run tests against all solutions.

I could probably use this environments if I had an access to environment name variable in .php-censor.yml.
For example:

setup:
    mysql:
        - "CREATE DATABASE rfm_db_test_%ENVIRONMENT%_%BUILD%;"
# fill db with data
# ...
# run some tests
complete:
    mysql:
        - "DROP DATABASE IF EXISTS rfm_db_test_%ENVIRONMENT%_%BUILD%;"

@corpsee

corpsee commented Mar 25, 2017

Copy link
Copy Markdown
Member

I think it is good idea - seting the %ENVIRONMENT% variable if the environment is exists. @ss-gxp what are you think about it?

@ss-gxp

ss-gxp commented Mar 25, 2017

Copy link
Copy Markdown
Member Author

Yes, %ENVIRONMENT% variable already exists.
I will fix the tests, write documentation and do rebase (do with force push or just merge the upstream? I usually do not use force push, but history will be cleaner).

@corpsee

corpsee commented Mar 26, 2017

Copy link
Copy Markdown
Member

Docs ❤️ Thanks!

}

if (!$table->hasColumn('name')) {
$table->addColumn('name', 'string', ['limit' => 20])->save();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make a limit of 250 (like a 'branch' field in the 'build' table). 20 is too short

$table = $this->table('build');

if (!$table->hasColumn('environment')) {
$table->addColumn('environment', 'string', ['limit' => 20])->save();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make a limit of 250 (like a 'branch' field in the 'build' table). 20 is too short

$this->interpolation_vars['%COMMIT_URI%'] = $build->getCommitLink();
$this->interpolation_vars['%BRANCH%'] = $build->getBranch();
$this->interpolation_vars['%BRANCH_URI%'] = $build->getBranchLink();
$this->interpolation_vars['%ENVIRONMENT%'] = $build->getEnvironment();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add:

putenv('PHPCI_ENVIRONMENT=' . $this->interpolation_vars['%ENVIRONMENT%']);

Comment thread src/PHPCensor/Model/Build.php Outdated
],
'environment' => [
'type' => 'varchar',
'length' => 20,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make a limit of 250 (like a 'branch' field in the 'build' table). 20 is too short

@corpsee

corpsee commented Mar 26, 2017

Copy link
Copy Markdown
Member

Thanks! I merged manualy this branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants