From 446620efe07e09a2935de3affe824429be8abc7f Mon Sep 17 00:00:00 2001 From: Manish Gupta <59428681+manishg3@users.noreply.github.com> Date: Mon, 6 Nov 2023 19:05:20 +0530 Subject: [PATCH 01/15] cherrypicked branch build code --- .github/workflows/build-branch.yml | 205 +++++++++++++++++++++++++++++ .gitignore | 4 + 2 files changed, 209 insertions(+) create mode 100644 .github/workflows/build-branch.yml diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml new file mode 100644 index 00000000000..26b8addd23b --- /dev/null +++ b/.github/workflows/build-branch.yml @@ -0,0 +1,205 @@ + +name: Docker Branch Build + +on: + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + tags: + description: 'Dev/QA Builds' + +env: + gh_branch: ${{ github.ref_name }} + img_tag: latest + +jobs: + branch_build_and_push: + name: Build-Push Web/Space/API/Proxy Docker Image + runs-on: ubuntu-20.04 + + steps: + - name: Check out the repo + uses: actions/checkout@v3.3.0 + + - uses: ASzc/change-string-case-action@v2 + id: gh_branch_upper_lower + with: + string: ${{ env.gh_branch }} + + - uses: mad9000/actions-find-and-replace-string@2 + id: gh_branch_replace_slash + with: + source: ${{ steps.gh_branch_upper_lower.outputs.lowercase }} + find: '/' + replace: '-' + + - uses: mad9000/actions-find-and-replace-string@2 + id: gh_branch_replace_dot + with: + source: ${{ steps.gh_branch_replace_slash.outputs.value }} + find: '.' + replace: '' + + - uses: mad9000/actions-find-and-replace-string@2 + id: gh_branch_clean + with: + source: ${{ steps.gh_branch_replace_dot.outputs.value }} + find: '_' + replace: '' + - name: Uploading Proxy Source + uses: actions/upload-artifact@v3 + with: + name: proxy-src-code + path: ./nginx + - name: Uploading Backend Source + uses: actions/upload-artifact@v3 + with: + name: backend-src-code + path: ./apiserver + - name: Uploading Web Source + uses: actions/upload-artifact@v3 + with: + name: web-src-code + path: | + ./ + !./apiserver + !./nginx + !./deploy + !./space + + - name: Uploading Space Source + uses: actions/upload-artifact@v3 + with: + name: space-src-code + path: | + ./ + !./apiserver + !./nginx + !./deploy + !./web + outputs: + gh_branch_name: ${{ steps.gh_branch_clean.outputs.value }} + + branch_build_push_frontend: + runs-on: ubuntu-20.04 + needs: [ branch_build_and_push ] + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.5.0 + + - name: Login to Docker Hub + uses: docker/login-action@v2.1.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Downloading Web Source Code + uses: actions/download-artifact@v3 + with: + name: web-src-code + + - name: Build and Push Frontend to Docker Container Registry + uses: docker/build-push-action@v4.0.0 + with: + context: . + file: ./web/Dockerfile.web + platforms: linux/amd64 + tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + push: true + env: + DOCKER_BUILDKIT: 1 + DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + + branch_build_push_space: + runs-on: ubuntu-20.04 + needs: [ branch_build_and_push ] + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.5.0 + + - name: Login to Docker Hub + uses: docker/login-action@v2.1.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Downloading Space Source Code + uses: actions/download-artifact@v3 + with: + name: space-src-code + + - name: Build and Push Space to Docker Hub + uses: docker/build-push-action@v4.0.0 + with: + context: . + file: ./space/Dockerfile.space + platforms: linux/amd64 + tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-space-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + push: true + env: + DOCKER_BUILDKIT: 1 + DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + + branch_build_push_backend: + runs-on: ubuntu-20.04 + needs: [ branch_build_and_push ] + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.5.0 + + - name: Login to Docker Hub + uses: docker/login-action@v2.1.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Downloading Backend Source Code + uses: actions/download-artifact@v3 + with: + name: backend-src-code + + - name: Build and Push Backend to Docker Hub + uses: docker/build-push-action@v4.0.0 + with: + context: . + file: ./Dockerfile.api + platforms: linux/amd64 + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-backend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + env: + DOCKER_BUILDKIT: 1 + DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + + branch_build_push_proxy: + runs-on: ubuntu-20.04 + needs: [ branch_build_and_push ] + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.5.0 + + - name: Login to Docker Hub + uses: docker/login-action@v2.1.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Downloading Proxy Source Code + uses: actions/download-artifact@v3 + with: + name: proxy-src-code + + - name: Build and Push Plane-Proxy to Docker Hub + uses: docker/build-push-action@v4.0.0 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64 + tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-proxy-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + push: true + env: + DOCKER_BUILDKIT: 1 + DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1e99e102ad5..fbcd8320276 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,7 @@ pnpm-lock.yaml pnpm-workspace.yaml .npmrc +.secrets +tmp/ +## packages +dist From 3dab2b540c5e5e4f1e875ebb3f36b6291c39f62a Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 14:04:20 +0530 Subject: [PATCH 02/15] trigger on pull request --- .github/workflows/build-branch.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 26b8addd23b..bf7ea19a99f 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -2,6 +2,11 @@ name: Docker Branch Build on: + pull_request: + types: + - opened + - synchronize + - closed workflow_dispatch: inputs: logLevel: @@ -17,6 +22,7 @@ env: jobs: branch_build_and_push: + if: ${{ (github.event_name == 'pull_request') && (( github.event.action =='closed' && github.event.pull_request.merged == true) || ( github.event.action =='opened'|| github.event.action =='synchronize'))}} name: Build-Push Web/Space/API/Proxy Docker Image runs-on: ubuntu-20.04 From e7f6a4e73b2476e2ae7b5b3fdb4549c5ec0bf8f5 Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 14:40:06 +0530 Subject: [PATCH 03/15] wip --- .github/workflows/build-branch.yml | 192 +++++++++++++++-------------- 1 file changed, 101 insertions(+), 91 deletions(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index bf7ea19a99f..9d43e9ae983 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -18,7 +18,8 @@ on: env: gh_branch: ${{ github.ref_name }} - img_tag: latest + gh_t_branch: ${{ github.event.pull_request.base.ref }} + jobs: branch_build_and_push: @@ -29,11 +30,20 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v3.3.0 + + - name: Set Environment Variable + run: | + if [ ${{ github.event_name }} == 'pull_request' ] && [ ${{github.event.action}} == 'closed' ] ; then + echo "::set-env name=TRG_BRANCH::${{github.event.pull_request.base.ref}}" + else + echo "::set-env name=TRG_BRANCH::${{github.ref_name}}" + fi - uses: ASzc/change-string-case-action@v2 id: gh_branch_upper_lower with: - string: ${{ env.gh_branch }} + string: $TRG_BRANCH + # string: ${{ env.gh_branch }} - uses: mad9000/actions-find-and-replace-string@2 id: gh_branch_replace_slash @@ -89,95 +99,95 @@ jobs: outputs: gh_branch_name: ${{ steps.gh_branch_clean.outputs.value }} - branch_build_push_frontend: - runs-on: ubuntu-20.04 - needs: [ branch_build_and_push ] - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.5.0 - - - name: Login to Docker Hub - uses: docker/login-action@v2.1.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Downloading Web Source Code - uses: actions/download-artifact@v3 - with: - name: web-src-code - - - name: Build and Push Frontend to Docker Container Registry - uses: docker/build-push-action@v4.0.0 - with: - context: . - file: ./web/Dockerfile.web - platforms: linux/amd64 - tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} - push: true - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} - - branch_build_push_space: - runs-on: ubuntu-20.04 - needs: [ branch_build_and_push ] - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.5.0 - - - name: Login to Docker Hub - uses: docker/login-action@v2.1.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Downloading Space Source Code - uses: actions/download-artifact@v3 - with: - name: space-src-code - - - name: Build and Push Space to Docker Hub - uses: docker/build-push-action@v4.0.0 - with: - context: . - file: ./space/Dockerfile.space - platforms: linux/amd64 - tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-space-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} - push: true - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} - - branch_build_push_backend: - runs-on: ubuntu-20.04 - needs: [ branch_build_and_push ] - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.5.0 - - - name: Login to Docker Hub - uses: docker/login-action@v2.1.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Downloading Backend Source Code - uses: actions/download-artifact@v3 - with: - name: backend-src-code - - - name: Build and Push Backend to Docker Hub - uses: docker/build-push-action@v4.0.0 - with: - context: . - file: ./Dockerfile.api - platforms: linux/amd64 - push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-backend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + # branch_build_push_frontend: + # runs-on: ubuntu-20.04 + # needs: [ branch_build_and_push ] + # steps: + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v2.5.0 + + # - name: Login to Docker Hub + # uses: docker/login-action@v2.1.0 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Downloading Web Source Code + # uses: actions/download-artifact@v3 + # with: + # name: web-src-code + + # - name: Build and Push Frontend to Docker Container Registry + # uses: docker/build-push-action@v4.0.0 + # with: + # context: . + # file: ./web/Dockerfile.web + # platforms: linux/amd64 + # tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + # push: true + # env: + # DOCKER_BUILDKIT: 1 + # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + + # branch_build_push_space: + # runs-on: ubuntu-20.04 + # needs: [ branch_build_and_push ] + # steps: + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v2.5.0 + + # - name: Login to Docker Hub + # uses: docker/login-action@v2.1.0 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Downloading Space Source Code + # uses: actions/download-artifact@v3 + # with: + # name: space-src-code + + # - name: Build and Push Space to Docker Hub + # uses: docker/build-push-action@v4.0.0 + # with: + # context: . + # file: ./space/Dockerfile.space + # platforms: linux/amd64 + # tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-space-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + # push: true + # env: + # DOCKER_BUILDKIT: 1 + # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + + # branch_build_push_backend: + # runs-on: ubuntu-20.04 + # needs: [ branch_build_and_push ] + # steps: + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v2.5.0 + + # - name: Login to Docker Hub + # uses: docker/login-action@v2.1.0 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Downloading Backend Source Code + # uses: actions/download-artifact@v3 + # with: + # name: backend-src-code + + # - name: Build and Push Backend to Docker Hub + # uses: docker/build-push-action@v4.0.0 + # with: + # context: . + # file: ./Dockerfile.api + # platforms: linux/amd64 + # push: true + # tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-backend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + # env: + # DOCKER_BUILDKIT: 1 + # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} branch_build_push_proxy: runs-on: ubuntu-20.04 From 1326c7a898f6712187eb9b64aefce38707c90f12 Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 15:03:56 +0530 Subject: [PATCH 04/15] wi --- .github/workflows/build-branch.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 9d43e9ae983..8b1c73a37e5 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -16,10 +16,10 @@ on: tags: description: 'Dev/QA Builds' + env: gh_branch: ${{ github.ref_name }} gh_t_branch: ${{ github.event.pull_request.base.ref }} - jobs: branch_build_and_push: @@ -30,20 +30,19 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v3.3.0 - - - name: Set Environment Variable - run: | - if [ ${{ github.event_name }} == 'pull_request' ] && [ ${{github.event.action}} == 'closed' ] ; then - echo "::set-env name=TRG_BRANCH::${{github.event.pull_request.base.ref}}" - else - echo "::set-env name=TRG_BRANCH::${{github.ref_name}}" - fi + - name: Set Target Branch Name on PR close + if: ${{ github.event_name == 'pull_request' && github.event.action =='closed' }} + run: echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV + + - name: Set Target Branch Name on other than PR close + if: ${{ github.event.action !='closed' }} + run: echo "TARGET_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - uses: ASzc/change-string-case-action@v2 id: gh_branch_upper_lower with: - string: $TRG_BRANCH - # string: ${{ env.gh_branch }} + string: $TARGET_BRANCH - uses: mad9000/actions-find-and-replace-string@2 id: gh_branch_replace_slash From 44290e21912b7815f8250c39e84b3af504ef20da Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 15:09:55 +0530 Subject: [PATCH 05/15] wip --- .github/workflows/build-branch.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 8b1c73a37e5..a04df2fd9df 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -2,6 +2,9 @@ name: Docker Branch Build on: + push: + branches: + - "*" pull_request: types: - opened @@ -20,6 +23,7 @@ on: env: gh_branch: ${{ github.ref_name }} gh_t_branch: ${{ github.event.pull_request.base.ref }} + TARGET_BRANCH: '' jobs: branch_build_and_push: @@ -42,7 +46,7 @@ jobs: - uses: ASzc/change-string-case-action@v2 id: gh_branch_upper_lower with: - string: $TARGET_BRANCH + string: ${{env.TARGET_BRANCH}} - uses: mad9000/actions-find-and-replace-string@2 id: gh_branch_replace_slash From 8dbfb8f2b47193a3eb777c55856aa845daee9477 Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 15:12:37 +0530 Subject: [PATCH 06/15] wip --- .github/workflows/build-branch.yml | 57 +++++++++++++++--------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index a04df2fd9df..8ff8a22482e 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -21,8 +21,6 @@ on: env: - gh_branch: ${{ github.ref_name }} - gh_t_branch: ${{ github.event.pull_request.base.ref }} TARGET_BRANCH: '' jobs: @@ -192,33 +190,34 @@ jobs: # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} - branch_build_push_proxy: - runs-on: ubuntu-20.04 - needs: [ branch_build_and_push ] - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.5.0 + # branch_build_push_proxy: + # runs-on: ubuntu-20.04 + # needs: [ branch_build_and_push ] + # steps: + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v2.5.0 - - name: Login to Docker Hub - uses: docker/login-action@v2.1.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Login to Docker Hub + # uses: docker/login-action@v2.1.0 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Downloading Proxy Source Code - uses: actions/download-artifact@v3 - with: - name: proxy-src-code + # - name: Downloading Proxy Source Code + # uses: actions/download-artifact@v3 + # with: + # name: proxy-src-code + + # - name: Build and Push Plane-Proxy to Docker Hub + # uses: docker/build-push-action@v4.0.0 + # with: + # context: . + # file: ./Dockerfile + # platforms: linux/amd64 + # tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-proxy-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + # push: true + # env: + # DOCKER_BUILDKIT: 1 + # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and Push Plane-Proxy to Docker Hub - uses: docker/build-push-action@v4.0.0 - with: - context: . - file: ./Dockerfile - platforms: linux/amd64 - tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-proxy-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} - push: true - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} \ No newline at end of file From a06ebe517ed54fa978d31b89eeedfbaf423ac40f Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 15:14:49 +0530 Subject: [PATCH 07/15] wip --- .github/workflows/build-branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 8ff8a22482e..9e4782eb922 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -39,7 +39,7 @@ jobs: - name: Set Target Branch Name on other than PR close if: ${{ github.event.action !='closed' }} - run: echo "TARGET_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + run: echo "TARGET_BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV - uses: ASzc/change-string-case-action@v2 id: gh_branch_upper_lower From 1bda499ae04e3b101e695f7335c8fbc2ba92c0dd Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 15:17:46 +0530 Subject: [PATCH 08/15] wip --- .github/workflows/build-branch.yml | 60 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 9e4782eb922..05e11fc22d3 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -2,9 +2,9 @@ name: Docker Branch Build on: - push: - branches: - - "*" + # push: + # branches: + # - "*" pull_request: types: - opened @@ -190,34 +190,34 @@ jobs: # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} - # branch_build_push_proxy: - # runs-on: ubuntu-20.04 - # needs: [ branch_build_and_push ] - # steps: - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v2.5.0 + branch_build_push_proxy: + runs-on: ubuntu-20.04 + needs: [ branch_build_and_push ] + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.5.0 - # - name: Login to Docker Hub - # uses: docker/login-action@v2.1.0 - # with: - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Login to Docker Hub + uses: docker/login-action@v2.1.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - # - name: Downloading Proxy Source Code - # uses: actions/download-artifact@v3 - # with: - # name: proxy-src-code + - name: Downloading Proxy Source Code + uses: actions/download-artifact@v3 + with: + name: proxy-src-code - # - name: Build and Push Plane-Proxy to Docker Hub - # uses: docker/build-push-action@v4.0.0 - # with: - # context: . - # file: ./Dockerfile - # platforms: linux/amd64 - # tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-proxy-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} - # push: true - # env: - # DOCKER_BUILDKIT: 1 - # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and Push Plane-Proxy to Docker Hub + uses: docker/build-push-action@v4.0.0 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64 + tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-proxy-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + push: true + env: + DOCKER_BUILDKIT: 1 + DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} From aec0e348eef9f4b9047aafeb7702b9f99a39795c Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 16:23:51 +0530 Subject: [PATCH 09/15] branch filter --- .github/workflows/build-branch.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 05e11fc22d3..828cb811aa7 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -2,9 +2,12 @@ name: Docker Branch Build on: - # push: - # branches: - # - "*" + push: + branches: + - master + - release + - qa + - develop pull_request: types: - opened @@ -220,4 +223,10 @@ jobs: DOCKER_BUILDKIT: 1 DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} - + - name: Remove the images + uses: docker/build-push-action@v4.0.0 + env: + DOCKER_BUILDKIT: 1 + DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + From fdc2c542221fcf2b1178c1d1bfb48e666c8b957d Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 16:25:20 +0530 Subject: [PATCH 10/15] checking branch filter --- .github/workflows/build-branch.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 828cb811aa7..8b06ad84068 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -8,6 +8,7 @@ on: - release - qa - develop + - dev/mg-branch-build-2 pull_request: types: - opened From fd5f37dda1a7029463102dc8e2631f1145cf7ac6 Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 16:29:31 +0530 Subject: [PATCH 11/15] checking push --- .github/workflows/build-branch.yml | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 8b06ad84068..ec4880b5630 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -11,25 +11,14 @@ on: - dev/mg-branch-build-2 pull_request: types: - - opened - - synchronize - closed - workflow_dispatch: - inputs: - logLevel: - description: 'Log level' - required: true - default: 'warning' - tags: - description: 'Dev/QA Builds' - env: TARGET_BRANCH: '' jobs: branch_build_and_push: - if: ${{ (github.event_name == 'pull_request') && (( github.event.action =='closed' && github.event.pull_request.merged == true) || ( github.event.action =='opened'|| github.event.action =='synchronize'))}} + if: ${{ (github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.action =='closed' && github.event.pull_request.merged == true) }} name: Build-Push Web/Space/API/Proxy Docker Image runs-on: ubuntu-20.04 @@ -42,8 +31,8 @@ jobs: run: echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV - name: Set Target Branch Name on other than PR close - if: ${{ github.event.action !='closed' }} - run: echo "TARGET_BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV + if: ${{ github.event_name == 'push' }} + run: echo "TARGET_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - uses: ASzc/change-string-case-action@v2 id: gh_branch_upper_lower From ac4f67ea364f4ce9e91ec99daf875cf4f37dd41e Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 16:30:02 +0530 Subject: [PATCH 12/15] checking push again --- .github/workflows/build-branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index ec4880b5630..3f3692ec5e5 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -8,7 +8,7 @@ on: - release - qa - develop - - dev/mg-branch-build-2 + # - dev/mg-branch-build-2 pull_request: types: - closed From a258ca609cc9ccce044d269558ccb338804724f7 Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 16:35:24 +0530 Subject: [PATCH 13/15] wip --- .github/workflows/build-branch.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 3f3692ec5e5..d921c185a77 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -12,6 +12,12 @@ on: pull_request: types: - closed + branches: + - master + - release + - qa + - develop + # - mg-test-develop env: TARGET_BRANCH: '' @@ -213,10 +219,3 @@ jobs: DOCKER_BUILDKIT: 1 DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Remove the images - uses: docker/build-push-action@v4.0.0 - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} - From 29faa260ef87ad4980e09d15c5a362edcb42f7c0 Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 16:36:53 +0530 Subject: [PATCH 14/15] wip --- .github/workflows/build-branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index d921c185a77..3ad7c7c3e83 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -17,7 +17,7 @@ on: - release - qa - develop - # - mg-test-develop + - mg-test-develop env: TARGET_BRANCH: '' From a0cfe3a8e528d3d8f6ac2a4f75411ca1b81c4789 Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 16:41:14 +0530 Subject: [PATCH 15/15] code cleanup before PR --- .github/workflows/build-branch.yml | 182 ++++++++++++++--------------- 1 file changed, 90 insertions(+), 92 deletions(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 3ad7c7c3e83..168d2375f4b 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -1,5 +1,5 @@ -name: Docker Branch Build +name: Branch Build on: push: @@ -8,7 +8,6 @@ on: - release - qa - develop - # - dev/mg-branch-build-2 pull_request: types: - closed @@ -17,7 +16,6 @@ on: - release - qa - develop - - mg-test-develop env: TARGET_BRANCH: '' @@ -99,95 +97,95 @@ jobs: outputs: gh_branch_name: ${{ steps.gh_branch_clean.outputs.value }} - # branch_build_push_frontend: - # runs-on: ubuntu-20.04 - # needs: [ branch_build_and_push ] - # steps: - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v2.5.0 - - # - name: Login to Docker Hub - # uses: docker/login-action@v2.1.0 - # with: - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_TOKEN }} - # - name: Downloading Web Source Code - # uses: actions/download-artifact@v3 - # with: - # name: web-src-code - - # - name: Build and Push Frontend to Docker Container Registry - # uses: docker/build-push-action@v4.0.0 - # with: - # context: . - # file: ./web/Dockerfile.web - # platforms: linux/amd64 - # tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} - # push: true - # env: - # DOCKER_BUILDKIT: 1 - # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} - - # branch_build_push_space: - # runs-on: ubuntu-20.04 - # needs: [ branch_build_and_push ] - # steps: - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v2.5.0 - - # - name: Login to Docker Hub - # uses: docker/login-action@v2.1.0 - # with: - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_TOKEN }} - # - name: Downloading Space Source Code - # uses: actions/download-artifact@v3 - # with: - # name: space-src-code - - # - name: Build and Push Space to Docker Hub - # uses: docker/build-push-action@v4.0.0 - # with: - # context: . - # file: ./space/Dockerfile.space - # platforms: linux/amd64 - # tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-space-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} - # push: true - # env: - # DOCKER_BUILDKIT: 1 - # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} - - # branch_build_push_backend: - # runs-on: ubuntu-20.04 - # needs: [ branch_build_and_push ] - # steps: - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v2.5.0 - - # - name: Login to Docker Hub - # uses: docker/login-action@v2.1.0 - # with: - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_TOKEN }} - # - name: Downloading Backend Source Code - # uses: actions/download-artifact@v3 - # with: - # name: backend-src-code - - # - name: Build and Push Backend to Docker Hub - # uses: docker/build-push-action@v4.0.0 - # with: - # context: . - # file: ./Dockerfile.api - # platforms: linux/amd64 - # push: true - # tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-backend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} - # env: - # DOCKER_BUILDKIT: 1 - # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + branch_build_push_frontend: + runs-on: ubuntu-20.04 + needs: [ branch_build_and_push ] + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.5.0 + + - name: Login to Docker Hub + uses: docker/login-action@v2.1.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Downloading Web Source Code + uses: actions/download-artifact@v3 + with: + name: web-src-code + + - name: Build and Push Frontend to Docker Container Registry + uses: docker/build-push-action@v4.0.0 + with: + context: . + file: ./web/Dockerfile.web + platforms: linux/amd64 + tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + push: true + env: + DOCKER_BUILDKIT: 1 + DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + + branch_build_push_space: + runs-on: ubuntu-20.04 + needs: [ branch_build_and_push ] + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.5.0 + + - name: Login to Docker Hub + uses: docker/login-action@v2.1.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Downloading Space Source Code + uses: actions/download-artifact@v3 + with: + name: space-src-code + + - name: Build and Push Space to Docker Hub + uses: docker/build-push-action@v4.0.0 + with: + context: . + file: ./space/Dockerfile.space + platforms: linux/amd64 + tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-space-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + push: true + env: + DOCKER_BUILDKIT: 1 + DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + + branch_build_push_backend: + runs-on: ubuntu-20.04 + needs: [ branch_build_and_push ] + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.5.0 + + - name: Login to Docker Hub + uses: docker/login-action@v2.1.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Downloading Backend Source Code + uses: actions/download-artifact@v3 + with: + name: backend-src-code + + - name: Build and Push Backend to Docker Hub + uses: docker/build-push-action@v4.0.0 + with: + context: . + file: ./Dockerfile.api + platforms: linux/amd64 + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-backend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + env: + DOCKER_BUILDKIT: 1 + DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} branch_build_push_proxy: runs-on: ubuntu-20.04