From 5d46e501e3ce5ae9d96f101252f01dd78c191d7e Mon Sep 17 00:00:00 2001 From: mrekucci Date: Wed, 29 May 2024 16:01:07 +0200 Subject: [PATCH] chore: extend infrastructure workflow statistics (#117) --- .github/workflows/infrstructure.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/infrstructure.yml b/.github/workflows/infrstructure.yml index 52eca541f..11ff9b47c 100644 --- a/.github/workflows/infrstructure.yml +++ b/.github/workflows/infrstructure.yml @@ -46,7 +46,7 @@ concurrency: jobs: cluster: - name: Setup and Test Nomad devnet Cluster + name: Setup and Test Nomad Cluster runs-on: ubuntu-22.04 timeout-minutes: 180 if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} @@ -159,21 +159,26 @@ jobs: - name: Initialize Cluster if: ${{ env.IS_MANUAL_DEPLOYMENT == 'false' || github.event.inputs.init == 'true'}} run: | + START_TIME="$(date +%s)" ./cluster.sh init ${CLUSTER_PROFILE_FLAG} ${DEBUG_FLAG} + END_TIME="$(date +%s)" + echo "INIT_DURATION=$(date -ud "@$((END_TIME - START_TIME))" +'%H:%M:%S')" >> ${GITHUB_ENV} working-directory: infrastructure/nomad - name: Deploy Cluster run: | + START_TIME="$(date +%s)" ./cluster.sh deploy ${CLUSTER_PROFILE_FLAG} ${CLUSTER_LOGS_FLAG} ${DEBUG_FLAG} + END_TIME="$(date +%s)" + echo "DEPLOY_DURATION=$(date -ud "@$((END_TIME - START_TIME))" +'%H:%M:%S')" >> ${GITHUB_ENV} working-directory: infrastructure/nomad - name: Notify - Deployment Successful if: ${{ env.IS_MANUAL_DEPLOYMENT == 'true' && success() }} run: | - END_TIME=$(date +%s) - START_TIME=$(date +%s -r /proc/$(pgrep -o -x "runner")/stat) - DURATION=$((END_TIME - START_TIME)) - DURATION_STRING=$(date -ud "@${DURATION}" +'%H:%M:%S') + INIT_DURATION=${INIT_DURATION:-N/A} + DEPLOY_DURATION=${DEPLOY_DURATION:-N/A} + RUNNER_DURATION=$(date -ud "@$(( $(date +%s) - $(date +%s -r /proc/$(pgrep -o -x "runner")/stat) ))" +'%H:%M:%S') WORKFLOW_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" PAYLOAD=$(cat <<-EOH { @@ -189,7 +194,7 @@ jobs: }, { "title": "Deployment Duration", - "value": "${DURATION_STRING}", + "value": "Init: ${INIT_DURATION}\nDeploy: ${DEPLOY_DURATION}\nRunner: ${RUNNER_DURATION}", "short": false } ]