diff --git a/.circleci/config.yml b/.circleci/config.yml index 0aa0fd4b8..0c3324a3e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -530,14 +530,32 @@ workflows: - /release-[0-9]+\.[0-9]+.*/ # match with releaseX.Y.* - build: + filters: + branches: + ignore: + - /ci\/.*/ + - /shadow\/.*/ + - /automerge\/.*/ name: build-12 pg_major: 12 image_tag: '<< pipeline.parameters.pg12_version >>' - build: + filters: + branches: + ignore: + - /ci\/.*/ + - /shadow\/.*/ + - /automerge\/.*/ name: build-13 pg_major: 13 image_tag: '<< pipeline.parameters.pg13_version >>' - build: + filters: + branches: + ignore: + - /ci\/.*/ + - /shadow\/.*/ + - /automerge\/.*/ name: build-14 pg_major: 14 image_tag: '<< pipeline.parameters.pg14_version >>' diff --git a/.github/workflows/merge-to-enterprise.yml b/.github/workflows/merge-to-enterprise.yml new file mode 100644 index 000000000..d67ebe4f0 --- /dev/null +++ b/.github/workflows/merge-to-enterprise.yml @@ -0,0 +1,38 @@ +name: "Automerge to enterprise" +on: + push: + branches: # TODO update to master before merging + - ci/auto-merge-to-enterprise + +env: + ENTERPRISE_BRANCH: shadow/enterprise-master + +jobs: + merge_to_enterprise: + # since we merge to a different repository we don't want it to trigger there + if: github.event.repository.full_name == 'citusdata/citus' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Configure enterprise deploy key + uses: webfactory/ssh-agent@v0.5.4 + with: + ssh-private-key: ${{ secrets.AUTOMERGE_SSH_PRIVATE_KEY }} + - name: Configure git identity + run: git config user.email "bots@citusdata.com" && git config user.name "citus-bot" + - run: git checkout -b "automerge/${ENTERPRISE_BRANCH}" + - run: git remote add enterprise git@github.com:citusdata/citus-enterprise.git + - run: git fetch enterprise + - run: git reset --hard "enterprise/${ENTERPRISE_BRANCH}" + - name: Create merge commit with descriptive message + run: | + sha=$(git rev-parse --short ${{ github.event.ref }}) + last_message=$(git log --oneline --format=%B -n 1 ${{ github.event.ref }} | head -n1) + message="Merge from community up to ${sha}: ${last_message}" + git merge -m "${message}" ${{ github.event.ref }} + # we forcepush the automerge branch. in case of concurrent changes the automerge branch might not have been + # promoted before we got a new merge. The final branch will only be allowing forwards. + - run: git push enterprise "automerge/${ENTERPRISE_BRANCH}" --force diff --git a/.github/workflows/promote-automerges.yml b/.github/workflows/promote-automerges.yml new file mode 100644 index 000000000..e4a398bae --- /dev/null +++ b/.github/workflows/promote-automerges.yml @@ -0,0 +1,34 @@ +name: 'Check promote automerges' +on: + check_suite: + types: [completed] + # for now we simply promote our tracking branch when the automerge branch is pushed + # before we merge this we want to debug the check_suite action above on the default branch. + # check_suite (as well as workflow_dispatch only trigger when the workflow is on the main branch + # this would require an approved merge + push: + branches: + - automerge/** + +jobs: + promote_main_branch: + if: github.event.repository.full_name == 'citusdata/citus-enterprise' + runs-on: ubuntu-latest + steps: + - name: DEBUG + env: + EVENT_CONTEXT: ${{ toJSON(github.event) }} + run: | + echo $EVENT_CONTEXT + + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Promote automerge branch to tracking branch + run: | + base_branch=$(git branch --show-current | sed -e "s/^automerge\///") + git checkout "${base_branch}" + git reset --hard "automerge/${base_branch}" + git log --oneline -n 5 + - run: git push