From a6dccdc2b0897530755d00661f185d2fd217241b Mon Sep 17 00:00:00 2001 From: fal7w <147312030+fal7w@users.noreply.github.com> Date: Sat, 16 Dec 2023 23:11:04 +0300 Subject: [PATCH] Update build_system_image.yml --- .github/workflows/build_system_image.yml | 40 +++++++----------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build_system_image.yml b/.github/workflows/build_system_image.yml index b3df762c..0d6a594e 100644 --- a/.github/workflows/build_system_image.yml +++ b/.github/workflows/build_system_image.yml @@ -15,38 +15,15 @@ jobs: - self-hosted # - ubuntu-latest steps: - # - name: Checkout Repository - # uses: actions/checkout@v2 - # - name: build image - # run: | - # rm -rf remittance_image_builder - # - name: build image - # run: | - # git clone --recursive https://${{ secrets._GITHUB_TOKEN }}@github.com/malnozili/remittance_image_builder.git - # cd remittance_image_builder - # ./build_network_company_image.sh --tag="remittance_network_agent/${{ github.event.pull_request.head.ref }}:latest" --token="${{ secrets.TOCKEN }}" --frappe-path="https://github.com/fintechsys/frappe.git" --frappe-branch=version-14 --fintech-branch=develop - # docker image ls - # docker tag remittance_network_agent/${{ vars.BRANCH_NAME }}:latest harbor.fintechsys.net/frappe-systems/${{ vars.BRANCH_NAME }}:latest - # docker push harbor.fintechsys.net/frappe-systems/remittance_network_agent/${{ vars.BRANCH_NAME }}:latest - #Creat Bench and sites - # sed -i 's/ERPNEXT_VERSION=/ERPNEXT_VERSION=${{ github.event.pull_request.head.ref }}/g' ~/gitops/${{ github.event.pull_request.head.ref }}.env - name: Create directory run: | mkdir ~/gitops - - - name: Generate Random Ports - run: | - # Generate random ports between 1024 and 65535 - port1=$((RANDOM%64311+1024)) - echo "Random Port 1: $port1" - name: Create first bench run: | - port1=$((RANDOM%64311+1024)) - echo "Random Port 1: $port1" cp example.env ~/gitops/${{ github.event.pull_request.head.ref }}.env sed -i 's/FRAPPE_SITE_NAME_HEADER=/FRAPPE_SITE_NAME_HEADER=${{ github.event.pull_request.head.ref }}/g' ~/gitops/${{ github.event.pull_request.head.ref }}.env - echo "PORTS=$port1" >> ~/gitops/${{ github.event.pull_request.head.ref }}.env sed -i 's/DB_PASSWORD=123/DB_PASSWORD=${{ vars.MARIADB_PASSWORD }}/g' ~/gitops/${{ github.event.pull_request.head.ref }}.env + echo "PORTS= $((8081 + RANDOM % 919))" >> ~/gitops/${{ github.event.pull_request.head.ref }}.env # sed -i 's/DBPASSWORD=/DP=DBPASSWORD=${{ vars.MARIADB_PASSWORD }}/g' ~/gitops/${{ github.event.pull_request.head.ref }}.env # sed -i 's/PORTS=/PORTS= $port1 /g' ~/gitops/${{ github.event.pull_request.head.ref }}.env # sed -i 's/DB_PASSWORD=123/DB_PASSWORD=${{ vars.MARIADB_PASSWORD }}/g' ~/gitops/${{ github.event.pull_request.head.ref }}.env @@ -60,14 +37,19 @@ jobs: run: | docker-compose --project-name ${{ github.event.pull_request.head.ref }} \ --env-file ~/gitops/${{ github.event.pull_request.head.ref }}.env \ - -f pwd.yml config > ~/gitops/${{ github.event.pull_request.head.ref }}.yaml + -f pwd.yml config > ~/gitops/${{ github.event.pull_request.head.ref }}.yaml - # - name: Deploy the container - # run: | - # docker-compose --project-name ${{ github.event.pull_request.head.ref }} -f ~/gitops/${{ github.event.pull_request.head.ref }}.yaml up -d + - name: Deploy the container + run: | + docker-compose --project-name ${{ github.event.pull_request.head.ref }} -f ~/gitops/${{ github.event.pull_request.head.ref }}.yaml up -d - + - name: Create the site + run: | + docker-compose --project-name ${{ github.event.pull_request.head.ref }} exec -T backend \ + bench new-site --no-mariadb-socket --admin-password=${{ vars.MARIADB_PASSWORD }} --db-root-password=${{ vars.MARIADB_PASSWORD }} --install-app erpnext --set-default ${{ github.event.pull_request.head.ref }} + + # - name: Create the site # run: | # docker-compose --project-name ${{ github.event.pull_request.head.ref }} exec -T backend \