blob: 539e911151bf1041dc9cccb7143b008a36a63180 [file] [log] [blame]
Gary Wud04e4402017-07-28 12:26:54 -07001#!/bin/bash
2#
3# Copyright 2016-2017 Huawei Technologies Co., Ltd.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18# csit plans root dir
19ROOT=`git rev-parse --show-toplevel`/autorelease
20
21BUILD_DIR=$ROOT/build
22JJB_DIR=$BUILD_DIR/ci-management/jjb
23
24WORKSPACE=`git rev-parse --show-toplevel`
25PLANS_DIR=`git rev-parse --show-toplevel`/test/csit/plans
26
27source $ROOT/scripts/generate-jjbs/workarounds.sh
28
29
30TMPDIR=`mktemp -d --suffix="-docker-log"`
31$ROOT/scripts/ls-microservice-repos.py | cut -d ' ' -f 1 > $TMPDIR/microservices.txt
32
33find $PLANS_DIR -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | sort | while read repo; do
34
35 OUTFILE=$JJB_DIR/$repo/${repo}-csit.yaml
36 cat > $OUTFILE <<EOF
37---
38- project:
39 name: ${repo}-csit
40 jobs:
41 - 'integration-verify-{project}-csit-{functionality}'
42 - '{project}-csit-{functionality}'
43 project: '${repo}'
44 functionality:
45EOF
46 find $PLANS_DIR/$repo -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | sort | while read func; do
47 echo $repo / $func
48 cat >> $OUTFILE <<EOF
49 - '${func}':
50 trigger_jobs:
51EOF
52
53 docker kill `docker ps -a -q`
54 docker rm `docker ps -a -q`
55
56 $WORKSPACE/test/csit/run-csit.sh plans/${repo}/${func}
57 mkdir -p $TMPDIR/${repo}
58 cp $WORKSPACE/archives/_docker-images.log $TMPDIR/${repo}/${func}.txt
59
60 docker kill `docker ps -a -q`
61 docker rm `docker ps -a -q`
62
63
64 for image in `grep openoint $TMPDIR/${repo}/${func}.txt | grep -f $TMPDIR/microservices.txt | sort`; do
65 microservice=`echo $image | cut -d '/' -f 2`
66 cat >> $OUTFILE <<EOF
67 - 'integration-${microservice}-merge-docker'
68EOF
69 done
70
71 done
72
73 cat >> $OUTFILE <<EOF
74 robot-options: ''
75 branch: 'master'
76EOF
77done
78
79echo $TMPDIR