Configuring Your Azure Repository

Your Liferay Cloud onboarding email contains a link to a GitHub repository hosted in the dxpcloud organization. This repository is a template for a team’s private Liferay Cloud development repository and is typically removed after 10 business days. Users must transfer the provisioned repository to their own private repository.

The provisioned GitHub repository can be transferred to an Azure repository as of version 3.2.0 of the Jenkins service. This must be done with administrative access to the Azure repository.

Note

The repository’s administrators are not necessarily the same as your project’s administrators in the Cloud console.

Preparing the Jenkins Service

If you’ve customized your Jenkinsfile, follow this guide to extend the default Jenkinsfile.

Importing from GitHub to Azure

  1. Go to Azure DevOps.

  2. Click New project.

    Click New project to begin creating a new Azure repository.

  3. Provide a name for the project.

  4. Ensure the visibility is set to private.

  5. Click Repos in the side navigation.

  6. Click Import under Import a repository.

    Click Import to open the import modal.

  7. Insert the GitHub repository’s URL into Clone URL.

  8. Select Requires Authentication.

    Import the GitHub repository using the import modal.

  9. Fill out the Username and Password/PAT fields and click Import.

  10. In the terminal, clone the provisioned GitHub repository locally:

    
    git clone git@github.com:dxpcloud/example.git
    
    
    Note

    If you have already cloned the repository to work with another provider, you can skip this step and work within the same clone.

  11. Add a new Git remote and point to Azure:

    
    git remote add azure ORGANIZATION@dev.azure.com:ORGANIZATION/PROJECTNAME/_git/PROJECTNAME
    
    
  12. Push the cloned repository to the new remote repository:

    
    git push azure master
    
    

If you need help creating, cloning, and pushing repositories, see Azure’s documentation.

Generating Access Tokens for Azure

Next, create an access token that to be used by the Webhook to trigger Jenkins builds:

  1. Navigate to the personal access tokens page.

    Create a personal access token for Azure, which cannot be accessed again later.

  2. Click New Token.

  3. Provide a name and an expiration date for this token.

  4. Configure the access token to have the permission below:

    • Code: Read

Connecting Azure to Your Jenkins Service

Lastly, set environment variables in the Jenkins service’s to point to your new repository:

  1. Log into the Liferay Cloud Console and navigate to your Jenkins service in the infra environment.

  2. Navigate to the Environment Variables tab.

  3. Configure the following environment variables:

NameValue
LCP_CI_SCM_PROVIDERazure-devops
LCP_CI_SCM_REPOSITORY_OWNER[repo owner]
LCP_CI_SCM_REPOSITORY_NAME[repo name]
LCP_CI_SCM_TOKEN[access token]

After updating these environment variables, the Jenkins service restarts. Jenkins checks the repository every 5 minutes and triggers builds for pushed branches.

Verifying Builds

Pushed branches trigger builds that you can see or deploy from the Builds tab in the Liferay Cloud Console. After setting up integration with the Jenkins service, a good next step is to verify these builds, to ensure that the integration was successful. Verify that new Git pushes trigger Jenkins builds:

  1. Make a change to the repository (like adding a file), then commit it to the branch:

    git commit -m "Add file to test builds"
    
  2. Push the branch up to Azure DevOps:

    git push azure branch-name
    
  3. Navigate to the Builds page in the Liferay Cloud Console.

  4. Verify that the build displays for the pushed branch on the Builds page. This might take up to 5 minutes.

Capabilities

Product

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy