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

Add git submodule regression check #7056

Merged
merged 1 commit into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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