Skip to content

platform activities always use the project on local, ignoring --project or env:PLATFORM_PROJECT #1534

@hanoii

Description

@hanoii

I normally use ddev and I have a PLATFORM_PROJECT setup. On some projects, however, I sometimes want to switch across other projects.

I have this project that pushes to a drupal multisite, and I am in the process if splitting it to the their own project. So I have a branch project1, this is pushed to the main repo (the multi-site), but it's also the production branch of a another project.

If I export a new PLATFORM_PROJECT for project1, most commands work, but when I do platform activities it always prompt me to select the environment even though the branch name is right. The project is properly selected, but when it tries to get the environment because the input project (through env var or --project) is different, it just doesn't select any environment:

|| ($expectedProject !== null && $expectedProject->id !== $project->id)) {

And it gives me to choose one from.

I don't expect this to work like this, what I would expect is for cli to realize that this is a valid environment/branch in my input project and just provide me the activities.

My current stack trace: (I manually throw an exception on the function to get it). I was using a cloned client from this repo.

Exception trace:
 () at /tmp/legacy-cli/src/Command/CommandBase.php:699
 Platformsh\Cli\Command\CommandBase->getCurrentProject() at /tmp/legacy-cli/src/Command/CommandBase.php:771
 Platformsh\Cli\Command\CommandBase->getCurrentEnvironment() at /tmp/legacy-cli/src/Command/CommandBase.php:1214
 Platformsh\Cli\Command\CommandBase->selectEnvironment() at /tmp/legacy-cli/src/Command/CommandBase.php:1674
 Platformsh\Cli\Command\CommandBase->validateInput() at /tmp/legacy-cli/src/Command/Activity/ActivityListCommand.php:80
 Platformsh\Cli\Command\Activity\ActivityListCommand->execute() at /tmp/legacy-cli/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /tmp/legacy-cli/vendor/symfony/console/Application.php:1010
 Symfony\Component\Console\Application->doRunCommand() at /tmp/legacy-cli/src/Application.php:430
 Platformsh\Cli\Application->doRunCommand() at /tmp/legacy-cli/vendor/symfony/console/Application.php:255
 Symfony\Component\Console\Application->doRun() at /tmp/legacy-cli/vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /tmp/legacy-cli/bin/platform:38

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions