Hey guys,
Happy new year to everyone!
Starting a new year with a fresh query!
We want to use our RDE as our DEV environment.
RDE inherently is used as a local by developers one dev at a time.
The deployment is done currently via aio plugin.
But we want to restrict that since DEV environment would be used by multiple users.
Is it possible to control this and create a pipeline in ADO which deploys to RDE alone?
BR,
Nagesh
Solved! Go to Solution.
Hi @NageshRaja,
we are using GH Actions for deployment to RDE, here is an example pipeline.
name: AEM Deploy To RDE
on:
workflow_dispatch:
env:
CM_PROGRAM_ID: _YOUR_VALUE_HERE
CM_ORG_ID: _YOUR_VALUE_HERE@AdobeOrg
CM_ENVIRONMENT_ID: _YOUR_VALUE_HERE
jobs:
build:
name: Deploy Selected Branch to RDE
runs-on: ubuntu-latest
env:
CI_BUILD: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Setup AIO CLI
run: |
npm install -g @adobe/aio-cli
aio plugins:install @adobe/aio-cli-plugin-cloudmanager
aio plugins:install @adobe/aio-cli-plugin-aem-rde
- name: Checkout Git Source Code
run: |
git clone --branch "$GITHUB_REF_NAME" https://${{secrets.GH_USER}}:${{secrets.GH_TOKEN}}@github.com/$GITHUB_REPOSITORY
- name: Build Project Without Unit Tests
run:
mvn clean package -DskipTests
- name: Set AIO Configuration
run: |
aio config:set ims.contexts.aio-cli-plugin-cloudmanager '${{secrets.AIO_CONFIG_JSON_OAUTH}}' --json
aio config:set ims.contexts.aio-cli-plugin-cloudmanager.private_key '${{secrets.AIO_PRIVATE_KEY_OAUTH}}'
aio config:set cloudmanager_programid $CM_PROGRAM_ID
aio config:set cloudmanager_environmentid $CM_ENVIRONMENT_ID
aio config:set cloudmanager_orgid $CM_ORG_ID
- name: Start Deployment via Cloud Manager
run: |
aio aem:rde:install all/target/onecms.all-1.0.0-SNAPSHOT.zip
aio aem:rde:install dispatcher/target/onecms.dispatcher.cloud-1.0.0-SNAPSHOT.zip
In GH Actions you can cancel all pipelines "in progress" when a new pipeline is "started".
jobs:
example_job:
runs-on: ubuntu-latest
concurrency:
group: example-group
cancel-in-progress: true
Unfortunately, there is no OOTB property to prevent a job from running if one is already started. You can try to achieve something like that with GitHub APIs. Note that I haven't tested this, but it could look something like:
jobs:
check_concurrent:
runs-on: ubuntu-latest
steps:
- name: Check running workflows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
running_workflows=$(gh api -X GET \
"repos/${{ github.repository }}/actions/runs" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
--jq '.workflow_runs[] | select(.status == "in_progress") | .id')
if [[ -n "$running_workflows" ]]; then
echo "Another workflow is already running. Exiting..."
exit 1
fi
Good luck,
Daniel
Yes, ultimately RDE also as a dedicated environment ID which can be used to push the artefacts via ADO pipelines.
You can use either of the 2 approaches -
Approach 1 -
You can configure your pipeline YAML file to automate the deployment. Here's a sample below -
trigger:
- main # Adjust this to your branch name
pool:
vmImage: 'ubuntu-latest' # Use your preferred image (e.g., windows-latest for Windows agents)
variables:
AEM_RDE_HOST: '<your-aem-rde-host>'
AEM_USERNAME: '<aem-username>'
AEM_PASSWORD: '<aem-password>'
AEM_PACKAGE_NAME: '<your-package-name>.zip'
stages:
- stage: Build
jobs:
- job: BuildJob
steps:
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
options: '-DskipTests'
goals: 'clean install'
- stage: Deploy
dependsOn: Build
jobs:
- job: DeployJob
steps:
# Example of using AEM CLI or Maven to deploy to AEM
- task: CopyFiles@2
inputs:
SourceFolder: '$(Build.ArtifactStagingDirectory)'
Contents: '**/*.zip'
TargetFolder: '$(Build.SourcesDirectory)/deployment'
- script: |
echo "Deploying AEM Package to RDE"
curl -u $(AEM_USERNAME):$(AEM_PASSWORD) -F file=@$(Build.SourcesDirectory)/deployment/$(AEM_PACKAGE_NAME) "http://$(AEM_RDE_HOST)/crx/packmgr/service.jsp?cmd=deploy"
displayName: 'Deploy to AEM RDE'
Approach 2 -
If you're using Adobe I/O CLI for AEM deployment, you could install it within the pipeline and use it for deployment.
- task: NodeTool@0
inputs:
versionSpec: '14.x'
- script: |
npm install -g @adobe/aio-cli
aio login
aio app deploy
displayName: 'Deploy to AEM using Adobe I/O CLI'
Hope this helps!
Best Regards,
Rohan Garg
but how do you restrict the users from concurrently deploying?
Views
Replies
Total Likes
Hi @NageshRaja,
we are using GH Actions for deployment to RDE, here is an example pipeline.
name: AEM Deploy To RDE
on:
workflow_dispatch:
env:
CM_PROGRAM_ID: _YOUR_VALUE_HERE
CM_ORG_ID: _YOUR_VALUE_HERE@AdobeOrg
CM_ENVIRONMENT_ID: _YOUR_VALUE_HERE
jobs:
build:
name: Deploy Selected Branch to RDE
runs-on: ubuntu-latest
env:
CI_BUILD: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Setup AIO CLI
run: |
npm install -g @adobe/aio-cli
aio plugins:install @adobe/aio-cli-plugin-cloudmanager
aio plugins:install @adobe/aio-cli-plugin-aem-rde
- name: Checkout Git Source Code
run: |
git clone --branch "$GITHUB_REF_NAME" https://${{secrets.GH_USER}}:${{secrets.GH_TOKEN}}@github.com/$GITHUB_REPOSITORY
- name: Build Project Without Unit Tests
run:
mvn clean package -DskipTests
- name: Set AIO Configuration
run: |
aio config:set ims.contexts.aio-cli-plugin-cloudmanager '${{secrets.AIO_CONFIG_JSON_OAUTH}}' --json
aio config:set ims.contexts.aio-cli-plugin-cloudmanager.private_key '${{secrets.AIO_PRIVATE_KEY_OAUTH}}'
aio config:set cloudmanager_programid $CM_PROGRAM_ID
aio config:set cloudmanager_environmentid $CM_ENVIRONMENT_ID
aio config:set cloudmanager_orgid $CM_ORG_ID
- name: Start Deployment via Cloud Manager
run: |
aio aem:rde:install all/target/onecms.all-1.0.0-SNAPSHOT.zip
aio aem:rde:install dispatcher/target/onecms.dispatcher.cloud-1.0.0-SNAPSHOT.zip
In GH Actions you can cancel all pipelines "in progress" when a new pipeline is "started".
jobs:
example_job:
runs-on: ubuntu-latest
concurrency:
group: example-group
cancel-in-progress: true
Unfortunately, there is no OOTB property to prevent a job from running if one is already started. You can try to achieve something like that with GitHub APIs. Note that I haven't tested this, but it could look something like:
jobs:
check_concurrent:
runs-on: ubuntu-latest
steps:
- name: Check running workflows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
running_workflows=$(gh api -X GET \
"repos/${{ github.repository }}/actions/runs" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
--jq '.workflow_runs[] | select(.status == "in_progress") | .id')
if [[ -n "$running_workflows" ]]; then
echo "Another workflow is already running. Exiting..."
exit 1
fi
Good luck,
Daniel
Views
Likes
Replies