`forest deploy` not working as expected?

I had a Production environment.
I had a Staging environment based upon my Production environment.
I had a Dev environment based upon my Production environment.

I made a change on my Dev environment without creating a branch.

Because I wanted to maintain my traditional workflow, I ran forest set-origin Staging which changed the basis of the Dev environment from Production to Staging (verified in UI).

I ran forest branch to create a branch (yes, retroactively :grimacing:).

forest push pushed changes to Staging which agrees with the diagram in the documentation

Tested in Staging environment.

According to the documentation, forest deploy should then take those changes on the branch and deploy them to Production but I got Cannot "deploy" to non-reference environment, please use "push"

What am I missing? I don’t see a CLI command that will change my environment so that I can deploy from Staging.

I was able to use the deploy to Production feature in the UI and the changes are now live but I’d really like to understand the “correct” way. Also, this was simply adding a collection but we have some more complex changes planned and I’d like to get the hang of this dev flow before moving on.

Hey @Brett_Belka :wave:

forest push and forest deploy uses your current FOREST_ENV_SECRET to determine what to push/what to deploy.

It should be present in our documentation, but this point has been raised multiple time recently, so I guess it’s not visible enough.

“Deploy to production” on the UI is equivalent to FOREST_ENV_SECRET=<The env secret of staging> forest deploy. Again, this was done to ease CI/CD integration.

Let me know if that helps.

Hey @jeffladiray

The explanation makes sense, but I think the implementation could maybe use some tweaking. The current setup makes sense for push but deploy needs tweaking.

With, what I would think is a fairly standard workflow, where you have a Dev (local), Staging (remote), and Production (remote) environment, I shouldn’t need to change an env variable to a value that’s not indicative of my current environment in order to deploy to production. It seems like forest deploy should accept an “origin_environment” option or something of that nature. The only proper way that I have to deploy staging to production is in the UI - which runs contrary to this CLI model we’re trying to use.

Part of what I’m working on right now is internal documentation that’s specific to our preferred processes regarding FA. Being required to jump back and forth between CLI and UI is confusing.