Skip to content

Commit

Permalink
Merge pull request #147 in SWDEV/franka_ros from feature/SRR-1183-jen…
Browse files Browse the repository at this point in the history
…kins-script-must-fail-when-internal to develop

* commit 'f8506671ea911c35f6c5794d8d8a7c326f903f20':
  Modified checkgithistory to accept parameters and fixed typos in comment
  Checking github history sync in separate jenkins stage and removed unused dependency from dockerfile
  Add: bash script to check sync between local and public repos
  • Loading branch information
falfab committed Nov 5, 2021
2 parents 2b1665a + f850667 commit 8dc80d1
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .ci/checkgithistory.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
set -e

# the script checks if the public repo and the local repo commit history are sync, otherwise it fails
if [ $# -ne 2 ]; then
>&2 echo "Not enough argument supplied. Usage: checkgithistory.sh public_url develop_branch_name"
exit 1
fi

cd src/franka_ros
public_url=$1
public_remote_name=$(git remote -v | grep ${public_url} | head -n 1 | sed -e 's/\s.*$//')
develop_branch_name=$2

if [ -z "$public_remote_name" ]; then
public_remote_name="public"
git remote add $public_remote_name $public_url
fi

git fetch $public_remote_name

local_commit_hash=$(git rev-parse origin/${develop_branch_name})
public_commit_hash=$(git rev-parse ${public_remote_name}/${develop_branch_name})

if [ "$local_commit_hash" != "$public_commit_hash" ]; then
>&2 echo "Local and public commit hashes do not match. Please update local to the latest public commit"
exit 1
else
echo "Local and public commit hashes do match."
fi
16 changes: 16 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@ node {
step([$class: 'StashNotifier'])
}

node ('docker'){
try {
dir('src/franka_ros') {
checkout scm
}
stage("Check public/local commit history sync") {
sh """
src/franka_ros/.ci/checkgithistory.sh https://github.com/frankaemika/franka_ros.git develop
"""
}
} catch (e) {
currentBuild.result = 'FAILED'
step([$class: 'StashNotifier'])
}
}

parallel(
'melodic': getStages('melodic', 'bionic'),
'noetic': getStages('noetic', 'focal'),
Expand Down

0 comments on commit 8dc80d1

Please sign in to comment.