From 7dcefbd0c48e5fa76b849db4ab79200e1ea24e58 Mon Sep 17 00:00:00 2001 From: Manish Gupta <59428681+mguptahub@users.noreply.github.com> Date: Thu, 19 Sep 2024 18:06:02 +0530 Subject: [PATCH] Create Build-Release action (#1160) * Create Build-Release action * added common action * updated branch-build-ee * fixed branch-build-ee * fix action * fix * fix build * action yaml fix * fixes to monitor dockerfile for warnings * updated releaser-ee * added harbor push check in action * fix: removing preview branch from ee workflow --------- Co-authored-by: sriram veeraghanta --- .github/actions/build-push-action/action.yml | 168 +++++ .github/workflows/build-branch-ee.yml | 614 ++++++------------- .github/workflows/build-releaser-ee.yml | 390 ++++++++++++ monitor/Dockerfile | 8 +- nginx/Dockerfile | 2 +- 5 files changed, 739 insertions(+), 443 deletions(-) create mode 100644 .github/actions/build-push-action/action.yml create mode 100644 .github/workflows/build-releaser-ee.yml diff --git a/.github/actions/build-push-action/action.yml b/.github/actions/build-push-action/action.yml new file mode 100644 index 0000000000..24dfc322fe --- /dev/null +++ b/.github/actions/build-push-action/action.yml @@ -0,0 +1,168 @@ +name: "Build and Push Docker Image" +description: "Reusable action for building and pushing Docker images" +inputs: + docker-username: + description: "The Dockerhub username" + required: true + docker-token: + description: "The Dockerhub Token" + required: true + + # Harbor Options + harbor-push: + description: "Flag to push to Harbor" + required: false + default: "false" + harbor-username: + description: "The Harbor username" + required: false + harbor-token: + description: "The Harbor token" + required: false + harbor-registry: + description: "The Harbor registry" + required: false + default: "registry.plane.tools" + harbor-project: + description: "The Harbor project" + required: false + + # Docker Image Options + docker-image-owner: + description: "The owner of the Docker image" + required: true + docker-image-name: + description: "The name of the Docker image" + required: true + build-context: + description: "The build context" + required: true + default: "." + dockerfile-path: + description: "The path to the Dockerfile" + required: true + build-args: + description: "The build arguments" + required: false + default: "" + + # Buildx Options + buildx-driver: + description: "Buildx driver" + required: true + default: "docker-container" + buildx-version: + description: "Buildx version" + required: true + default: "latest" + buildx-platforms: + description: "Buildx platforms" + required: true + default: "linux/amd64" + buildx-endpoint: + description: "Buildx endpoint" + required: true + default: "default" + + # Release Build Options + build-release: + description: "Flag to publish release" + required: false + default: "false" + build-prerelease: + description: "Flag to publish prerelease" + required: false + default: "false" + release-version: + description: "The release version" + required: false + default: "latest" + +runs: + using: "composite" + steps: + - name: Set Docker Tag + shell: bash + env: + IMG_OWNER: ${{ inputs.docker-image-owner }} + IMG_NAME: ${{ inputs.docker-image-name }} + HARBOR_PUSH: ${{ inputs.harbor-push }} + HARBOR_REGISTRY: ${{ inputs.harbor-registry }} + HARBOR_PROJECT: ${{ inputs.harbor-project }} + BUILD_RELEASE: ${{ inputs.build-release }} + IS_PRERELEASE: ${{ inputs.build-prerelease }} + REL_VERSION: ${{ inputs.release-version }} + run: | + FLAT_BRANCH_VERSION=$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9.-]//g') + + semver_regex="^v([0-9]+)\.([0-9]+)\.([0-9]+)(-[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)?$" + if [[ ! ${{ env.REL_VERSION }} =~ $semver_regex ]]; then + echo "Invalid Release Version Format : ${{ env.REL_VERSION }}" + echo "Please provide a valid SemVer version" + echo "e.g. v1.2.3 or v1.2.3-alpha-1" + echo "Exiting the build process" + exit 1 # Exit with status 1 to fail the step + fi + + if [ "${{ env.BUILD_RELEASE }}" == "true" ]; then + TAG=${{ env.IMG_OWNER }}/${{ env.IMG_NAME }}:${{ env.REL_VERSION }} + + if [ "${{ env.HARBOR_PUSH }}" == "true" ]; then + TAG=${TAG},${{ env.HARBOR_REGISTRY }}/${{ env.HARBOR_PROJECT }}/${{ env.IMG_NAME }}:${{ env.REL_VERSION }} + fi + + if [ "${{ env.IS_PRERELEASE }}" != "true" ]; then + TAG=${TAG},${{ env.IMG_OWNER }}/${{ env.IMG_NAME }}:stable + if [ "${{ env.HARBOR_PUSH }}" == "true" ]; then + TAG=${TAG},${{ env.HARBOR_REGISTRY }}/${{ env.HARBOR_PROJECT }}/${{ env.IMG_NAME }}:stable + fi + fi + elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then + TAG=${{ env.IMG_OWNER }}/${{ env.IMG_NAME }}:latest + if [ "${{ env.HARBOR_PUSH }}" == "true" ]; then + TAG=${TAG},${{ env.HARBOR_REGISTRY }}/${{ env.HARBOR_PROJECT }}/${{ env.IMG_NAME }}:latest + fi + else + TAG=${{ env.IMG_OWNER }}/${{ env.IMG_NAME }}:${FLAT_BRANCH_VERSION} + if [ "${{ env.HARBOR_PUSH }}" == "true" ]; then + TAG=${TAG},${{ env.HARBOR_REGISTRY }}/${{ env.HARBOR_PROJECT }}/${{ env.IMG_NAME }}:${FLAT_BRANCH_VERSION} + fi + fi + + echo "DOCKER_TAGS=${TAG}" >> $GITHUB_ENV + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ inputs.docker-username }} + password: ${{ inputs.dockerhub-token}} + - name: Login to Harbor + if: ${{ inputs.harbor-push }} == "true" + uses: docker/login-action@v3 + with: + username: ${{ inputs.harbor-username }} + password: ${{ inputs.harbor-token }} + registry: ${{ inputs.harbor-registry }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: ${{ inputs.buildx-driver }} + version: ${{ inputs.buildx-version }} + endpoint: ${{ inputs.buildx-endpoint }} + + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Build and Push Docker Image + uses: docker/build-push-action@v5.1.0 + with: + context: ${{ inputs.build-context }} + file: ${{ inputs.dockerfile-path }} + platforms: ${{ inputs.buildx-platforms }} + tags: ${{ env.DOCKER_TAGS }} + push: true + build-args: ${{ inputs.build-args }} + env: + DOCKER_BUILDKIT: 1 + DOCKER_USERNAME: ${{ inputs.docker-username }} + DOCKER_PASSWORD: ${{ inputs.dockerhub-token }} diff --git a/.github/workflows/build-branch-ee.yml b/.github/workflows/build-branch-ee.yml index 87637e2255..541f27d81e 100644 --- a/.github/workflows/build-branch-ee.yml +++ b/.github/workflows/build-branch-ee.yml @@ -11,19 +11,15 @@ on: push: branches: - master - - preview - release: - types: [released, prereleased] env: - TARGET_BRANCH: ${{ github.ref_name || github.event.release.target_commitish }} + TARGET_BRANCH: ${{ github.ref_name }} ARM64_BUILD: ${{ github.event.inputs.arm64 }} - IS_PRERELEASE: ${{ github.event.release.prerelease }} jobs: branch_build_setup: name: Build Setup - runs-on: ${{vars.ACTION_RUNS_ON}} + runs-on: ubuntu-20.04 outputs: gh_branch_name: ${{ steps.set_env_variables.outputs.TARGET_BRANCH }} gh_buildx_driver: ${{ steps.set_env_variables.outputs.BUILDX_DRIVER }} @@ -40,6 +36,16 @@ jobs: artifact_upload_to_s3: ${{ steps.set_env_variables.outputs.artifact_upload_to_s3 }} artifact_s3_suffix: ${{ steps.set_env_variables.outputs.artifact_s3_suffix }} + dh_img_web: ${{ steps.set_env_variables.outputs.DH_IMG_WEB }} + dh_img_space: ${{ steps.set_env_variables.outputs.DH_IMG_SPACE }} + dh_img_admin: ${{ steps.set_env_variables.outputs.DH_IMG_ADMIN }} + dh_img_live: ${{ steps.set_env_variables.outputs.DH_IMG_LIVE }} + dh_img_backend: ${{ steps.set_env_variables.outputs.DH_IMG_BACKEND }} + dh_img_proxy: ${{ steps.set_env_variables.outputs.DH_IMG_PROXY }} + dh_img_monitor: ${{ steps.set_env_variables.outputs.DH_IMG_MONITOR }} + harbor_push: ${{ steps.set_env_variables.outputs.HARBOR_PUSH }} + release_version: ${{ steps.set_env_variables.outputs.FLAT_RELEASE_VERSION }} + steps: - id: set_env_variables name: Set Environment Variables @@ -55,13 +61,10 @@ jobs: echo "BUILDX_PLATFORMS=linux/amd64" >> $GITHUB_OUTPUT echo "BUILDX_ENDPOINT=" >> $GITHUB_OUTPUT fi - BR_NAME=$( echo "${{ env.TARGET_BRANCH }}" | tr / -) + BR_NAME=$( echo "${{ env.TARGET_BRANCH }}" |sed 's/[^a-zA-Z0-9.-]//g') echo "TARGET_BRANCH=$BR_NAME" >> $GITHUB_OUTPUT - if [ "${{ github.event_name }}" == "release" ]; then - echo "artifact_upload_to_s3=true" >> $GITHUB_OUTPUT - echo "artifact_s3_suffix=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT - elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then + if [ "${{ env.TARGET_BRANCH }}" == "master" ]; then echo "artifact_upload_to_s3=true" >> $GITHUB_OUTPUT echo "artifact_s3_suffix=latest" >> $GITHUB_OUTPUT elif [ "${{ env.TARGET_BRANCH }}" == "preview" ] || [ "${{ env.TARGET_BRANCH }}" == "develop" ]; then @@ -72,6 +75,15 @@ jobs: echo "artifact_s3_suffix=$BR_NAME" >> $GITHUB_OUTPUT fi + echo "DH_IMG_WEB=web-enterprise" >> $GITHUB_OUTPUT + echo "DH_IMG_SPACE=space-enterprise" >> $GITHUB_OUTPUT + echo "DH_IMG_ADMIN=admin-enterprise" >> $GITHUB_OUTPUT + echo "DH_IMG_LIVE=live-enterprise" >> $GITHUB_OUTPUT + echo "DH_IMG_BACKEND=backend-enterprise" >> $GITHUB_OUTPUT + echo "DH_IMG_PROXY=proxy-enterprise" >> $GITHUB_OUTPUT + echo "DH_IMG_MONITOR=monitor-enterprise" >> $GITHUB_OUTPUT + echo "HARBOR_PUSH=true" >> $GITHUB_OUTPUT + - id: checkout_files name: Checkout Files uses: actions/checkout@v4 @@ -117,494 +129,221 @@ jobs: - monitor/** branch_build_push_admin: - if: ${{ needs.branch_build_setup.outputs.build_admin== 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'release' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} + if: ${{ needs.branch_build_setup.outputs.build_admin == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} name: Build-Push Admin Docker Image - runs-on: ${{vars.ACTION_RUNS_ON}} + runs-on: ubuntu-20.04 needs: [branch_build_setup] - env: - ADMIN_TAG: makeplane/admin-enterprise:${{ needs.branch_build_setup.outputs.gh_branch_name }} - TARGET_BRANCH: ${{ needs.branch_build_setup.outputs.gh_branch_name }} - BUILDX_DRIVER: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} - BUILDX_VERSION: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} - BUILDX_PLATFORMS: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} - BUILDX_ENDPOINT: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} steps: - - name: Set Admin Docker Tag - run: | - if [ "${{ github.event_name }}" == "release" ]; then - TAG=makeplane/admin-enterprise:${{ github.event.release.tag_name }} - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/admin-enterprise:${{ github.event.release.tag_name }} - if [ "${{ env.IS_PRERELEASE }}" != "true" ]; then - TAG=${TAG},makeplane/admin-enterprise:stable - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/admin-enterprise:stable - fi - elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then - TAG=makeplane/admin-enterprise:latest - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/admin-enterprise:latest - else - TAG=${{ env.ADMIN_TAG }} - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/admin-enterprise:${{ needs.branch_build_setup.outputs.gh_branch_name }} - fi - echo "ADMIN_TAG=${TAG}" >> $GITHUB_ENV - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Login to Harbor - uses: docker/login-action@v3 - with: - username: ${{ secrets.HARBOR_USERNAME }} - password: ${{ secrets.HARBOR_TOKEN }} - registry: ${{ vars.HARBOR_REGISTRY }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver: ${{ env.BUILDX_DRIVER }} - version: ${{ env.BUILDX_VERSION }} - endpoint: ${{ env.BUILDX_ENDPOINT }} - - - name: Check out the repo + - id: checkout_files + name: Checkout Files uses: actions/checkout@v4 - - - name: Build and Push Frontend to Docker Container Registry - uses: docker/build-push-action@v5.1.0 + - name: Admin Build and Push + uses: ./.github/actions/build-push-action with: - context: . - file: ./admin/Dockerfile.admin - platforms: ${{ env.BUILDX_PLATFORMS }} - tags: ${{ env.ADMIN_TAG }} - push: true - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + harbor-push: ${{ needs.branch_build_setup.outputs.harbor_push }} + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-token: ${{ secrets.HARBOR_TOKEN }} + harbor-registry: ${{ vars.HARBOR_REGISTRY }} + harbor-project: ${{ vars.HARBOR_PROJECT }} + docker-image-owner: makeplane + docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_admin }} + build-context: . + dockerfile-path: ./admin/Dockerfile.admin + buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} branch_build_push_web: - if: ${{ needs.branch_build_setup.outputs.build_web == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'release' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} + if: ${{ needs.branch_build_setup.outputs.build_web == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} name: Build-Push Web Docker Image - runs-on: ${{vars.ACTION_RUNS_ON}} + runs-on: ubuntu-20.04 needs: [branch_build_setup] - env: - WEB_TAG: makeplane/web-enterprise:${{ needs.branch_build_setup.outputs.gh_branch_name }} - TARGET_BRANCH: ${{ needs.branch_build_setup.outputs.gh_branch_name }} - BUILDX_DRIVER: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} - BUILDX_VERSION: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} - BUILDX_PLATFORMS: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} - BUILDX_ENDPOINT: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} steps: - - name: Set Web Docker Tag - run: | - if [ "${{ github.event_name }}" == "release" ]; then - TAG=makeplane/web-enterprise:${{ github.event.release.tag_name }} - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/web-enterprise:${{ github.event.release.tag_name }} - if [ "${{ env.IS_PRERELEASE }}" != "true" ]; then - TAG=${TAG},makeplane/web-enterprise:stable - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/web-enterprise:stable - fi - elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then - TAG=makeplane/web-enterprise:latest - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/web-enterprise:latest - else - TAG=${{ env.WEB_TAG }} - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/web-enterprise:${{ needs.branch_build_setup.outputs.gh_branch_name }} - fi - echo "WEB_TAG=${TAG}" >> $GITHUB_ENV - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Login to Harbor - uses: docker/login-action@v3 - with: - username: ${{ secrets.HARBOR_USERNAME }} - password: ${{ secrets.HARBOR_TOKEN }} - registry: ${{ vars.HARBOR_REGISTRY }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver: ${{ env.BUILDX_DRIVER }} - version: ${{ env.BUILDX_VERSION }} - endpoint: ${{ env.BUILDX_ENDPOINT }} - - - name: Check out the repo + - id: checkout_files + name: Checkout Files uses: actions/checkout@v4 - - - name: Build and Push Web to Docker Container Registry - uses: docker/build-push-action@v5.1.0 + - name: Web Build and Push + uses: ./.github/actions/build-push-action with: - context: . - file: ./web/Dockerfile.web - platforms: ${{ env.BUILDX_PLATFORMS }} - tags: ${{ env.WEB_TAG }} - push: true - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + harbor-push: ${{ needs.branch_build_setup.outputs.harbor_push }} + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-token: ${{ secrets.HARBOR_TOKEN }} + harbor-registry: ${{ vars.HARBOR_REGISTRY }} + harbor-project: ${{ vars.HARBOR_PROJECT }} + docker-image-owner: makeplane + docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_web }} + build-context: . + dockerfile-path: ./web/Dockerfile.web + buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} branch_build_push_space: - if: ${{ needs.branch_build_setup.outputs.build_space == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'release' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} + if: ${{ needs.branch_build_setup.outputs.build_space == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} name: Build-Push Space Docker Image - runs-on: ${{vars.ACTION_RUNS_ON}} + runs-on: ubuntu-20.04 needs: [branch_build_setup] - env: - SPACE_TAG: makeplane/space-enterprise:${{ needs.branch_build_setup.outputs.gh_branch_name }} - TARGET_BRANCH: ${{ needs.branch_build_setup.outputs.gh_branch_name }} - BUILDX_DRIVER: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} - BUILDX_VERSION: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} - BUILDX_PLATFORMS: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} - BUILDX_ENDPOINT: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} steps: - - name: Set Space Docker Tag - run: | - if [ "${{ github.event_name }}" == "release" ]; then - TAG=makeplane/space-enterprise:${{ github.event.release.tag_name }} - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/space-enterprise:${{ github.event.release.tag_name }} - if [ "${{ env.IS_PRERELEASE }}" != "true" ]; then - TAG=${TAG},makeplane/space-enterprise:stable - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/space-enterprise:stable - fi - elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then - TAG=makeplane/space-enterprise:latest - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/space-enterprise:latest - else - TAG=${{ env.SPACE_TAG }} - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/space-enterprise:${{ needs.branch_build_setup.outputs.gh_branch_name }} - fi - echo "SPACE_TAG=${TAG}" >> $GITHUB_ENV - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Login to Harbor - uses: docker/login-action@v3 - with: - username: ${{ secrets.HARBOR_USERNAME }} - password: ${{ secrets.HARBOR_TOKEN }} - registry: ${{ vars.HARBOR_REGISTRY }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver: ${{ env.BUILDX_DRIVER }} - version: ${{ env.BUILDX_VERSION }} - endpoint: ${{ env.BUILDX_ENDPOINT }} - - - name: Check out the repo + - id: checkout_files + name: Checkout Files uses: actions/checkout@v4 - - - name: Build and Push Space to Docker Hub - uses: docker/build-push-action@v5.1.0 + - name: Space Build and Push + uses: ./.github/actions/build-push-action with: - context: . - file: ./space/Dockerfile.space - platforms: ${{ env.BUILDX_PLATFORMS }} - tags: ${{ env.SPACE_TAG }} - push: true - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + harbor-push: ${{ needs.branch_build_setup.outputs.harbor_push }} + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-token: ${{ secrets.HARBOR_TOKEN }} + harbor-registry: ${{ vars.HARBOR_REGISTRY }} + harbor-project: ${{ vars.HARBOR_PROJECT }} + docker-image-owner: makeplane + docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_space }} + build-context: . + dockerfile-path: ./space/Dockerfile.space + buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} branch_build_push_live: - if: ${{ needs.branch_build_setup.outputs.build_live == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'release' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} + if: ${{ needs.branch_build_setup.outputs.build_live == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} name: Build-Push Live Collaboration Docker Image runs-on: ubuntu-20.04 needs: [branch_build_setup] - env: - LIVE_TAG: makeplane/live-enterprise:${{ needs.branch_build_setup.outputs.gh_branch_name }} - TARGET_BRANCH: ${{ needs.branch_build_setup.outputs.gh_branch_name }} - BUILDX_DRIVER: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} - BUILDX_VERSION: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} - BUILDX_PLATFORMS: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} - BUILDX_ENDPOINT: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} steps: - - name: Set Live Docker Tag - run: | - if [ "${{ github.event_name }}" == "release" ]; then - TAG=makeplane/live-enterprise:${{ github.event.release.tag_name }} - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/live-enterprise:${{ github.event.release.tag_name }} - if [ "${{ env.IS_PRERELEASE }}" != "true" ]; then - TAG=${TAG},makeplane/live-enterprise:stable - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/live-enterprise:stable - fi - elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then - TAG=makeplane/live-enterprise:latest - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/live-enterprise:latest - else - TAG=${{ env.LIVE_TAG }} - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/live-enterprise:${{ needs.branch_build_setup.outputs.gh_branch_name }} - fi - echo "LIVE_TAG=${TAG}" >> $GITHUB_ENV - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Login to Harbor - uses: docker/login-action@v3 - with: - username: ${{ secrets.HARBOR_USERNAME }} - password: ${{ secrets.HARBOR_TOKEN }} - registry: ${{ vars.HARBOR_REGISTRY }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver: ${{ env.BUILDX_DRIVER }} - version: ${{ env.BUILDX_VERSION }} - endpoint: ${{ env.BUILDX_ENDPOINT }} - - - name: Check out the repo + - id: checkout_files + name: Checkout Files uses: actions/checkout@v4 - - - name: Build and Push Live Server to Docker Hub - uses: docker/build-push-action@v5.1.0 + - name: Live Build and Push + uses: ./.github/actions/build-push-action with: - context: . - file: ./live/Dockerfile.live - platforms: ${{ env.BUILDX_PLATFORMS }} - tags: ${{ env.LIVE_TAG }} - push: true - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + harbor-push: ${{ needs.branch_build_setup.outputs.harbor_push }} + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-token: ${{ secrets.HARBOR_TOKEN }} + harbor-registry: ${{ vars.HARBOR_REGISTRY }} + harbor-project: ${{ vars.HARBOR_PROJECT }} + docker-image-owner: makeplane + docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_live }} + build-context: . + dockerfile-path: ./live/Dockerfile.live + buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} branch_build_push_apiserver: - if: ${{ needs.branch_build_setup.outputs.build_apiserver == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'release' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} + if: ${{ needs.branch_build_setup.outputs.build_apiserver == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} name: Build-Push API Server Docker Image - runs-on: ${{vars.ACTION_RUNS_ON}} + runs-on: ubuntu-20.04 needs: [branch_build_setup] - env: - BACKEND_TAG: makeplane/backend-enterprise:${{ needs.branch_build_setup.outputs.gh_branch_name }} - TARGET_BRANCH: ${{ needs.branch_build_setup.outputs.gh_branch_name }} - BUILDX_DRIVER: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} - BUILDX_VERSION: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} - BUILDX_PLATFORMS: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} - BUILDX_ENDPOINT: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} steps: - - name: Set Backend Docker Tag - run: | - if [ "${{ github.event_name }}" == "release" ]; then - TAG=makeplane/backend-enterprise:${{ github.event.release.tag_name }} - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/backend-enterprise:${{ github.event.release.tag_name }} - if [ "${{ env.IS_PRERELEASE }}" != "true" ]; then - TAG=${TAG},makeplane/backend-enterprise:stable - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/backend-enterprise:stable - fi - elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then - TAG=makeplane/backend-enterprise:latest - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/backend-enterprise:latest - else - TAG=${{ env.BACKEND_TAG }} - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/backend-enterprise:${{ needs.branch_build_setup.outputs.gh_branch_name }} - fi - echo "BACKEND_TAG=${TAG}" >> $GITHUB_ENV - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Login to Harbor - uses: docker/login-action@v3 - with: - username: ${{ secrets.HARBOR_USERNAME }} - password: ${{ secrets.HARBOR_TOKEN }} - registry: ${{ vars.HARBOR_REGISTRY }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver: ${{ env.BUILDX_DRIVER }} - version: ${{ env.BUILDX_VERSION }} - endpoint: ${{ env.BUILDX_ENDPOINT }} - - - name: Check out the repo + - id: checkout_files + name: Checkout Files uses: actions/checkout@v4 - - - name: Build and Push Backend to Docker Hub - uses: docker/build-push-action@v5.1.0 + - name: Backend Build and Push + uses: ./.github/actions/build-push-action with: - context: ./apiserver - file: ./apiserver/Dockerfile.api - platforms: ${{ env.BUILDX_PLATFORMS }} - push: true - tags: ${{ env.BACKEND_TAG }} - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + harbor-push: ${{ needs.branch_build_setup.outputs.harbor_push }} + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-token: ${{ secrets.HARBOR_TOKEN }} + harbor-registry: ${{ vars.HARBOR_REGISTRY }} + harbor-project: ${{ vars.HARBOR_PROJECT }} + docker-image-owner: makeplane + docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_backend }} + build-context: ./apiserver + dockerfile-path: ./apiserver/Dockerfile.api + buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} branch_build_push_proxy: - if: ${{ needs.branch_build_setup.outputs.build_proxy == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'release' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} + if: ${{ needs.branch_build_setup.outputs.build_proxy == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} name: Build-Push Proxy Docker Image - runs-on: ${{vars.ACTION_RUNS_ON}} + runs-on: ubuntu-20.04 needs: [branch_build_setup] - env: - PROXY_TAG: makeplane/proxy-enterprise:${{ needs.branch_build_setup.outputs.gh_branch_name }} - TARGET_BRANCH: ${{ needs.branch_build_setup.outputs.gh_branch_name }} - BUILDX_DRIVER: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} - BUILDX_VERSION: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} - BUILDX_PLATFORMS: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} - BUILDX_ENDPOINT: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} steps: - - name: Set Proxy Docker Tag - run: | - if [ "${{ github.event_name }}" == "release" ]; then - TAG=makeplane/proxy-enterprise:${{ github.event.release.tag_name }} - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/proxy-enterprise:${{ github.event.release.tag_name }} - if [ "${{ env.IS_PRERELEASE }}" != "true" ]; then - TAG=${TAG},makeplane/proxy-enterprise:stable - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/proxy-enterprise:stable - fi - elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then - TAG=makeplane/proxy-enterprise:latest - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/proxy-enterprise:latest - else - TAG=${{ env.PROXY_TAG }} - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/proxy-enterprise:${{ needs.branch_build_setup.outputs.gh_branch_name }} - fi - echo "PROXY_TAG=${TAG}" >> $GITHUB_ENV - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Login to Harbor - uses: docker/login-action@v3 - with: - username: ${{ secrets.HARBOR_USERNAME }} - password: ${{ secrets.HARBOR_TOKEN }} - registry: ${{ vars.HARBOR_REGISTRY }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver: ${{ env.BUILDX_DRIVER }} - version: ${{ env.BUILDX_VERSION }} - endpoint: ${{ env.BUILDX_ENDPOINT }} - - - name: Check out the repo + - id: checkout_files + name: Checkout Files uses: actions/checkout@v4 - - - name: Build and Push Plane-Proxy to Docker Hub - uses: docker/build-push-action@v5.1.0 + - name: Proxy Build and Push + uses: ./.github/actions/build-push-action with: - context: ./nginx - file: ./nginx/Dockerfile - platforms: ${{ env.BUILDX_PLATFORMS }} - tags: ${{ env.PROXY_TAG }} - push: true - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + harbor-push: ${{ needs.branch_build_setup.outputs.harbor_push }} + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-token: ${{ secrets.HARBOR_TOKEN }} + harbor-registry: ${{ vars.HARBOR_REGISTRY }} + harbor-project: ${{ vars.HARBOR_PROJECT }} + docker-image-owner: makeplane + docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_proxy }} + build-context: ./nginx + dockerfile-path: ./nginx/Dockerfile + buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} branch_build_push_monitor: - if: ${{ needs.branch_build_setup.outputs.build_monitor == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'release' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} + if: ${{ needs.branch_build_setup.outputs.build_monitor == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} name: Build-Push Monitor Docker Image - runs-on: ${{vars.ACTION_RUNS_ON}} + runs-on: ubuntu-20.04 needs: [branch_build_setup] - env: - MONITOR_TAG: makeplane/monitor-enterprise:${{ needs.branch_build_setup.outputs.gh_branch_name }} - TARGET_BRANCH: ${{ needs.branch_build_setup.outputs.gh_branch_name }} - BUILDX_DRIVER: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} - BUILDX_VERSION: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} - BUILDX_PLATFORMS: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} - BUILDX_ENDPOINT: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} steps: - - name: Set Monitor Docker Tag - run: | - if [ "${{ github.event_name }}" == "release" ]; then - TAG=makeplane/monitor-enterprise:${{ github.event.release.tag_name }} - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/monitor-enterprise:${{ github.event.release.tag_name }} - if [ "${{ env.IS_PRERELEASE }}" != "true" ]; then - TAG=${TAG},makeplane/monitor-enterprise:stable - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/monitor-enterprise:stable - fi - elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then - TAG=makeplane/monitor-enterprise:latest - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/monitor-enterprise:latest - else - TAG=${{ env.MONITOR_TAG }} - TAG=${TAG},${{ vars.HARBOR_REGISTRY }}/${{ vars.HARBOR_PROJECT }}/monitor-enterprise:${{ needs.branch_build_setup.outputs.gh_branch_name }} - fi - echo "MONITOR_TAG=${TAG}" >> $GITHUB_ENV - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Login to Harbor - uses: docker/login-action@v3 - with: - username: ${{ secrets.HARBOR_USERNAME }} - password: ${{ secrets.HARBOR_TOKEN }} - registry: ${{ vars.HARBOR_REGISTRY }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver: ${{ env.BUILDX_DRIVER }} - version: ${{ env.BUILDX_VERSION }} - endpoint: ${{ env.BUILDX_ENDPOINT }} - - - name: Check out the repo + - id: checkout_files + name: Checkout Files uses: actions/checkout@v4 - - name: Generate Keypair run: | - if [ "${{ github.event_name }}" == "release" ]; then - openssl genrsa -out monitor/private_key.pem 2048 + if [ "${{ env.TARGET_BRANCH }}" == "master" ]; then + openssl genrsa -out private_key.pem 2048 else - echo "${{ secrets.DEFAULT_PRIME_PRIVATE_KEY }}" > monitor/private_key.pem + echo "${{ secrets.DEFAULT_PRIME_PRIVATE_KEY }}" > private_key.pem fi - openssl rsa -in monitor/private_key.pem -pubout -out monitor/public_key.pem - cat monitor/public_key.pem + openssl rsa -in private_key.pem -pubout -out public_key.pem + cat public_key.pem # Generating the private key env for the generated keys - PRIVATE_KEY=$(cat monitor/private_key.pem | base64 -w 0) + PRIVATE_KEY=$(cat private_key.pem | base64 -w 0) echo "PRIVATE_KEY=${PRIVATE_KEY}" >> $GITHUB_ENV - - name: Build and Push Monitor to Docker Container Registry - uses: docker/build-push-action@v5.1.0 + - name: Monitor Build and Push + uses: ./.github/actions/build-push-action with: - context: ./monitor - file: ./monitor/Dockerfile - platforms: ${{ env.BUILDX_PLATFORMS }} - tags: ${{ env.MONITOR_TAG }} - push: true + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + harbor-push: ${{ needs.branch_build_setup.outputs.harbor_push }} + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-token: ${{ secrets.HARBOR_TOKEN }} + harbor-registry: ${{ vars.HARBOR_REGISTRY }} + harbor-project: ${{ vars.HARBOR_PROJECT }} + docker-image-owner: makeplane + docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_monitor }} + build-context: ./monitor + dockerfile-path: ./monitor/Dockerfile + buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} build-args: | PRIVATE_KEY=${{ env.PRIVATE_KEY }} - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} upload_artifacts_s3: if: ${{ needs.branch_build_setup.outputs.artifact_upload_to_s3 == 'true' }} name: Upload artifacts to S3 Bucket - runs-on: ${{vars.ACTION_RUNS_ON}} + runs-on: ubuntu-20.04 needs: [branch_build_setup] container: image: docker:20.10.7 @@ -615,7 +354,6 @@ jobs: ARTIFACT_SUFFIX: ${{ needs.branch_build_setup.outputs.artifact_s3_suffix }} AWS_ACCESS_KEY_ID: ${{ secrets.SELF_HOST_BUCKET_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.SELF_HOST_BUCKET_SECRET_KEY }} - TARGET_BRANCH: ${{ github.ref_name || github.event.release.target_commitish }} steps: - id: checkout_files name: Checkout Files diff --git a/.github/workflows/build-releaser-ee.yml b/.github/workflows/build-releaser-ee.yml new file mode 100644 index 0000000000..d3dfeabc6f --- /dev/null +++ b/.github/workflows/build-releaser-ee.yml @@ -0,0 +1,390 @@ +name: Branch Build Enterprise Releaser + +on: + workflow_dispatch: + inputs: + buildType: + description: 'Build Type' + type: choice + required: true + options: + - 'Cloud' + - 'Enterprise' + default: 'Cloud' + releaseVersion: + description: 'Release Version' + type: string + default: v1.x.x-cloud + required: true + isPrerelease: + description: 'Is Pre-release' + type: boolean + default: false + required: true + arm64: + description: "Build for ARM64 architecture" + required: false + default: false + type: boolean + +env: + TARGET_BRANCH: ${{ github.ref_name }} + IS_PRERELEASE: ${{ github.event.inputs.isPrerelease }} + BUILD_TYPE: ${{ github.event.inputs.buildType }} + RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }} + ARM64_BUILD: ${{ github.event.inputs.arm64 }} + +jobs: + branch_build_setup: + name: Build Setup + runs-on: ubuntu-20.04 + outputs: + gh_buildx_driver: ${{ steps.set_env_variables.outputs.BUILDX_DRIVER }} + gh_buildx_version: ${{ steps.set_env_variables.outputs.BUILDX_VERSION }} + gh_buildx_platforms: ${{ steps.set_env_variables.outputs.BUILDX_PLATFORMS }} + gh_buildx_endpoint: ${{ steps.set_env_variables.outputs.BUILDX_ENDPOINT }} + artifact_upload_to_s3: ${{ steps.set_env_variables.outputs.artifact_upload_to_s3 }} + artifact_s3_suffix: ${{ steps.set_env_variables.outputs.artifact_s3_suffix }} + + dh_img_web: ${{ steps.set_env_variables.outputs.DH_IMG_WEB }} + dh_img_space: ${{ steps.set_env_variables.outputs.DH_IMG_SPACE }} + dh_img_admin: ${{ steps.set_env_variables.outputs.DH_IMG_ADMIN }} + dh_img_live: ${{ steps.set_env_variables.outputs.DH_IMG_LIVE }} + dh_img_backend: ${{ steps.set_env_variables.outputs.DH_IMG_BACKEND }} + dh_img_proxy: ${{ steps.set_env_variables.outputs.DH_IMG_PROXY }} + dh_img_monitor: ${{ steps.set_env_variables.outputs.DH_IMG_MONITOR }} + harbor_push: ${{ steps.set_env_variables.outputs.HARBOR_PUSH }} + release_version: ${{ steps.set_env_variables.outputs.FLAT_RELEASE_VERSION }} + + steps: + - id: set_env_variables + name: Set Environment Variables + run: | + if [ "${{ env.ARM64_BUILD }}" == "true" ] || [ "${{ env.IS_PRERELEASE }}" != "true" ]; then + echo "BUILDX_DRIVER=cloud" >> $GITHUB_OUTPUT + echo "BUILDX_VERSION=lab:latest" >> $GITHUB_OUTPUT + echo "BUILDX_PLATFORMS=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT + echo "BUILDX_ENDPOINT=makeplane/plane-dev" >> $GITHUB_OUTPUT + else + echo "BUILDX_DRIVER=docker-container" >> $GITHUB_OUTPUT + echo "BUILDX_VERSION=latest" >> $GITHUB_OUTPUT + echo "BUILDX_PLATFORMS=linux/amd64" >> $GITHUB_OUTPUT + echo "BUILDX_ENDPOINT=" >> $GITHUB_OUTPUT + fi + + FLAT_RELEASE_VERSION=$(echo "${{ env.RELEASE_VERSION }}" | sed 's/[^a-zA-Z0-9.-]//g') + echo "FLAT_RELEASE_VERSION=${FLAT_RELEASE_VERSION}" >> $GITHUB_OUTPUT + echo "artifact_upload_to_s3=true" >> $GITHUB_OUTPUT + echo "artifact_s3_suffix=$FLAT_RELEASE_VERSION" >> $GITHUB_OUTPUT + + semver_regex="^v([0-9]+)\.([0-9]+)\.([0-9]+)(-[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)?$" + if [[ ! $FLAT_RELEASE_VERSION =~ $semver_regex ]]; then + echo "Invalid Release Version Format : $FLAT_RELEASE_VERSION" + echo "Please provide a valid SemVer version" + echo "e.g. v1.2.3 or v1.2.3-alpha-1" + echo "Exiting the build process" + exit 1 # Exit with status 1 to fail the step + fi + + if [ "${{ env.BUILD_TYPE }}" == "Cloud" ]; then + echo "DH_IMG_WEB=web-cloud" >> $GITHUB_OUTPUT + echo "DH_IMG_SPACE=space-cloud" >> $GITHUB_OUTPUT + echo "DH_IMG_ADMIN=admin-cloud" >> $GITHUB_OUTPUT + echo "DH_IMG_LIVE=live-cloud" >> $GITHUB_OUTPUT + echo "DH_IMG_BACKEND=backend-cloud" >> $GITHUB_OUTPUT + echo "DH_IMG_PROXY=proxy-cloud" >> $GITHUB_OUTPUT + echo "DH_IMG_MONITOR=monitor-cloud" >> $GITHUB_OUTPUT + echo "HARBOR_PUSH=false" >> $GITHUB_OUTPUT + else + echo "DH_IMG_WEB=web-enterprise" >> $GITHUB_OUTPUT + echo "DH_IMG_SPACE=space-enterprise" >> $GITHUB_OUTPUT + echo "DH_IMG_ADMIN=admin-enterprise" >> $GITHUB_OUTPUT + echo "DH_IMG_LIVE=live-enterprise" >> $GITHUB_OUTPUT + echo "DH_IMG_BACKEND=backend-enterprise" >> $GITHUB_OUTPUT + echo "DH_IMG_PROXY=proxy-enterprise" >> $GITHUB_OUTPUT + echo "DH_IMG_MONITOR=monitor-enterprise" >> $GITHUB_OUTPUT + echo "HARBOR_PUSH=true" >> $GITHUB_OUTPUT + fi + + branch_build_push_admin: + name: Build-Push Admin Docker Image + runs-on: ubuntu-20.04 + needs: [branch_build_setup] + steps: + - id: checkout_files + name: Checkout Files + uses: actions/checkout@v4 + - name: Admin Build and Push + uses: ./.github/actions/build-push-action + with: + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + harbor-push: ${{ needs.branch_build_setup.outputs.harbor_push }} + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-token: ${{ secrets.HARBOR_TOKEN }} + harbor-registry: ${{ vars.HARBOR_REGISTRY }} + harbor-project: ${{ vars.HARBOR_PROJECT }} + docker-image-owner: makeplane + docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_admin }} + build-context: . + dockerfile-path: ./admin/Dockerfile.admin + buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} + build-release: true + build-prerelease: ${{ env.IS_PRERELEASE }} + release-version: ${{ needs.branch_build_setup.outputs.release_version }} + + branch_build_push_web: + name: Build-Push Web Docker Image + runs-on: ubuntu-20.04 + needs: [branch_build_setup] + steps: + - id: checkout_files + name: Checkout Files + uses: actions/checkout@v4 + - name: Web Build and Push + uses: ./.github/actions/build-push-action + with: + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + harbor-push: ${{ needs.branch_build_setup.outputs.harbor_push }} + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-token: ${{ secrets.HARBOR_TOKEN }} + harbor-registry: ${{ vars.HARBOR_REGISTRY }} + harbor-project: ${{ vars.HARBOR_PROJECT }} + docker-image-owner: makeplane + docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_web }} + build-context: . + dockerfile-path: ./web/Dockerfile.web + buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} + build-release: true + build-prerelease: ${{ env.IS_PRERELEASE }} + release-version: ${{ needs.branch_build_setup.outputs.release_version }} + + branch_build_push_space: + name: Build-Push Space Docker Image + runs-on: ubuntu-20.04 + needs: [branch_build_setup] + steps: + - id: checkout_files + name: Checkout Files + uses: actions/checkout@v4 + - name: Space Build and Push + uses: ./.github/actions/build-push-action + with: + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + harbor-push: ${{ needs.branch_build_setup.outputs.harbor_push }} + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-token: ${{ secrets.HARBOR_TOKEN }} + harbor-registry: ${{ vars.HARBOR_REGISTRY }} + harbor-project: ${{ vars.HARBOR_PROJECT }} + docker-image-owner: makeplane + docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_space }} + build-context: . + dockerfile-path: ./space/Dockerfile.space + buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} + build-release: true + build-prerelease: ${{ env.IS_PRERELEASE }} + release-version: ${{ needs.branch_build_setup.outputs.release_version }} + + branch_build_push_live: + name: Build-Push Live Collaboration Docker Image + runs-on: ubuntu-20.04 + needs: [branch_build_setup] + steps: + - id: checkout_files + name: Checkout Files + uses: actions/checkout@v4 + - name: Live Build and Push + uses: ./.github/actions/build-push-action + with: + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + harbor-push: ${{ needs.branch_build_setup.outputs.harbor_push }} + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-token: ${{ secrets.HARBOR_TOKEN }} + harbor-registry: ${{ vars.HARBOR_REGISTRY }} + harbor-project: ${{ vars.HARBOR_PROJECT }} + docker-image-owner: makeplane + docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_live }} + build-context: . + dockerfile-path: ./live/Dockerfile.live + buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} + build-release: true + build-prerelease: ${{ env.IS_PRERELEASE }} + release-version: ${{ needs.branch_build_setup.outputs.release_version }} + + branch_build_push_apiserver: + name: Build-Push API Server Docker Image + runs-on: ubuntu-20.04 + needs: [branch_build_setup] + steps: + - id: checkout_files + name: Checkout Files + uses: actions/checkout@v4 + - name: Backend Build and Push + uses: ./.github/actions/build-push-action + with: + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + harbor-push: ${{ needs.branch_build_setup.outputs.harbor_push }} + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-token: ${{ secrets.HARBOR_TOKEN }} + harbor-registry: ${{ vars.HARBOR_REGISTRY }} + harbor-project: ${{ vars.HARBOR_PROJECT }} + docker-image-owner: makeplane + docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_backend }} + build-context: ./apiserver + dockerfile-path: ./apiserver/Dockerfile.backend + buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} + build-release: true + build-prerelease: ${{ env.IS_PRERELEASE }} + release-version: ${{ needs.branch_build_setup.outputs.release_version }} + + branch_build_push_proxy: + name: Build-Push Proxy Docker Image + runs-on: ubuntu-20.04 + needs: [branch_build_setup] + steps: + - id: checkout_files + name: Checkout Files + uses: actions/checkout@v4 + - name: Proxy Build and Push + uses: ./.github/actions/build-push-action + with: + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + harbor-push: ${{ needs.branch_build_setup.outputs.harbor_push }} + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-token: ${{ secrets.HARBOR_TOKEN }} + harbor-registry: ${{ vars.HARBOR_REGISTRY }} + harbor-project: ${{ vars.HARBOR_PROJECT }} + docker-image-owner: makeplane + docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_proxy }} + build-context: ./nginx + dockerfile-path: ./nginx/Dockerfile + buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} + build-release: true + build-prerelease: ${{ env.IS_PRERELEASE }} + release-version: ${{ needs.branch_build_setup.outputs.release_version }} + + branch_build_push_monitor: + name: Build-Push Monitor Docker Image + runs-on: ubuntu-20.04 + needs: [branch_build_setup] + steps: + - id: checkout_files + name: Checkout Files + uses: actions/checkout@v4 + - name: Generate Keypair + run: | + openssl genrsa -out private_key.pem 2048 + openssl rsa -in private_key.pem -pubout -out public_key.pem + cat public_key.pem + + # Generating the private key env for the generated keys + PRIVATE_KEY=$(cat private_key.pem | base64 -w 0) + echo "PRIVATE_KEY=${PRIVATE_KEY}" >> $GITHUB_ENV + + - name: Monitor Build and Push + uses: ./.github/actions/build-push-action + with: + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + harbor-push: ${{ needs.branch_build_setup.outputs.harbor_push }} + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-token: ${{ secrets.HARBOR_TOKEN }} + harbor-registry: ${{ vars.HARBOR_REGISTRY }} + harbor-project: ${{ vars.HARBOR_PROJECT }} + docker-image-owner: makeplane + docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_monitor }} + build-context: ./monitor + dockerfile-path: ./monitor/Dockerfile + buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} + build-release: true + build-prerelease: ${{ env.IS_PRERELEASE }} + release-version: ${{ needs.branch_build_setup.outputs.release_version }} + build-args: | + PRIVATE_KEY=${{ env.PRIVATE_KEY }} + + upload_artifacts_s3: + if: ${{ needs.branch_build_setup.outputs.artifact_upload_to_s3 == 'true' }} + name: Upload artifacts to S3 Bucket + runs-on: ubuntu-20.04 + needs: [branch_build_setup] + container: + image: docker:20.10.7 + credentials: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + env: + ARTIFACT_SUFFIX: ${{ needs.branch_build_setup.outputs.artifact_s3_suffix }} + AWS_ACCESS_KEY_ID: ${{ secrets.SELF_HOST_BUCKET_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SELF_HOST_BUCKET_SECRET_KEY }} + steps: + - id: checkout_files + name: Checkout Files + uses: actions/checkout@v4 + + - name: Upload artifacts + run: | + apk update + apk add --no-cache aws-cli + + mkdir -p ~/${{ env.ARTIFACT_SUFFIX }} + + cp deploy/cli-install/variables.env ~/${{ env.ARTIFACT_SUFFIX }}/variables.env + cp deploy/cli-install/Caddyfile ~/${{ env.ARTIFACT_SUFFIX }}/Caddyfile + sed -e 's@${APP_RELEASE_VERSION}@'${{ env.ARTIFACT_SUFFIX }}'@' deploy/cli-install/docker-compose.yml > ~/${{ env.ARTIFACT_SUFFIX }}/docker-compose.yml + sed -e 's@${APP_RELEASE_VERSION}@'${{ env.ARTIFACT_SUFFIX }}'@' deploy/cli-install/docker-compose-caddy.yml > ~/${{ env.ARTIFACT_SUFFIX }}/docker-compose-caddy.yml + + aws s3 cp ~/${{ env.ARTIFACT_SUFFIX }} s3://${{ vars.SELF_HOST_BUCKET_NAME }}/plane-enterprise/${{ env.ARTIFACT_SUFFIX }} --recursive + + publish_release: + name: Build Release + runs-on: ubuntu-20.04 + needs: [branch_build_setup, branch_build_push_admin, branch_build_push_web, branch_build_push_space, branch_build_push_live, branch_build_push_apiserver, branch_build_push_proxy, branch_build_push_monitor, upload_artifacts_s3] + env: + REL_VERSION: ${{ needs.branch_build_setup.outputs.release_version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v2.0.8 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ env.REL_VERSION }} + name: ${{ env.REL_VERSION }} + draft: false + prerelease: ${{ env.IS_PRERELEASE }} + generate_release_notes: true + files: | + ${{ github.workspace }}/deploy/cli-install/variables.env + ${{ github.workspace }}/deploy/cli-install/Caddyfile + ${{ github.workspace }}/deploy/cli-install/docker-compose.yml + ${{ github.workspace }}/deploy/cli-install/docker-compose-caddy.yml + \ No newline at end of file diff --git a/monitor/Dockerfile b/monitor/Dockerfile index f8f20f5eb4..591e2fab0e 100644 --- a/monitor/Dockerfile +++ b/monitor/Dockerfile @@ -1,6 +1,6 @@ -FROM --platform=$BUILDPLATFORM tonistiigi/binfmt as binfmt +FROM --platform=$BUILDPLATFORM tonistiigi/binfmt AS binfmt -FROM goreleaser/goreleaser:v2.2.0 as Build +FROM goreleaser/goreleaser:v2.2.0 AS build WORKDIR /app RUN apk add build-base @@ -12,9 +12,9 @@ COPY . . RUN goreleaser build --snapshot --clean --single-target --output=./prime-monitor -FROM alpine:latest as Run +FROM alpine:latest AS run WORKDIR /app -COPY --from=Build /app/prime-monitor /usr/local/bin/prime-monitor +COPY --from=build /app/prime-monitor /usr/local/bin/prime-monitor CMD [ "prime-monitor", "start" ] diff --git a/nginx/Dockerfile b/nginx/Dockerfile index b1aef1a200..f3914d36cd 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -3,7 +3,7 @@ FROM nginx:1.25.0-alpine RUN rm /etc/nginx/conf.d/default.conf COPY nginx.conf.template /etc/nginx/nginx.conf.template -COPY ./env.sh /docker-entrypoint.sh +COPY env.sh /docker-entrypoint.sh RUN chmod +x /docker-entrypoint.sh # Update all environment variables