✅ How to push the layout of a remote environment to another one

Feature(s) impacted

I’m working on automating the deployment of our Forest Admin layout during our CD. I’m looking for a way to deployment the layout for an environment to another.

Observed behavior

We have 4 environments (Development, Release, Staging and Production). When we are ready to create a new release, we want to deploy UI changes made on Development to Release. I would like to use environment:copy-layout but, if I well understood, it has been deprecated in favor of the push / deploy commands.

I tried several things:

> branch release-deployment -o Development
√ Switched to new branch: release-deployment.
> push
? Push branch release-deployment onto Development Yes
√ Branch release-deployment successfully pushed onto Development.
> deploy
? Deploy layout changes to reference? Yes
× environment source has no branch to deploy
> branch release-deployment -o Development
√ Switched to new branch: release-deployment.
> set-origin Release
√ Origin "Release" successfully set.
> push
? Push branch release-deployment onto Release Yes
√ Branch release-deployment successfully pushed onto Release.
> deploy
? Deploy layout changes to reference? Yes
× environment source has no branch to deploy
> branch release-deployment -o Development
√ Switched to new branch: release-deployment.
>deploy
? Deploy layout changes to reference? Yes
× cannot "deploy" to non-reference environment, please use "push"

Expected behavior

The documentation says we should use the command push but it does not explain how.

Failure Logs

Context

ENVIRONMENTS
 ID        NAME         TYPE
 84249     Production   production
 84426     Development  remote
 84429     Staging      remote
 85926     Release      remote
BRANCHES
 NAME                ORIGIN              IS CURRENT          CLOSED AT
 Development         Production                              2022-09-29T09:55:14.104Z
 Production          Production
 release-deployment  Development         ✅
  • Project name: Koala
  • Team name:
  • Environment name:
  • Agent type & version: forest-express-sequelize@8.5.12 and forestadmin/toolbelt:v3.0.0
  • Recent changes made on your end if any:

Hi @KoalaJulien :wave:
Can you share with us the origin of your environments like below.

Here as you can see I have 4 environments.
Development > Staging > Preprod > Prod.

I can create branch only on my Development environment.

And after that, if I want to see the changes on Staging environment, I must use forest push.
The changes are now on Staging.

If you want to see the changes on Preprod you must use forest push with FOREST_ENV_SECRET of your Preprod environment.

As you can see on this page of documentation Forest CLI commands - Developer guide.
You can read more about push command by reading this push - Developer guide

Be careful the usage of deploy command can work to put changes from Preprod to Production.
You can read more here https://docs.forestadmin.com/documentation/reference-guide/how-it-works/developing-on-forest-admin/forest-cli-commands/deploy

Let me know if that help :pray:

1 Like

Hi Arnaud,

Thank you for your answer.

FOREST_ENV_SECRET helps you’re right!

Just in case someone else read this topic:
We need to give the FOREST_ENV_SECRET of the source environment. It will push to the target environment.
In my case, I want to deploy Development on Release, so I have to use the FOREST_ENV_SECRET of Development.

2 Likes