~nskaggs/juju-ci-tools/add-assess-terms

« back to all changes in this revision

Viewing changes to update-juju-eco-tree.bash

Bidirectional testing of ecosystem projects.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
set -eu
 
3
 
 
4
LOCAL_REPO=$(readlink -f $1)  # Path to the local repo: gogo/src/github.com/foo
 
5
REMOTE_REPO=$(echo "$LOCAL_REPO" | sed -e 's,.*/src/,,')
 
6
 
 
7
: ${CI_TOOLS=$(readlink -f $(dirname $0))}
 
8
CLOUD_CITY=$(readlink -f $CI_TOOLS/../cloud-city)
 
9
 
 
10
while [[ "${1-}" != "" ]]; do
 
11
    case $1 in
 
12
        --cloud-city)
 
13
            shift
 
14
            CLOUD_CITY=$(readlink -f $1)
 
15
            ;;
 
16
    esac
 
17
    shift
 
18
done
 
19
 
 
20
cd $LOCAL_REPO
 
21
git co master
 
22
OLD_HASH=$(git log --first-parent -1 --pretty=format:%h)
 
23
source $CLOUD_CITY/juju-bot.txt
 
24
git pull https://$github_user:$github_password@$REMOTE_REPO.git master
 
25
NEW_HASH=$(git log --first-parent -1 --pretty=format:%h)
 
26
if [[ $OLD_HASH == $NEW_HASH ]]; then
 
27
    echo "Nothing to test."
 
28
    exit 1
 
29
else
 
30
    echo "A new revision can be tested."
 
31
    set +e
 
32
    echo "Updating all go deps."
 
33
    go get ./...
 
34
    exit 0
 
35
fi