summaryrefslogtreecommitdiffstats
path: root/jenkins-builds/aggregate_builds.sh
blob: ead198feb6ae178793b6ee2e6e145b9a78bc4f52 (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
#! /bin/bash

git_branch=master
dest_root=/srv/www/jogamp.org/deployment/autobuilds/${git_branch}/last

rm -rf ${dest_root}
mkdir -p ${dest_root}

modules="gluegen joal joal-demos jogl jogl-demos jocl jocl-demos"
modules_master="gluegen_onmaster joal_onmaster jogl_onmaster jogl-demos_onmaster jocl_onmaster"
nodes="android-arm64 linux-arm32 linux-arm64 linux-x86_64 macos-x86_64 windows-x86_64 linux-x86_64-master-001"

this_dir=`pwd`

function node_expected() {
    node=$1
    for x in ${nodes}; do
        if [ "${x}" = "${node}" ]; then
            return 0
        fi
    done
    return 1
}

function copy_tree() {
    for module in ${modules} ${modules_master} ; do
        build_number=
        dest_dir=
        module_root_dir=/srv/jenkins/jobs/${module}/configurations/axis-label
        cd ${module_root_dir}
        for node in `find . -maxdepth 1 -type d` ; do 
            if [ "${node}" != "." -a "${node}" != ".." ] ; then
                node=`basename ${node}`
                if node_expected ${node} ; then
                    module_node_dir=${module_root_dir}/${node}/builds
                    cd ${module_node_dir}
                    if [ -z "${build_number}" ] ; then
                        build_number=`ls -rt  | egrep "^([0-9]+)$" | sort -ug | tail -1`
                        dest_dir=${dest_root}/${module}-b${build_number}
                    fi
                    build_dir=${module_node_dir}/${build_number}/archive/build
                    if [ ! -e ${build_dir} ] ; then
                        echo "Error: ${build_dir} doesn't exist: module ${module}, node ${node}, build ${build_number}!"
                        exit 1
                    fi
                    echo "Copying module ${module}, build ${build_number}, node ${node}"
                    mkdir -p ${dest_dir}
                    cp -a ${build_dir}/* ${dest_dir}/
                else
                    echo "Skipping module ${module}, node ${node}!"
                fi
            fi
        done
        echo ""
    done
}

copy_tree