diff --git a/infrastructure/nomad/playbooks/deploy.yml b/infrastructure/nomad/playbooks/deploy.yml index d5f56853f..30e7a02a6 100644 --- a/infrastructure/nomad/playbooks/deploy.yml +++ b/infrastructure/nomad/playbooks/deploy.yml @@ -573,7 +573,8 @@ ansible.builtin.shell: | RESULT="$(nomad run {{ ansible_env.HOME }}/{{ env }}/{{ job.name }}.nomad 2>&1)" if [ $? -ne 0 ]; then - echo "Failed to deploy {{ job.name }}:\n${RESULT}." + echo "Failed to deploy {{ job.name }}:" + echo "${RESULT}" echo "{{ job.name }} stdout logs:" nomad alloc logs -stdout -job "{{ job.name }}" | tail -n 100 echo "{{ job.name }} error logs:" @@ -585,7 +586,12 @@ START_TIME=$(date +%s) RESULT=$(nomad job status -json "{{ job.name }}") if [ $? -ne 0 ]; then - echo "Failed to get job status for {{ job.name }}:\n${RESULT}." + echo "Failed to get job status for {{ job.name }}:" + echo "${RESULT}" + echo "{{ job.name }} stdout logs:" + nomad alloc logs -stdout -job "{{ job.name }}" | tail -n 100 + echo "{{ job.name }} error logs:" + nomad alloc logs -stderr -job "{{ job.name }}" | tail -n 100 exit 1 fi JOB_TYPE=$(echo "${RESULT}" | jq -r '.[0].Allocations[0].JobType') @@ -624,7 +630,12 @@ sleep 1 RESULT=$(nomad job status -json "{{ job.name }}") if [ $? -ne 0 ]; then - echo "Failed to get job status for {{ job.name }}: ${RESULT}." + echo "Failed to get job status for {{ job.name }}:" + echo "${RESULT}" + echo "{{ job.name }} stdout logs:" + nomad alloc logs -stdout -job "{{ job.name }}" | tail -n 100 + echo "{{ job.name }} error logs:" + nomad alloc logs -stderr -job "{{ job.name }}" | tail -n 100 exit 1 fi done diff --git a/infrastructure/nomad/playbooks/templates/jobs/mev-commit-faucet.nomad.j2 b/infrastructure/nomad/playbooks/templates/jobs/mev-commit-faucet.nomad.j2 index 1f823cafe..26bf2fce1 100644 --- a/infrastructure/nomad/playbooks/templates/jobs/mev-commit-faucet.nomad.j2 +++ b/infrastructure/nomad/playbooks/templates/jobs/mev-commit-faucet.nomad.j2 @@ -69,7 +69,8 @@ job "{{ job.name }}" { template { data = <<-EOH #!/usr/bin/env bash - + env + set -x {% raw %} {{- range nomadService "datadog-agent-logs-collector" }} {{ if contains "tcp" .Tags }}