Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #7056 from EOSIO/add-git-submodule-regression-check
Browse files Browse the repository at this point in the history
Add git submodule regression check
  • Loading branch information
heifner committed Apr 3, 2019
2 parents 91c7806 + d433884 commit cbca3d9
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -614,3 +614,11 @@ steps:
- "build/packages/eosio_highsierra.rb"
- "build/packages/eosio.rb"
timeout: 60
- command: |
echo "+++ :microscope: Running git submodule regression check" && \
./scripts/submodule_check.sh
label: "Git submodule regression check"
agents:
queue: "automation-large-builder-fleet"
timeout: 240
35 changes: 35 additions & 0 deletions scripts/submodule_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

REPO_DIR=`mktemp -d`
git clone "$BUILDKITE_REPO" "$REPO_DIR"
git submodule update --init --recursive
cd "$REPO_DIR"

declare -A PR_MAP
declare -A BASE_MAP

echo "getting submodule info for $BUILDKITE_BRANCH"
git checkout "$BUILDKITE_BRANCH" &> /dev/null
git submodule update --init &> /dev/null
while read -r a b; do
PR_MAP[$a]=$b
done < <(git submodule --quiet foreach --recursive 'echo $path `git log -1 --format=%ct`')

echo "getting submodule info for $BUILDKITE_PULL_REQUEST_BASE_BRANCH"
git checkout "$BUILDKITE_PULL_REQUEST_BASE_BRANCH" &> /dev/null
git submodule update --init &> /dev/null
while read -r a b; do
BASE_MAP[$a]=$b
done < <(git submodule --quiet foreach --recursive 'echo $path `git log -1 --format=%ct`')

for k in "${!BASE_MAP[@]}"; do
base_ts=${BASE_MAP[$k]}
pr_ts=${PR_MAP[$k]}
echo "submodule $k"
echo " timestamp on $BUILDKITE_BRANCH: $pr_ts"
echo " timestamp on $BUILDKITE_PULL_REQUEST_BASE_BRANCH: $base_ts"
if (( $pr_ts < $base_ts)); then
echo "ERROR: $k is older on $BUILDKITE_BRANCH than $BUILDKITE_PULL_REQUEST_BASE_BRANCH"
exit 1
fi
done

0 comments on commit cbca3d9

Please sign in to comment.