Environments & Branches setup
subnauez opened this issue · comments
Hello,
We are experiencing some trouble with environments & branches setup.
Until now, we used an old PHP CI version (0.24.0) without issue.
We are currently moving to PHP CI version 2.1.0 and things do not behave like the old version with the same parameters.
The main problem happen when we try to build an app for our Development environment.
As we have declared our master branch as the default project one and setup our development environment to use our develop branch, we expect that the develop branch will be merged into the master one for building the expected app. Unfortunately, something strange happen.
After reviewing the code, we noticed that only the first environment with the corresponding name is retrieved from the database (cf. src/Controller/ProjetController.php line 243 : $environmentStore->getByName($environment);)
As this request does not include the project id as parameter, this query currently retrieve an environment object with the correct name, but that is corresponding to another project.
The build process then retrieve the environments corresponding to the project ID and verify that the environment object that has been retrieved previously is corresponding to one of the project's environments and this imply that the develop branch is lost during the build process and that no branch needs to be merged.
What happen ? Can someone help to solve this issue ?
Best regards.
@subnauez Thank you for the detailed explanation. Could you also attach your build configuration example?
Sure !
FYI :
- We only use 2 environments : Development & Production
- We especially use 2 Git branches : develop & master
- The same environments are set for several applications that we want to build and deploy on several web servers
Here is our .php-censor.yml file content :
build_settings:
ignore:
- "vendor"
- "tests"
mysql:
host: "localhost"
user: "root"
pass: ""
setup:
composer:
action: "install"
test:
php_mess_detector:
allow_failures: true
path: 'src'
ignore:
- 'vendor'
deploy:
mage3:
env: "%ENVIRONMENT%"
log_dir: /var/log/magephp
failure:
email_notify:
committer: true
default_mailto_address: devs@mycompany.com
complete:
email_notify:
default_mailto_address: devs@mycompany.com
Here is the project edit page :
@subnauez Thanks! Could you please test your case in branch 1.3-environments-fix
? I guess I fixed it.
We have tested your fix and we confirm that the right environment object is retrieved by adding the project ID to the SQL query ! Thank you for this update !
Can you confirm that this fix will be included in 2.0.x branch please ?
Best regards.
I merged fix into branches: release-1.3
, release-2.0
and master
and you can use any of this branches. Tagged releases 1.3.2
and 2.0.2
will be later.
Thank you very much for your prompt reaction and the quick fix ! Best regards !