Skip to content
Snippets Groups Projects
Commit a94992d9 authored by Kevin DeMarco's avatar Kevin DeMarco
Browse files

check git repo SHAs

parent a49a06fa
No related branches found
No related tags found
No related merge requests found
......@@ -55,22 +55,6 @@ function wait_for_procs()
done
}
function get_repo() {
DIR_NAME="$1"
REPO_URL="$2"
# Clone the repo if it doesn't exist yet
if [ ! -d "${DIR_NAME}" ]; then
git clone "${REPO_URL}" ${DIR_NAME}
fi
pushd ${DIR_NAME}
git checkout master
git remote set-url origin "${REPO_URL}" > /dev/null 2>&1
git fetch origin
git reset --hard origin/master
popd
}
check_fail()
{
STATUS=$?
......
......@@ -12,6 +12,25 @@ print_error()
echo
}
git_sha_compare()
{
REPO_NAME="$1"
ODROID_SSH="$2"
SERVER_SSH="$3"
SHA_ODROID=$(git ls-remote ${ODROID_SSH} | head -n 1 | awk '{print $1}')
SHA_SERVER=$(git ls-remote ${SERVER_SSH} | head -n 1 | awk '{print $1}')
if [ "$SHA_ODROID" != "$SHA_SERVER" ]; then
print_error
echo "The payload's git SHA for ${REPO_NAME} is old."
echo "${REPO_NAME} ODROID's SHA: ${SHA_ODROID}"
echo "${REPO_NAME} SERVER's SHA: ${SHA_SERVER}"
exit -1
else
echo "${REPO_NAME} is up-to-date."
fi
}
function usage()
{
cat << EOF
......@@ -60,7 +79,9 @@ if [ ! -e ${IPS_FILE} ]; then
fi
pushd ${ACS_ROOT}/acs_ros_ws/src/autonomy-payload >& /dev/null
git pull origin master
git pull origin
git checkout master ./ap_master/launch/master.launch
git checkout master ./ap_tasks/src/task_runner.py
if [ ! -f ./ap_master/launch/master.launch ]; then
echo "Local master.launch file doesn't exist"
exit -1
......@@ -113,6 +134,22 @@ do
echo "Checking status of ${AIRCRAFT_TYPE}: ${ODROID_USER}@${ODROID_IP}"
if [ ! -e ./keys/authorized_keys ]; then
echo "./keys/authorized_keys file doesn't exist"
echo "Add your public ssh key to the file and retry."
exit -1
fi
if [ ! -e ./keys/${TEAM_NAME}/.ssh/id_rsa ]; then
echo "Private ssh key doesn't exist at:"
echo "./keys/${TEAM_NAME}/.ssh/id_rsa"
echo "Add your team's ssh key folder"
exit -1
fi
scp ./keys/authorized_keys ${ODROID_USER}@${ODROID_IP}:~/.ssh/authorized_keys
scp -r ./keys/${TEAM_NAME}/.ssh ${ODROID_USER}@${ODROID_IP}:~/
if [ "${AIRCRAFT_TYPE}" == "copter" ]; then
# Check master.launch
scp ${ODROID_USER}@${ODROID_IP}:~/acs_ros_ws/src/autonomy-payload/ap_master/launch/master.launch .master.launch.remote >& /dev/null
......@@ -155,6 +192,22 @@ do
fi
fi
git_sha_compare "autonomy-payload" "${ODROID_USER}@${ODROID_IP}:~/acs_ros_ws/src/autonomy-payload" "git@gitlab.nps.edu:sasc/autonomy-payload.git"
git_sha_compare "autopilot_bridge" "${ODROID_USER}@${ODROID_IP}:~/acs_ros_ws/src/autopilot_bridge" "git@gitlab.nps.edu:sasc/autopilot_bridge.git"
git_sha_compare "autonomy_itar" "${ODROID_USER}@${ODROID_IP}:~/acs_ros_ws/src/autonomy_itar" "git@gitlab.nps.edu:sasc-itar/autonomy_itar.git"
#git_sha_compare "pymavlink" "syllogismrxs@192.168.130.18:~/ACS/mavlink/pymavlink" "git://github.com/ArduPilot/pymavlink.git"
if [ "${TEAM_NAME}" = 'usafa' ] ; then
git_sha_compare "usafa" "${ODROID_USER}@${ODROID_IP}:~/scrimmage/usafa" "git@gitlab.nps.edu:C17Alexander.Fulton_usafa.edu/scrimmage-templates.git"
elif [ "${TEAM_NAME}" = 'usna' ] ; then
git_sha_compare "usna" "${ODROID_USER}@${ODROID_IP}:~/scrimmage/usna" "git@gitlab.nps.edu:dawkins_usna.edu/scrimmage-templates.git"
elif [ "${TEAM_NAME}" = 'usma' ] ; then
git_sha_compare "usma" "${ODROID_USER}@${ODROID_IP}:~/scrimmage/usma" "git@gitlab.nps.edu:todd.brick_usma.edu/scrimmage-templates.git"
else
print_error
echo "Invalid team name for checking tactics repo: ${TEAM_NAME}"
fi
ssh ${ODROID_USER}@${ODROID_IP} 'bash --login -s' -- < onboard-check.sh ${ODROID_IP} ${AIRCRAFT_TYPE}
check_fail "ssh failed"
done < ${IPS_FILE}
......
......@@ -119,7 +119,7 @@ do
echo "Add your public ssh key to the file and retry."
exit -1
fi
if [ ! -e ./keys/${TEAM_NAME}/.ssh/id_rsa ]; then
echo "Private ssh key doesn't exist at:"
echo "./keys/${TEAM_NAME}/.ssh/id_rsa"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment