magento-cloud redeploy acts on a remote environment. But as you noted, sometimes the build phase is not included in the redeployment. You should open a new issue if your concern is remote environments.
I open a new issue. My concern is running the build phase on an environment in Magento Cloud, without having to change code.
There is plenty discussion in slack about companies that do this with a workaround, such as adding a build environment variable that they increase when they need to force a build.
I believe the right solution is to add a flag to the magento-cloud environment:deploy command like magento-cloud env:deploy --force-build or something along those lines.
Current help
Command: environment:redeploy
Aliases: redeploy
Description: Redeploy an environment
Usage:
magento-cloud redeploy [-p|--project PROJECT] [-e|--environment ENVIRONMENT] [-W|--no-wait] [--wait]
Options:
-p, --project=PROJECT The project ID or URL
-e, --environment=ENVIRONMENT The environment ID. Use "." to select the project's default environment.
-W, --no-wait Do not wait for the operation to complete
--wait Wait for the operation to complete (default)
-h, --help Display this help message
-V, --version Display this application version
-y, --yes Answer "yes" to confirmation questions; accept the default value for other questions; disable interaction
--no-interaction Do not ask any interactive questions; accept default values. Equivalent to using the environment variable: MAGENTO_CLOUD_CLI_NO_INTERACTION=1
-v|vv|vvv, --verbose Increase the verbosity of messages
Proposed help
Command: environment:redeploy
Aliases: redeploy
Description: Redeploy an environment
Usage:
magento-cloud redeploy [-p|--project PROJECT] [-e|--environment ENVIRONMENT] [-W|--no-wait] [--wait] [--force-build]
Options:
-p, --project=PROJECT The project ID or URL
-e, --environment=ENVIRONMENT The environment ID. Use "." to select the project's default environment.
-W, --no-wait Do not wait for the operation to complete
--wait Wait for the operation to complete (default)
--force-build Trigger the build phase for this environment
-h, --help Display this help message
-V, --version Display this application version
-y, --yes Answer "yes" to confirmation questions; accept the default value for other questions; disable interaction
--no-interaction Do not ask any interactive questions; accept default values. Equivalent to using the environment variable: MAGENTO_CLOUD_CLI_NO_INTERACTION=1
-v|vv|vvv, --verbose Increase the verbosity of messages
Bonus feature would be to add a Redeploy with Build menu item in the cloud console, which opens a modal showing the --force-build flag.
I am happy to work on a PR for this if it's worth considering, but wanted to confirm it wouldn't just be wasted effort.
As noted in https://github.com/magento/magento-cloud/issues/538 (which isn't quite the inverse of this request)
I open a new issue. My concern is running the build phase on an environment in Magento Cloud, without having to change code.
There is plenty discussion in slack about companies that do this with a workaround, such as adding a build environment variable that they increase when they need to force a build.
I believe the right solution is to add a flag to the
magento-cloud environment:deploy
command likemagento-cloud env:deploy --force-build
or something along those lines.Current help
Proposed help
Bonus feature would be to add a Redeploy with Build menu item in the cloud console, which opens a modal showing the --force-build flag.
I am happy to work on a PR for this if it's worth considering, but wanted to confirm it wouldn't just be wasted effort.