Gary Wu | d04e440 | 2017-07-28 12:26:54 -0700 | [diff] [blame] | 1 | #!/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 | # autorelease root dir |
| 19 | ROOT=`git rev-parse --show-toplevel`/autorelease |
| 20 | |
| 21 | BUILD_DIR=$ROOT/build |
| 22 | JJB_DIR=$BUILD_DIR/ci-management/jjb |
| 23 | |
| 24 | cd $BUILD_DIR |
| 25 | |
| 26 | # docker root dir |
| 27 | DOCKER=`git rev-parse --show-toplevel`/test/csit/docker |
| 28 | |
| 29 | cd $DOCKER |
| 30 | |
| 31 | OUTFILE=$JJB_DIR/integration/integration-docker-microservices.yaml |
| 32 | |
| 33 | cat > $OUTFILE <<EOF |
| 34 | --- |
| 35 | - project: |
| 36 | name: integration-docker-microservices |
| 37 | project: 'integration' |
| 38 | branch: 'master' |
| 39 | version: '1.1.0-SNAPSHOT' |
| 40 | mvn-settings: 'autorelease-settings' |
| 41 | build-node: 'centos7-robot-8c-8g' |
| 42 | jobs: |
| 43 | - 'integration-{microservice}-verify-docker' |
| 44 | - 'integration-{microservice}-merge-docker' |
| 45 | microservice: |
| 46 | EOF |
| 47 | |
| 48 | TMPDIR=`$ROOT/scripts/generate-jjbs/gen-job-lists.sh` |
| 49 | IFS=$'\n' |
| 50 | for line in `$ROOT/scripts/ls-microservice-repos.py | sort`; do |
| 51 | IFS=' ' |
| 52 | array=($line) |
| 53 | microservice=${array[0]} |
| 54 | repo=${array[1]} |
| 55 | trigger=${array[2]} |
| 56 | echo $microservice $repo $trigger |
| 57 | cat >> $OUTFILE <<EOF |
| 58 | - '${microservice}': |
| 59 | trigger_jobs: |
| 60 | EOF |
| 61 | for job in `cat ${TMPDIR}/merge-jobs/${repo}.txt | grep "${trigger}"`; do |
| 62 | cat >> $OUTFILE <<EOF |
| 63 | - '${job}' |
| 64 | EOF |
| 65 | done |
| 66 | done |