From a779137ff49474e1bda95f940b5c7e3bebc235a5 Mon Sep 17 00:00:00 2001 From: Anastasiia Pokasova Date: Fri, 19 Jul 2024 17:05:21 +0300 Subject: [PATCH] Feat/gitlab synchronization (#616) * Add draft for repo mirroring * Create mirror_repo_to_gitlab.yml * Update mirror_repo_to_gitlab.yml * Update mirror_repo_to_gitlab.yml * Update mirror-repo.yml * Update mirror-repo.yml --- .github/workflows/mirror-repo.yml | 82 +++++++++++++++++++++ .github/workflows/mirror_repo_to_gitlab.yml | 11 +++ 2 files changed, 93 insertions(+) create mode 100644 .github/workflows/mirror-repo.yml create mode 100644 .github/workflows/mirror_repo_to_gitlab.yml diff --git a/.github/workflows/mirror-repo.yml b/.github/workflows/mirror-repo.yml new file mode 100644 index 0000000000..ae1511275d --- /dev/null +++ b/.github/workflows/mirror-repo.yml @@ -0,0 +1,82 @@ +name: Mirror repo + +on: + workflow_call: + secrets: + GITLAB_URL: + required: true + GITLAB_USER: + required: true + GITLAB_PASSWORD: + required: true + +jobs: + mirror: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - id: mirror-1 + uses: yesolutions/mirror-action@master + continue-on-error: true + with: + REMOTE: ${{ secrets.GITLAB_URL }} + GIT_USERNAME: ${{ secrets.GITLAB_USER }} + GIT_PASSWORD: ${{ secrets.GITLAB_PASSWORD }} + + - run: sleep 60s + shell: bash + if: ${{ steps.mirror-1.outcome == 'failure' }} + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + if: ${{ steps.mirror-1.outcome == 'failure' }} + - run: sudo git remote remove mirror || true + if: ${{ steps.mirror-1.outcome == 'failure' }} + - id: mirror-2 + uses: yesolutions/mirror-action@master + continue-on-error: true + with: + REMOTE: ${{ secrets.GITLAB_URL }} + GIT_USERNAME: ${{ secrets.GITLAB_USER }} + GIT_PASSWORD: ${{ secrets.GITLAB_PASSWORD }} + if: ${{ steps.mirror-1.outcome == 'failure' }} + + - run: sleep 60s + shell: bash + if: ${{ steps.mirror-2.outcome == 'failure' }} + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + if: ${{ steps.mirror-2.outcome == 'failure' }} + - run: sudo git remote remove mirror || true + if: ${{ steps.mirror-2.outcome == 'failure' }} + - id: mirror-3 + uses: yesolutions/mirror-action@master + continue-on-error: true + with: + REMOTE: ${{ secrets.GITLAB_URL }} + GIT_USERNAME: ${{ secrets.GITLAB_USER }} + GIT_PASSWORD: ${{ secrets.GITLAB_PASSWORD }} + if: ${{ steps.mirror-2.outcome == 'failure' }} + + - run: sleep 60s + shell: bash + if: ${{ steps.mirror-3.outcome == 'failure' }} + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + if: ${{ steps.mirror-3.outcome == 'failure' }} + - run: sudo git remote remove mirror || true + if: ${{ steps.mirror-3.outcome == 'failure' }} + - id: mirror-4 + uses: yesolutions/mirror-action@master + with: + REMOTE: ${{ secrets.GITLAB_URL }} + GIT_USERNAME: ${{ secrets.GITLAB_USER }} + GIT_PASSWORD: ${{ secrets.GITLAB_PASSWORD }} + if: ${{ steps.mirror-3.outcome == 'failure' }} diff --git a/.github/workflows/mirror_repo_to_gitlab.yml b/.github/workflows/mirror_repo_to_gitlab.yml new file mode 100644 index 0000000000..f5e7fc4784 --- /dev/null +++ b/.github/workflows/mirror_repo_to_gitlab.yml @@ -0,0 +1,11 @@ +name: Mirror repo to GitLab + +on: [push, delete] + +jobs: + call-dream-ops-mirror-workflow: + uses: ./.github/workflows/mirror-repo.yml + secrets: + GITLAB_URL: ${{ secrets.GITLAB_URL }} + GITLAB_USER: ${{ secrets.GITLAB_USER }} + GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }}