Skip to content

Commit

Permalink
chore: extend infrastructure workflow statistics (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci authored May 29, 2024
1 parent b8c58a3 commit 5d46e50
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/infrstructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand Down Expand Up @@ -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
{
Expand All @@ -189,7 +194,7 @@ jobs:
},
{
"title": "Deployment Duration",
"value": "${DURATION_STRING}",
"value": "Init: ${INIT_DURATION}\nDeploy: ${DEPLOY_DURATION}\nRunner: ${RUNNER_DURATION}",
"short": false
}
]
Expand Down

0 comments on commit 5d46e50

Please sign in to comment.