aboutsummaryrefslogtreecommitdiffstats
path: root/jjb/release-jjb-octopus-sources/include-release-jjb-release-sources-rsync.sh
blob: b0947b8bbe1bc45f6c14a588378b0b6231c9c72e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash

#set -x
set -e

mkdir -p ~/bin/ || true
curl https://storage.googleapis.com/git-repo-downloads/repo-1 > ~/bin/repo
chmod a+x ~/bin/repo
export PATH=$PATH:~/bin/

# construct upload folder


BRANCH=${RELEASE_BRANCH}
REVISION=${RELEASE_VERSION}


rm -rf AGLRELEASE || true

mkdir agl-${BRANCH}-${REVISION}
pushd agl-${BRANCH}-${REVISION}

repo init  --repo-branch=repo-1 --reference=/opt/AGL/preclone -q -b ${GERRIT_BRANCH} -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo -m ${BRANCH}_${REVISION}.xml

repo sync --force-sync

repo manifest -r > ../${BRANCH}_${REVISION}.tar.xml

rm -rf .repo
find . -name *.git | xargs rm -rf

ln -sf meta-agl/README-AGL.md

cat <<EOF > aglsetup.sh
#!/bin/bash

source ./meta-agl/scripts/aglsetup.sh \$@
EOF

chmod a+x aglsetup.sh

popd

tar -cjvf agl-${BRANCH}-${REVISION}.tar.bz2 agl-${BRANCH}-${REVISION}

md5sum agl-${BRANCH}-${REVISION}.tar.bz2 > agl-${BRANCH}-${REVISION}.tar.bz2.md5sum
sha256sum agl-${BRANCH}-${REVISION}.tar.bz2 > agl-${BRANCH}-${REVISION}.tar.bz2.sha256sum



rm -rf UPLOAD || true
mkdir -p UPLOAD/

cp -ar agl-${RELEASE_BRANCH}-${RELEASE_VERSION}.* UPLOAD/

export RSYNCSRC=$(pwd)/UPLOAD
export RSYNCDST="/srv/download/AGL/release/${RELEASE_BRANCH}/"

ls -alh UPLOAD/

if test x"yes" = x"${UPLOAD}" ; then
   set +x
   ssh -o StrictHostKeyChecking=no jenkins-slave@10.30.72.8 "mkdir -p ${RSYNCDST}"
   rsync -avr -e "ssh -o StrictHostKeyChecking=no" ${RSYNCSRC}/* jenkins-slave@10.30.72.8:${RSYNCDST}
   ssh -o StrictHostKeyChecking=no jenkins-slave@10.30.72.8 "rm -rf ${RSYNCDST}/latest" 
   ssh -o StrictHostKeyChecking=no jenkins-slave@10.30.72.8 "ln -sf ${RELEASE_VERSION} ${RSYNCDST}/latest"
fi