Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Cloud manager: Different FrontEnd parameters for Stage and Prod?

Avatar

Level 7

hi folks,

I'm moving to Cloud Manager. I know how to have different OSGI config files for stage, prod and dev.

But my ui.frontend Javascript also has different parameters for dev, stage and prod.

I can make put different npm build commands in the package.json.

However, in the POM file, I need to be able to use Profiles to have different commands for Prod and Stage.

However, I don't seem to be able to do that. Is there another way around this? There are some environment variables like PIPELINE_ID etc. Are there ones that will distinguish between Prod and Stage.?

How do people normally do it.

thanks

Fiona

1 Accepted Solution

Avatar

Correct answer by
Level 1

you can pass custom variables to pipe line using API call to pipeline.

https://experienceleague.adobe.com/docs/experience-manager-cloud-manager/using/getting-started/creat...

 

Ideally there should not be any 2 different build process for stage and prod . For dispatcher you might need to maintain apache system variables unique to environments. But the dispatcher code needs to be same on stage and production.

 

 

View solution in original post

3 Replies

Avatar

Correct answer by
Level 1

you can pass custom variables to pipe line using API call to pipeline.

https://experienceleague.adobe.com/docs/experience-manager-cloud-manager/using/getting-started/creat...

 

Ideally there should not be any 2 different build process for stage and prod . For dispatcher you might need to maintain apache system variables unique to environments. But the dispatcher code needs to be same on stage and production.

 

 

Avatar

Level 7

Thanks!

I was hoping not to have to use the API, just the UI at the start.

 

Just to get it clear in my head

In my POM file, for the frontend-maven-plugin, 

 

<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>npm run stag or prod</id>
<phase>generate-resources</phase>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run <VARIABLE HERE!!!> </arguments>
</configuration>
</execution>
</executions>
</plugin>

Then somehow I can ensure that the <VARIABLE> is "stag" in the Staging part of the pipeline and "prod" in the Production part ?

 

thanks in advance!!

Avatar

Level 7
Thanks, I understand now that the Prod environment is supposed to use the same build artefacts as the stage environment. So I won't be able to build my frontend SPA apps with environment specific files. I'll have to think of something else.