Introduction
Cloud Manager, part of the Adobe Managed Services, is a continuous integration and continuous delivery (CI/CD) framework that lets organisations deploy code to their AEM environments. This is only applicable for organisations which use Adobe Managed Services to host their AEM installations with Adobe.
The pipeline runs through a standard set of steps as shown below. Output of each step is available via an API through Adobe I/O, which is like a central place to manage all Adobe APIs.
Problem
Short of creating an Adobe account, getting added to the AMS project and then keeping an eye on the notifications in the console - there is no other way of knowing what’s happening with a particular Cloud Manager pipeline, with out of the box solutions/integrations that Adobe provides.
We need to build something up if we want to send notifications to a larger group who don’t have or need to have a Adobe account.
Solution
The Cloud Manager API enables us to interact with it in a fully programmatic fashion. This allows for integration of the Cloud Manager Continuous Integration / Continuous Delivery pipeline with other systems. Using this we will setup a workflow such that every new step, pipeline execution will send out a notification on MS Teams and Email.
Adobe I/O Cloud Manager Integration
The starting point of this setup is the Adobe I/O console.
To complete these steps, you need to either the System Administrator role or be an assigned API Developer for your organization.
All requests to the Cloud Manager API are authenticated using an access token retrieved using JWT.
To create an API Integration:
- Login to Adobe I/O console https://console.adobe.io/.
- Click the Create new project button.
- Click the Add to Project button on top left and select API from the drop-down menu.
- Under the Experience Cloud section select Cloud Manager and then click Next.
- Generate or Upload a key pair. Click either Generate keypair or Next.
- Select one of the Product Profiles to assign the integration to a specific Cloud Manager role. It will control the level of access this API will have on Cloud Manager.
- Click Save configured API.
This will create your client and the page will list Client ID (sometimes referred to as an API Key), Organization ID, Technical Account ID and Client Secret. These values will be needed when we setup the AWS Lambda.
This completes the initial step on Adobe I/O, we will return to it once our webhook is ready
Webhook - AWS API Gateway + AWS Lambda
The Lambda and serverless configs can be cloned from this repo
We need to setup a few things before we can deploy our lambda.
Prerequisites
- AWS CLI (preferably v2)
- Serverless framework
- Adobe I/O Cloudmanager project details
- MS Teams incoming webhook
- AWS Account with -
- Custom domain on Route 53 and ACM cert for the domain
- SES configured to send emails
- S3 bucket to use for serverless template
- Adobe I/O keys saved in AWS SSM
Once the above are in-place, the subsequent steps are as follows -
Setup
Add the appropriate configuration properties in
src/config.py
Create and activate virtual environment
1python3 -m venv env 2source env/bin/activate
Install dependencies
1(env) pip3 install -r requirements.txt
(Optional) Running lint, test, coverage reports
1(env) pylint src/*.py --rcfile=setup.cfg 2(env) pytest 3(env) coverage run -m pytest 4(env) coverage html
Export the credentials as environment variables. Either the access/secret keys or the aws cli profile
1export AWS_PROFILE=mfa
Deloy
- Deploy/Update the service to AWS
1sls deploy
Once the deployment is completed, the custom domain API gateway will be ready to use. In case of this example, it’ll be https://example.com/abobeio
Now we return back to Adobe I/O console to complete Event registration.
Adobe I/O Cloud Manager Integration - contd.
Login to Adobe I/O console https://console.adobe.io/.
Select the previously created project.
Click the Add to Project button and select “Event” from the drop-down menu.
Under the Experience Cloud section select Cloud Manager and then click Next.
Select the events you want to receive on the webhook. Available options are -
- Pipeline Execution Started/Ended
- Pipeline Execution Step Started/Waiting/Ended
Next screen shows the JWT created earlier, Click Next.
Provide the webhook URL - The API endpoint we created above
https://example.com/adobeio
Click Save configured events
Adobe I/O will trigger a challenge request and if it returns
200
, the status of the webhook will be changed toACTIVE
Note - If you cannot host a Public API in your environment due to security implication, consider using the Journaling API
Conclusion
This is a simple integration with Cloud Manager API using Adobe IO which sends notifications to MS Teams and Email.
It can be further extended to cater to many other use cases as well, like -
- Starting the Cloud Manager CI/CD pipeline from an external non-git system.
- Cancelling an existing execution before triggering a new one.
- Executing additional steps before the standard Cloud Manager production deployment.
- Triggering additional activities after the a pipeline execution is complete or a specific step has been completed, like CDN cache invalidation, creating issue reports in bug tracking systems on pipeline failures, saving run stats to a monitoring time-series db like prometheus etc.
Once the inital setup is ready, the possibilities are endless. 👍
Note: Code mentioned above is here