Legacy Knowledge Base
Published Jul. 2, 2025

How to set up auto deploy for a new environment in Liferay Cloud

Written By

Matheus Monteiro

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • You want to set up an auto deploy task so every time a Build is created for a branch X, it is automatically deployed into the environment Y, just the way it is for the dev environment, when building the branch develop.

Environment

  • Liferay Cloud stack 4

Resolution

  • Set LCP_CI_USE_DEFAULT_JENKINSFILE="true" in the CI service LCP.json
  • Set "LCP_CI_SCM_JENKINSFILE_HOOKS_DIR":"ci/" also in the CI service LCP.json
  • Inside the ci/ folder, create a file (if it did not exist) called Jenkinsfile-after-all
  • Put the following code into the newly created file:
    if (env.BRANCH_NAME == 'branch_name') {
    deployToCloud('branch_name', deployTarget: 'environment')
    }
    For example, if you want your branch called "new_release" to be automatically deployed in the uat environment, you would use the following code:
    if (env.BRANCH_NAME == 'new_release') {
    deployToCloud('new_release', deployTarget: 'uat')
    }

Additional Information

  • We do NOT recommend using auto deploy for your production environment. Configuring this for production poses significant risks and can cause unintended consequences.

 

 

Did this article resolve your issue ?

Legacy Knowledge Base