Skip to content

Commit

Permalink
refactor: integrate infrastructure workflow into ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Jul 3, 2024
1 parent b8280df commit ef8c33f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,12 @@ jobs:
git diff --name-only --exit-code . || (echo "Generated files not in parity with the source files." && exit 1)
git reset --hard HEAD
working-directory: contracts-abi

infrastructure:
uses: ./.github/workflows/infrastructure.yml
secrets: inherit
needs:
- commitlint
- go-modules
- foundry
- contracts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: infrastructure

on:
workflow_run:
workflows:
- ci
types:
- completed
workflow_call:
workflow_dispatch:
inputs:
profile:
Expand Down Expand Up @@ -50,7 +46,6 @@ jobs:
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' }}

steps:
- name: Setup Environment
Expand Down Expand Up @@ -104,7 +99,7 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ github.event.workflow_run.head_branch }}
ref: ${{ github.event.workflow_run.head_branch || github.event.inputs.branch || github.ref }}

- name: Setup Cache
uses: actions/cache@v4
Expand Down
8 changes: 6 additions & 2 deletions infrastructure/nomad/playbooks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -573,15 +573,19 @@
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 }}: ${RESULT}."
echo "Failed to deploy {{ job.name }}:\n${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
TIMEOUT={% if profile == 'ci' %}600{% else %}300{% endif %}
START_TIME=$(date +%s)
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 }}:\n${RESULT}."
exit 1
fi
JOB_TYPE=$(echo "${RESULT}" | jq -r '.[0].Allocations[0].JobType')
Expand Down

0 comments on commit ef8c33f

Please sign in to comment.