~andrewjbeach/juju-ci-tools/make-local-patcher

« back to all changes in this revision

Viewing changes to update-jenkins-branches.bash

  • Committer: Curtis Hovey
  • Date: 2015-06-11 19:35:22 UTC
  • mto: This revision was merged to the branch mainline in revision 983.
  • Revision ID: curtis@canonical.com-20150611193522-o2nqkqb04o2i75wv
Remove euca_dump_logs because it has not been used this year.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/bash
2
 
# Update the required resources on the Jenkins master and slaves.
3
 
# the --cloud-city option will also update credential and configs.
 
2
# As a member of juju-qa,  Visit each the jenkins master and slaves
 
3
# and update their branches.
 
4
# passing 'true' as an arg will driect the script to try to update cloud-city.
4
5
set -eux
5
6
 
6
 
HERE=$(pwd)
7
 
SCRIPTS=$(readlink -f $(dirname $0))
8
 
REPOSITORY_PARENT=$(dirname $SCRIPTS)
9
 
 
10
7
MASTER="juju-ci.vapour.ws"
11
8
SLAVES="precise-slave.vapour.ws trusty-slave.vapour.ws \
12
 
    xenial-slave.vapour.ws yakkety-slave.vapour.ws \
13
 
    ppc64el-slave.vapour.ws ppc64-slave.vapour.ws \
14
 
    arm64-slave.vapour.ws s390x-slave.vapour.ws \
15
 
    kvm-slave.vapour.ws certification-slave.vapour.ws \
16
 
    munna-maas-slave.vapour.ws  silcoon-maas-slave.vapour.ws \
17
 
    canonistack-slave.vapour.ws osx-slave.vapour.ws \
18
 
    release-slave.vapour.ws cloud-health-slave.vapour.ws  \
19
 
    juju-core-slave.vapour.ws charm-bundle-slave.vapour.ws \
20
 
    feature-slave.vapour.ws \
21
 
    lxd-slave-a.vapour.ws lxd-slave-b.vapour.ws \
22
 
    juju-core-slave-b.vapour.ws"
23
 
WIN_SLAVES="win-slave.vapour.ws"
 
9
    utopic-slave-a.vapour.ws utopic-slave-b.vapour.ws \
 
10
    vivid-slave.vapour.ws vivid-slave-b.vapour.ws \
 
11
    ppc64el-slave.vapour.ws i386-slave.vapour.ws kvm-slave.vapour.ws \
 
12
    canonistack-slave.vapour.ws juju-core-slave.vapour.ws \
 
13
    charm-bundle-slave.vapour.ws osx-slave.vapour.ws"
24
14
KEY="staging-juju-rsa"
25
15
export JUJU_ENV="juju-ci3"
26
16
 
30
20
    if [[ $hostname == $MASTER ]]; then
31
21
        # Bypass DNS which points to the apache front-end.
32
22
        host="54.86.142.177"
33
 
    elif [[ $hostname =~ .*[.]internal$ ]]; then
34
 
        host=$hostname # resolved by /etc/hosts
35
23
    else
36
24
        host=$(host -4 -t A $hostname 8.8.8.8 | tail -1 | cut -d ' ' -f4)
37
25
    fi
48
36
    (cd ~/cloud-city; bzr revert; cd -)
49
37
    bzr pull -d ~/cloud-city ~/cloud-city.new
50
38
    rm -r ~/cloud-city.new
51
 
    sudo chown -R jenkins ~/cloud-city
52
 
    chmod -R go-w ~/cloud-city
53
 
    chmod 700 ~/cloud-city
54
 
    chmod 700 ~/cloud-city/gnupg
55
 
    chmod 600 ~/cloud-city/staging-juju-rsa
56
 
fi
57
 
 
58
 
bzr pull -d ~/juju-release-tools
59
 
bzr pull -d ~/repository
60
 
bzr pull -d ~/juju-ci-tools
61
 
if [[ ! -e ~/workspace-runner ]]; then
62
 
    bzr branch http://bazaar.launchpad.net/~juju-qa/workspace-runner/trunk/\
63
 
      ~/workspace-runner
64
 
fi
65
 
bzr pull -d ~/workspace-runner
 
39
fi
 
40
cd ~/juju-release-tools
 
41
bzr pull
 
42
cd ~/repository
 
43
bzr pull
 
44
cd ~/juju-ci-tools
 
45
bzr pull
66
46
if [[ \$(uname) == "Linux" ]]; then
67
 
    cd ~/juju-ci-tools
68
47
    make install-deps
69
 
    # The lsb_release package is broken in xenial and yakkety. The py2 module
70
 
    # is missing.
71
 
    if  [[ ! -f /usr/lib/python2.7/dist-packages/lsb_release.py ]]; then
72
 
            sudo cp /usr/lib/python3/dist-packages/lsb_release.py \
73
 
                    /usr/lib/python2.7/dist-packages/lsb_release.py
74
 
    fi
75
 
elif [[ \$(uname) == "Darwin" ]]; then
76
 
    ~/juju-ci-tools/pipdeps.py install
77
48
fi
78
49
if [[ -d ~/ci-director ]]; then
79
 
    bzr pull -d ~/ci-director
 
50
    cd ~/ci-director
 
51
    bzr pull
80
52
fi
81
53
EOT
82
54
}
83
55
 
84
56
 
85
 
update_windows() {
86
 
    hostname=$1
87
 
    scp repository.zip Administrator@$hostname:/cygdrive/c/Users/Administrator/
88
 
    ssh Administrator@$hostname << EOT
89
 
bzr pull -d ./juju-release-tools
90
 
bzr pull -d ./juju-ci-tools
91
 
/cygdrive/c/progra~2/7-Zip/7z.exe x -y repository.zip
92
 
python ./juju-ci-tools/pipdeps.py install
93
 
EOT
94
 
}
95
 
 
96
 
 
97
57
CLOUD_CITY="false"
98
58
while [[ "${1-}" != "" ]]; do
99
59
    case $1 in
105
65
done
106
66
 
107
67
SKIPPED=""
108
 
for hostname in $MASTER $SLAVES; do
109
 
    update_jenkins $hostname || SKIPPED="$SKIPPED $hostname"
110
 
done
111
 
 
112
 
# win-slaves have a different user and directory layout tan POSIX hosts.
113
 
# Also, win+bzr does not support symlinks, so we zip the local charm repo.
114
 
(cd $REPOSITORY_PARENT; zip -q -r $HERE/repository.zip repository -x *.bzr*)
115
 
for hostname in $WIN_SLAVES; do
116
 
    update_windows $hostname || update_windows $hostname
117
 
    if [[ $? -ne 0  ]]; then
118
 
        SKIPPED="$SKIPPED $hostname"
119
 
    fi
 
68
for host in $MASTER $SLAVES; do
 
69
    update_jenkins $host || SKIPPED="$SKIPPED $host"
120
70
done
121
71
 
122
72
if [[ -n "$SKIPPED" ]]; then
124
74
    echo
125
75
    echo "These hosts were skipped because there was an error"
126
76
    echo "$SKIPPED"
127
 
    exit 1
128
77
fi
129
 
echo "All hosts updated."
130
78