Pipeline Variables For Staging Slot Only
Hi team,
I am in the process of building a website using AEM Sites, utilizing SPA Components and SSR. For this, I am using the standard AEM Archetype (https://github.com/adobe/aem-project-archetype), with the appropriate flags (enableSSR etc).
Part of this, is a POM file which reads pipeline variables and sets them as variables for the build. An example of this, specifically for SSR can be seen here : https://github.com/adobe/aem-project-archetype/blob/23fea9f0a64fc5715ff7f28fca19cb720c355a79/src/main/archetype/pom.xml#L74C43-L74C43
This is then used in the deployment step of the front end, to deploy the application to Adobe IO for server side rendering here : https://github.com/adobe/aem-project-archetype/blob/23fea9f0a64fc5715ff7f28fca19cb720c355a79/src/main/archetype/ui.frontend.react/pom.xml#L147-L152
However, you'll notice that there is only a single variable set. This works for all environments up until Production. This is because for Production, we have a "staging" slot. If this build was to run and deploy into staging, and it reads the pipeline variables, it will actually deploy into Production.
I have asked previously if Pipeline variables can be used only with the staging slot, and was told no. As it is a single pipeline that deploys into both staging and production, the pipeline variables are shared.
The next thought might be something like having two sets of pipeline variables. For example :
AIO_RUNTIME_NAMESPACE = {ProductionAIO}
AIO_RUNTIME_NAMESPACE_STAGING = {StagingAIO}
However, that would require some logic within the POM file, and would also require the ability to know within the build step that we are deploying for Staging. I'm not sure how to achieve this.
So realistically :
- How can I detect (If it's possible) that I am deploying to the staging slot, via Adobe Sites Pipelines?
- How can I add logic to my POM file to pull a pipeline variable based on that detection? Is this possible?
- How has anyone got this far with AEM Sites with SPA Components/SSR without running into this issue? Do they just not use the staging slot?
