CI/CD Setup Skip to main content

CI/CD Setup

Process for setting up CI/CD pipeline in Mendix apps

Prerequisite: App must be using Git version control, not SVN.

  1. Confirm the “UnitTesting” module has been added to your app, and at least one test has been added. 
    1. If your app does not have the “UnitTesting” module, add it from the marketplace. 
    2. Check that your app has at least 1 unit test (microflows that start with either “UT_” or “TEST_” 
      1. If not, create a dummy unit test that always returns true. 

  1. Configure your app’s After startup microflow to call UnitTesting.Startup 
    1. Find the After Startup microflow in App Settings > Runtime
      Screenshot of mendix showing where to find After startup microflow
    2. Use a microflow call to call UnitTesting.Startup (this step may already be completed) 
      Screenshot of Mendix showing a microflow call to UnitTesting.Startup
    3. Commit and push changes 

  1. Create an Acceptance branch by forking from main, and name it “acceptance”
  1. Make sure all developers who will use this pipeline have API Rights for both environments - Acceptance and Production (Environments > Permissions)
Sprintr screenshot identifying where to find API Rights permissions.=

  1. Set RemoteApiEnabled and RemoteApiPassword for acceptance environment 
    1. Navigate to Environments > Acceptance Details > Model Options 
    2. Scroll down to Constants and search “remote” 
      Sprinter screenshot showing how to find RemoteApi constants
    3. Set “UnitTesting.RemoteApiEnabled” to “True” 
    4. Generate a password using lastpass.com/features/password-generator 
    5. Set “UnitTesting.RemoteApiPassword” to the password you just generated. 
    6. Restart the environment 

  1. Generate a Personal Access Token and API key for your pipelines (Note: this only needs to be done once, it will apply to all pipelines) 
    1. Create a Mendix Personal Access Token for your pipelines 
      1. To find your Mendix API key, navigate to your Mendix user settings https://user-settings.mendix.com/link/profile 
      2. Go to the Developer Settings tab and press New Token 
      3. Name it (something like “pipeline”) 
      4. Select the following boxes: 
        Mendix website screenshot showing a number of boxes that should be checked when creating a Personal Access Token
        Mendix website screenshot showing a number of boxes that should be checked when creating a Personal Access Token
      5. Click Create 
      6. Copy and save your Personal Access Token somewhere you’ll remember 
    2. Create an API key for your pipelines (if you haven’t already) 
      1. Return to the Developer Settings tab of Mendix User Settings 
      2. Press Configure API Keys 
      3. Press Create New API Key and add a description relating to its use for pipelines 
      4. Copy and save your new API key somewhere you’ll remember 

  1. Set up BYU’s Mendix Deploy app (Note: this only needs to be done once per developer, it will apply to all apps in Mendix Deploy) 
    1. Log in to https://byu-mendix-deploy.apps.us-2a.mendixcloud.com/index.html 
    2. Press Manage API Info 
    3. Enter your Mendix API key you saved earlier (see step 6) 
    4. Enter your Mendix user name (Likely your BYU email, but can be found by selecting your profile picture on mendix.com) 
    5. Enter your Mendix Personal Access Token you saved earlier (see step 6) and press Save 

  1. Set Pipelines User Settings 
    1. Go to the pipelines tab in your app’s Sprintr page 
    2. Go to the settings tab 
    3. Press Setup 
    4. Enter your Personal Access Token and API Key you saved earlier, and press Save 

  1. Create Mendix Pipeline to put acceptance branch on Acceptance environment 
    1. Go to the pipelines tab in your app’s Sprintr page 
    2. Select Design a Pipeline, then Template pipeline, and name it “Accp branch to Accp”  
    3. Press Next 
      1. Open Start Pipeline 
      2. Set “Branch Expression” to be “acceptance” 
    4. Make sure “Trigger” is set to be “Teamserver push (Git)” 
    5. Scroll down to Deploy and open it 
      1. Set “Environment” to “Acceptance” 
    6. Press Save & Activate 

  1. Create Mendix Pipeline to put main branch on Acceptance environment 
    1. Go to the pipelines tab in your app’s Sprintr page 
    2. Select Design a Pipeline, then Template pipeline, and name it “Main branch to Accp”  
    3. Press Next 
    4. Open Start Pipeline 
      1. Set “Branch Expression” to be “main” 
      2. Make sure “Trigger” is set to be “Teamserver push (Git)” 
    5. Scroll down to Deploy and open it 
      1. Set “Environment” to “Acceptance” 
    6. Press Save & Activate 

  1. Using the Mendix Deploy app, create a pipeline to put the main branch on the Production environment 
    1. Log in to https://byu-mendix-deploy.apps.us-2a.mendixcloud.com/index.html 
    2. Find and select your application from the “Your Applications” list 
    3. If the fields under the Webhook section are empty (name, url, is active, webhook secret), then press Save 
    4. Under the Pipelines section, press New 
    5. Set the “BYU Pipeline Name” to be “Main branch to Prod” 
    6. Under Mendix Pipeline Info, select “TeamServer_Push” for the trigger and “main” from the Branch dropdown menu 
    7. Under BYU Pipeline Info, set the “Job type” to “Scheduled”, set the “Hour” and “Minute” to 8:00, set the “SRC Environment” to “Acceptance”, and set the “DEST Environment” to “Production” 
    8. Your page should look something like the following: 
      Screenshot of Mendix Deploy, showing a pipeline edit page
    9. If yours is not an OIT application and you do not submit RFCs through ServiceNow, check No RFC needed under RFC Info and leave the “Template id” blank. Press Save and skip the following step.
    10. If yours is an OIT application, go to sn.byu.edu 
      1. Navigate to the Standard Change Templates page (All > Standard Change Template)
        Screenshot of Standard Change Templates page in ServiceNow
      2. Find the standard change template for your app, and select it 
      3. Copy the “Alias” 
        Screenshot showing where to find Alias on a Standard Change Template
      4. Return to the RFC Info section of the Mendix Deploy app page, and paste the copied Alias into the “Template id” field 
      5. Press Save 

Once these steps are completed, the Mendix CI/CD pipeline is ready. To see a detailed explaination of how to use it, go to ‎the CI/CD process documentation.

Author: Matthew Bailey, OIT Application Engineering Campus Life Team • 7/31/2024