CDN cache purge automation migration from Jenkins to GitHub Actions in AEM as a Cloud Service

This article describes how to move CDN cache purge automation from Jenkins to GitHub Actions in Adobe Experience Manager as a Cloud Service, including generating a new purge API token and configuring it securely in your GitHub Actions workflow.

Description description

Environment

  • Adobe Experience Manager as a Cloud Service
  • Adobe-managed CDN
  • Cloud Manager
  • Jenkins
  • GitHub Actions

Issue/Symptoms

  • CDN cache purges are automated through Jenkins.
  • The existing purge key is stored as a masked Jenkins credential and can’t be retrieved or viewed.
  • The CDN cache purge automation must be migrated from Jenkins to GitHub Actions.
  • GitHub Actions requires a new purge API token for the purge requests.
  • The Jenkins and GitHub Actions workflows must continue to function during the phased migration.

Cause

The purge key used by Jenkins is stored as a masked secret credential and can’t be retrieved for reuse. The GitHub Actions workflow therefore requires a new purge API token stored as a GitHub Actions secret.

Resolution resolution

Follow the steps below to migrate the CDN cache purge automation:

  1. Review the official documentation for generating a CDN Purge API Token:
    Configure a Purge API Token

  2. Follow the documented self-service process to generate a new Purge API Token.

  3. In the GitHub repository, go to Settings > Secrets and variables > Actions.

  4. Select New repository secret, and add the new Purge API Token as a secret. For example, name the secret AEM_PURGE_API_TOKEN.

  5. Update the GitHub Actions workflow to use the new secret. For example:

    code language-none
    - name: Purge CDN Cache
      run: |
        curl -X PURGE "" \
          -H "X-AEM-Purge-Key: ${{ secrets.AEM_PURGE_API_TOKEN }}" \
          -H "X-AEM-Purge: all"
    
  6. Test the GitHub Actions workflow and verify that it successfully purges the CDN cache by using the new API token.

  7. During the migration, continue using the legacy purge key in the Jenkins jobs while the key remains valid.

recommendation-more-help
experience-cloud-kcs-help-kbarticles