Skip to main content

XMT CI/CD Pipeline Support

Summary​

The XMT CLI can be executed from a pipeline build environment, enabling it to be part of a Continuous Integration / Continuous Deployment (CI/CD) process.

Use Cases​

Here are some benefits of adding XMT CLI to your CI/CD process:

  • Ensure that your extension configuration files remain valid with the xmt validate extension command
  • Submit a new version of your extension automatically when all validations in your CI/CD pipeline are passed with the xmt submit extension command

Objectives​

In this module you will:

  1. Learn how XMT can support CI/CD processes
  2. Review steps for setting up XMT support for CI/CD pipelines

Prerequisites​

Please ensure that you have completed these prerequisites:

Steps​

Follow these steps to add the XMT CLI to your CI/CD pipeline:

  1. Generate Qualtrics Client Credentials
  2. Store Client Credentials Securely
  3. Procure an Access Token from Client Credentials
  4. Supply Access Token to XMT CLI

Step 1: Generate Qualtrics Client Credentials​

You can create OAuth Client Credentials in Qualtrics by following these steps:

1.1: Log in to the Qualtrics XM Platform with the user account that, in relation to your extension, has either the Owner (created the extension) or Admin role

1.2: Click on the profile icon in the top right

1.3: Select Account Settings from the dropdown

1.4: Click on Qualtrics IDs

1.5: Click on OAuth Client Manager

1.6: Click on the Create Client button

1.7: Enter a descriptive title, such as XMT CLI - {Your Extension Name} CI/CD, in the Name field

1.8: [OPTIONAL] Enter your email into the Contact field

1.9: Select openid from the Scope dropdown

1.10: Click on the Create Client button

1.11: Copy both the Client ID and Client Secret and store in a secure location, like a password manager

Step 2: Storing Client Credentials Securely​

Store the Client ID and Client Secret in a secret store service/tool that is accessible to your CI/CD pipeline.

Step 3: Procure an Access Token from Client Credentials​

During your pipeline build, you’ll need to use the Client ID and Client Secret to request an Access Token.

These Access Tokens expire after 1 hour, so it is practical to generate a new one each time your CI/CD process runs.

   curl -u "'''+CLIENT_ID+''':'''+CLIENT_SECRET+'''" --header "Content-Length: 0" --request POST "https://'''+DATA_CENTER+'''.qualtrics.com/oauth2/token?grant_type=client_credentials&scope=openid" \
| jq -r '.access_token' '''

Step 4: Supply Access Token to XMT CLI​

Using XMT in a CI/CD pipeline requires:

  1. An unexpired Access Token, and
  2. The Qualtrics Datacenter ID to which your user account is assigned

For XMT to automatically use both of those required values, they must be set as these exact environment variables:

  • XMT_ACCESS_TOKEN, and
  • XMT_DATA_CENTER

Below is an example of passing these values into a docker container which will run the extension CI/CD steps:

docker run -e XMT_ACCESS_TOKEN=${YOUR_NAME_FOR_XMT_ACCESS_TOKEN} -e XMT_DATA_CENTER=${YOUR_NAME_FOR_DATACENTER} --rm extension-build-test-submit
Install XMT in Container

Your container will need to install XMT before running any of its commands

Docker Examples​

Here are some examples of how you could do this with Docker:

RUN wget https://developer.qualtrics.com/extension-registry/v1/downloads/xmt/linux -O xmt \
&& chmod a+x xmt \
&& mv xmt /usr/local/bin
wget https://developer.qualtrics.com/extension-registry/v1/downloads/xmt/linux -O xmt
chmod a+x xmt
mv xmt /usr/local/bin

Recap​

This module has explained:

  1. How XMT can support CI/CD processes
  2. The steps for enabling XMT for CI/CD

If you have further questions or want to give feedback, please click the Feedback & Support tab on the right side of your screen.