From 291e99ebd98de57a6fc2a395ae42fac07e3a7d74 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Tue, 19 Jul 2022 10:02:43 +0200 Subject: [PATCH] Minor ledgerexporter infrastructure improvements (#4461) * Push the stellar/horizon-ledgerexporter docker image when pushing to the lighthorizon branch * Fix the ledger exporter aws batch jobs when running on the first batch --- .github/workflows/horizon.yml | 4 ++-- services/horizon/docker/ledgerexporter/start | 15 ++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/horizon.yml b/.github/workflows/horizon.yml index 45de38c080..f32ea38113 100644 --- a/.github/workflows/horizon.yml +++ b/.github/workflows/horizon.yml @@ -2,7 +2,7 @@ name: Horizon on: push: - branches: [master] + branches: [master, lighthorizon] pull_request: jobs: @@ -146,6 +146,6 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - if: github.ref == 'refs/heads/master' + - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/lighthorizon' name: Push to DockerHub run: docker push stellar/horizon-ledgerexporter:latest diff --git a/services/horizon/docker/ledgerexporter/start b/services/horizon/docker/ledgerexporter/start index 8cb3bcb9c6..68df30ab6b 100644 --- a/services/horizon/docker/ledgerexporter/start +++ b/services/horizon/docker/ledgerexporter/start @@ -26,17 +26,14 @@ if [ ! -z "$AWS_BATCH_JOB_ARRAY_INDEX" ]; then # AWS_BATCH_JOB_ARRAY_INDEX=2: [191, 255] # AWS_BATCH_JOB_ARRAY_INDEX=3: [255, 319] # ... + START=`expr "$BATCH_SIZE" \* "$AWS_BATCH_JOB_ARRAY_INDEX" + "$BATCH_START_LEDGER"` + END=`expr "$BATCH_SIZE" \* "$AWS_BATCH_JOB_ARRAY_INDEX" + "$BATCH_START_LEDGER" + "$BATCH_SIZE"` - if [ $BATCH_START_LEDGER -eq 1 ]; then - export START=`expr "$BATCH_SIZE" \* "$AWS_BATCH_JOB_ARRAY_INDEX" + "$BATCH_START_LEDGER" - "2"` - export END=`expr "$BATCH_SIZE" \* "$AWS_BATCH_JOB_ARRAY_INDEX" + "$BATCH_START_LEDGER" + "$BATCH_SIZE" - "2"` - if [ $START -eq -1 ]; then - export START="1" - fi - else - export START=`expr "$BATCH_SIZE" \* "$AWS_BATCH_JOB_ARRAY_INDEX" + "$BATCH_START_LEDGER"` - export END=`expr "$BATCH_SIZE" \* "$AWS_BATCH_JOB_ARRAY_INDEX" + "$BATCH_START_LEDGER" + "$BATCH_SIZE"` + if [ "$START" -lt 2 ]; then + # The minimum ledger expected by the ledger exporter is 2 + START=2 fi + fi echo "START: $START END: $END"