コミュニティアチーブメントバーを展開する。

解決済み

How to automate repo sync between customer managed git repo (we are using git hub) and Cloud manager repo.

Avatar

Level 2

How do I automate repository sync between customer managed git repo (we are using git hub) and AEM Cloud manager repo.

トピック

トピックはコミュニティのコンテンツの分類に役立ち、関連コンテンツを発見する可能性を広げます。

1 受け入れられたソリューション

Avatar

正解者
Level 10

Hello,

you can achieve this by only using Git commands. However, for automation, I recommend using GitHub Actions.

Here is an example workflow to Push a Selected Branch to Adobe Git:

 

name: Git Sync To Adobe Repo

on: 
  workflow_dispatch:
  push:
    branches:
      - develop

jobs:
  build:
    name: Push Selected Branch to Adobe Git
    runs-on: ubuntu-latest
    steps:              
      - name: Checkout Git Source Code
        run: |
          git clone --branch "$GITHUB_REF_NAME" https://${{secrets.GH_USER}}:${{secrets.GH_TOKEN}}@github.com/$GITHUB_REPOSITORY
      
      - name: Push Branch to Adobe Repository
        run: |
          cd ${{github.event.repository.name}}
          git remote add adobe https://${{secrets.ADOBE_GIT_USER}}:${{secrets.ADOBE_GIT_TOKEN}}@git.cloudmanager.adobe.com/${{secrets.ADOBE_GIT_PATH}}
          git push adobe "$GITHUB_REF_NAME"

 

Make sure to add the required GitHub Actions secrets used in the example.

 

Hope this helps,

Daniel

元の投稿で解決策を見る

5 返信

Avatar

Community Advisor

Cloud manager allows integration of private github repositores, so you can checkout that option 
https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/usi... 

Avatar

Community Advisor

Avatar

正解者
Level 10

Hello,

you can achieve this by only using Git commands. However, for automation, I recommend using GitHub Actions.

Here is an example workflow to Push a Selected Branch to Adobe Git:

 

name: Git Sync To Adobe Repo

on: 
  workflow_dispatch:
  push:
    branches:
      - develop

jobs:
  build:
    name: Push Selected Branch to Adobe Git
    runs-on: ubuntu-latest
    steps:              
      - name: Checkout Git Source Code
        run: |
          git clone --branch "$GITHUB_REF_NAME" https://${{secrets.GH_USER}}:${{secrets.GH_TOKEN}}@github.com/$GITHUB_REPOSITORY
      
      - name: Push Branch to Adobe Repository
        run: |
          cd ${{github.event.repository.name}}
          git remote add adobe https://${{secrets.ADOBE_GIT_USER}}:${{secrets.ADOBE_GIT_TOKEN}}@git.cloudmanager.adobe.com/${{secrets.ADOBE_GIT_PATH}}
          git push adobe "$GITHUB_REF_NAME"

 

Make sure to add the required GitHub Actions secrets used in the example.

 

Hope this helps,

Daniel

Avatar

Level 2

Hi  daniel-strmecki

 

As part of solution you have suggested few steps. Can you please suggest on this. what secrets should be used for  https://${{secrets.GH_USER}}:${{secrets.GH_TOKEN}}@github.com/$GITHUB_REPOSITORY
 https://${{secrets.ADOBE_GIT_USER}}:${{secrets.ADOBE_GIT_TOKEN}}@git.cloudmanager.adobe.com/${{secre...

 

secrets of any existing user works or we need to create a new user and use that secrets for this kind of implemntation.

 

Thankyou,

Bala

 

 

Avatar

Level 10

Hi @KacharlaBa,

you will need a user who has access to both the GitHub repo and the Adobe repo. You can use your personal account and generate an access token in GitHub/Cloud Manager. However, in that case, your username will appear in GitHub Actions and Git history. A slightly better option would be to create a service account user, assuming you have the time for it

 

Hope this helps,

Daniel