git.delta.rocks / unique-network / refs/commits / aa6b9ea4ef79

difftreelog

source

.github/workflows/node-only-update.yml14.0 KiBsourcehistory
1# https://cryptousetech.atlassian.net/wiki/spaces/CI/pages/2586837028/Nodes+only+update2# Node only update with restart polkadot-launch process.34name: nodes-only update56# Triger: only call from main workflow(re-usable workflows)7on:8  workflow_call:91011# A workflow run is made up of one or more jobs that can run sequentially or in parallel12jobs:1314  nodes-execution-matrix:1516    name: execution matrix1718    runs-on: self-hosted-ci19    outputs:20      matrix: ${{ steps.create_matrix.outputs.matrix }}2122    steps:2324      - name: Clean Workspace25        uses: AutoModality/action-clean@v1.1.02627      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it28      - uses: actions/checkout@v329        with:30          ref: ${{ github.head_ref }}  #Checking out head commit3132      - name: Read .env file33        uses: xom9ikk/dotenv@v23435      - name: Create Execution matrix36        uses: CertainLach/create-matrix-action@v337        id: create_matrix38        with:39          matrix: |40            network {opal}, wasm_name {opal}, mainnet_branch {${{ env.OPAL_MAINNET_BRANCH }}}, relay_branch {${{ env.UNIQUEWEST_MAINNET_BRANCH }}}41            network {sapphire}, wasm_name {quartz}, mainnet_branch {${{ env.SAPPHIRE_MAINNET_BRANCH }}}, relay_branch {${{ env.UNIQUEEAST_MAINNET_BRANCH }}}42            network {quartz}, wasm_name {quartz}, mainnet_branch {${{ env.QUARTZ_MAINNET_BRANCH }}}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}43            network {unique}, wasm_name {unique}, mainnet_branch {${{ env.UNIQUE_MAINNET_BRANCH }}}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}444546  nodes-only-update:47    needs: nodes-execution-matrix48    # The type of runner that the job will run on49    runs-on: [self-hosted-ci]5051    timeout-minutes: 2880           # 48 hours for execution jobs.5253    name: ${{ matrix.network }}5455    continue-on-error: true         #Do not stop testing of matrix runs failed.  As it decided during PR review - it required 50/50& Let's check it with false.5657    strategy:58      matrix:59        include: ${{fromJson(needs.nodes-execution-matrix.outputs.matrix)}}6061    steps:6263      - name: Clean Workspace64        uses: AutoModality/action-clean@v1.1.06566      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it67      - uses: actions/checkout@v368        with:69          ref: ${{ github.head_ref }}  #Checking out head commit7071      - name: Read .env file72        uses: xom9ikk/dotenv@v27374      - name: Generate ENV related extend file for docker-compose75        uses: cuchi/jinja2-action@v1.2.076        with:77          template: .docker/docker-compose.tmp-node.j278          output_file: .docker/docker-compose.node.${{ matrix.network }}.yml79          variables: |80            REPO_URL=${{ github.server_url }}/${{ github.repository }}.git81            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}82            POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}83            POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }}84            # POLKADOT_MAINNET_BRANCH=${{ env.POLKADOT_MAINNET_BRANCH }}85            # MAINNET_TAG=${{ matrix.mainnet_tag }}86            MAINNET_BRANCH=${{ matrix.mainnet_branch }}87            NETWORK=${{ matrix.network }}88            WASM_NAME=${{ matrix.wasm_name }}89            # BRANCH=${{ github.head_ref }}9091      - name: Show build configuration92        run: cat .docker/docker-compose.node.${{ matrix.network }}.yml9394      - name: Generate launch-config-forkless-nodata.json95        uses: cuchi/jinja2-action@v1.2.096        with:97          template: .docker/forkless-config/launch-config-forkless-nodata.j298          output_file: .docker/launch-config-forkless-nodata.json99          variables: |100            NETWORK=${{ matrix.network }}101            WASM_NAME=${{ matrix.wasm_name }}102103      - name: Show launch-config-forkless configuration104        run: cat .docker/launch-config-forkless-nodata.json105106      - uses: actions/setup-node@v3107        with:108          node-version: 16109110      - name: Build the stack111        run: docker-compose -f ".docker/docker-compose.node.${{ matrix.network }}.yml" up -d --build --remove-orphans --force-recreate --timeout 300112113      #  🚀 POLKADOT LAUNCH COMPLETE 🚀114      - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade.115        if: success()116        run: |117          counter=160118          function check_container_status {119                docker inspect -f {{.State.Running}} node-parachain120          }121          function do_docker_logs {122                docker logs --details node-parachain  2>&1123          }124          function is_started {125                if [ "$(check_container_status)" == "true" ]; then126                        echo "Container: node-parachain RUNNING";127                        echo "Check Docker logs"128                        DOCKER_LOGS=$(do_docker_logs)129                        if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then130                                echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"131                                return 0132                        else133                                echo "Message not found in logs output, repeating..."134                                return 1135                        fi136                else137                        echo "Container node-parachain NOT RUNNING"138                        echo "Halting all future checks"139                        exit 1140                fi141          echo "something goes wrong"142          exit 1143          }144          while ! is_started; do145                echo "Waiting for special message in log files "146                sleep 30s147                counter=$(( $counter - 1 ))148                echo "Counter: $counter"149                if [ "$counter" -gt "0" ]; then150                         continue151                else152                         break153                fi154          done155          echo "Halting script"156          exit 0157        shell: bash158159      - name: Checkout at '${{ matrix.mainnet_branch }}' branch160        uses: actions/checkout@master161        with:162          ref: ${{ matrix.mainnet_branch }}  #Checking out head commit163          path: ${{ matrix.mainnet_branch }}164165      - name: Run Parallel tests before Node Parachain upgrade166        working-directory: ${{ matrix.mainnet_branch }}/tests167        if: success() || failure()168        run: |169          yarn install170          yarn add mochawesome171          node scripts/readyness.js172          echo "Ready to start tests"173          yarn polkadot-types174          NOW=$(date +%s) && yarn testParallel --reporter mochawesome --reporter-options reportFilename=test-parallel-${NOW}175        env:176          RPC_URL: http://127.0.0.1:9933/177178      # - name: Upload Parallel Test Report Before Node upgrade179      #   uses: phoenix-actions/test-reporting@v8180      #   id: test-parallel-report-before181      #   if: success() || failure()    # run this step even if previous step failed182      #   with:183      #     name: Tests before node upgrade ${{ matrix.network }}            # Name of the check run which will be created184      #     path: ${{ matrix.mainnet_branch }}/tests/mochawesome-report/test-parallel-*.json    # Path to test results185      #     reporter: mochawesome-json186      #     fail-on-error: 'false'187188      - name: Run Sequential tests before Node Parachain upgrade189        if: success() || failure()190        working-directory: ${{ matrix.mainnet_branch }}/tests191        run: NOW=$(date +%s) && yarn testSequential --reporter mochawesome --reporter-options reportFilename=test-sequential-${NOW}192        env:193          RPC_URL: http://127.0.0.1:9933/194195      # - name: Upload Sequential Test Report Before Node upgrade196      #   uses: phoenix-actions/test-reporting@v8197      #   id: test-sequential-report-before198      #   if: success() || failure()    # run this step even if previous step failed199      #   with:200      #     name: Tests before node upgrade ${{ matrix.network }}            # Name of the check run which will be created201      #     path: ${{ matrix.mainnet_branch }}/tests/mochawesome-report/test-sequential-*.json    # Path to test results202      #     reporter: mochawesome-json203      #     fail-on-error: 'false'204205      - name: Send SIGUSR1 to polkadot-launch process206        if: success() || failure()207        run: |208          #Get PID of polkadot-launch209          ContainerID=$(docker ps -aqf "name=node-parachain")210          PID=$(docker exec node-parachain pidof 'polkadot-launch')211          sleep 30s212          echo -e "\n"213          echo -e "Restart polkadot-launch process: $PID\n"214          docker exec node-parachain kill -SIGUSR1 ${PID}215          echo "SIGUSR1 sent to Polkadot-launch PID: $PID"216          sleep 60s217          echo -e "Show logs of node-parachain container.\n"218          docker logs ${ContainerID}219220      - name: Get chain logs in case of docker image crashed after Polkadot Launch restart221        if: failure()                   # run this step only at failure222        run: |223          docker exec node-parachain tail -n 1000 /polkadot-launch/9944.log224          docker exec node-parachain tail -n 1000 /polkadot-launch/9945.log225          docker exec node-parachain tail -n 1000 /polkadot-launch/alice.log226227      - name: copy chain log files from container to the host228        if: success() || failure()    # run this step even if previous step failed229        run: |230          mkdir -p /tmp/node-only-update231          docker cp node-parachain:/polkadot-launch/9944.log /tmp/node-only-update/232          docker cp node-parachain:/polkadot-launch/9945.log /tmp/node-only-update/233          docker cp node-parachain:/polkadot-launch/alice.log /tmp/node-only-update/234235      - name: Upload chain log files236        if: success() || failure()237        uses: actions/upload-artifact@v3238        with:239          name: node-only-update-chain-logs240          path: /tmp/node-only-update/241          if-no-files-found: warn242243      - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade.244        if: success()245        run: |246          counter=160247          function check_container_status {248                docker inspect -f {{.State.Running}} node-parachain249          }250          function do_docker_logs {251                docker logs --details node-parachain  2>&1252          }253          function is_started {254                if [ "$(check_container_status)" == "true" ]; then255                        echo "Container: node-parachain RUNNING";256                        echo "Check Docker logs"257                        DOCKER_LOGS=$(do_docker_logs)258                        if [[ ${DOCKER_LOGS} = *"All parachain collators restarted with the new binaries."* ]];then259                                echo "🌗 All parachain collators restarted with the new binaries."260                                return 0261                        else262                                echo "Message not found in logs output, repeating..."263                                return 1264                        fi265                else266                        echo "Container node-parachain NOT RUNNING"267                        echo "Halting all future checks"268                        exit 1269                fi270          echo "something goes wrong"271          exit 1272          }273          while ! is_started; do274                echo "Waiting for special message in log files "275                sleep 30s276                counter=$(( $counter - 1 ))277                echo "Counter: $counter"278                if [ "$counter" -gt "0" ]; then279                         continue280                else281                         break282                fi283          done284          echo "Halting script"285          exit 0286        shell: bash287288      - name: Run Parallel tests after Node Parachain upgrade289        working-directory: ${{ matrix.mainnet_branch }}/tests290        if: success() || failure()    # run this step even if previous step failed291        run: |292          yarn install293          yarn add mochawesome294          node scripts/readyness.js295          echo "Ready to start tests"296          yarn polkadot-types297          NOW=$(date +%s) && yarn testParallel --reporter mochawesome --reporter-options reportFilename=test-parallel-${NOW}298        env:299          RPC_URL: http://127.0.0.1:9933/300301      #- name: Test Report Parallel After Node upgrade302      #  uses: phoenix-actions/test-reporting@v8303      #  id: test-report-parallel-after304      #  if: success() || failure()    # run this step even if previous step failed305      #  with:306      #    name: Tests after node upgrade ${{ matrix.network }}            # Name of the check run which will be created307      #    path: ${{ matrix.mainnet_branch }}/tests/mochawesome-report/test-parallel-*.json    # Path to test results308      #    reporter: mochawesome-json309      #    fail-on-error: 'false'310311      - name: Run Sequential tests after Node Parachain upgrade312        if: success() || failure()313        working-directory: ${{ matrix.mainnet_branch }}/tests314        run: NOW=$(date +%s) && yarn testSequential --reporter mochawesome --reporter-options reportFilename=test-sequential-${NOW}315        env:316          RPC_URL: http://127.0.0.1:9933/317318      #- name: Upload Sequential Test Report After Node upgrade319      #  uses: phoenix-actions/test-reporting@v8320      #  id: test-sequential-report-after321      #  if: success() || failure()    # run this step even if previous step failed322      #  with:323      #    name: Tests before node upgrade ${{ matrix.network }}            # Name of the check run which will be created324      #    path: ${{ matrix.mainnet_branch }}/tests/mochawesome-report/test-sequential-*.json    # Path to test results325      #    reporter: mochawesome-json326      #    fail-on-error: 'false'327328      - name: Stop running containers329        if: always()                   # run this step always330        run: docker-compose -f ".docker/docker-compose.node.${{ matrix.network }}.yml" down --volumes331332      - name: Remove builder cache333        if: always()                   # run this step always334        run: |335          docker builder prune -f -a336          docker system prune -f337          docker image prune -f -a338339      - name: Remove repo at the end340        if: always()                   # run this step always341        run: |342          ls -ls ./