update link to upper-constraints.txt
[integration.git] / bootstrap / jenkins / scripts / gen-java-jobs.py
1 #!/usr/bin/env python
2 #
3 # Copyright 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 import fileinput
12 import os
13 import subprocess
14
15 print("""- project:
16     name: onap-java
17     jobs:
18      - 'java-{project}'
19     project:""")
20
21 for line in fileinput.input():
22     repo = line.strip()
23     isGroupRepo = subprocess.call("grep -s 'Group repo' {}/README.md > /dev/null".format(repo), shell=True) == 0
24     if not isGroupRepo:
25         pompaths = os.popen("./ls-top-poms.sh {}".format(repo)).readlines()
26         for pompath in pompaths:
27             pompath = pompath.strip()
28             project = repo.replace("/", "_")
29             if pompath:
30                 project += "_" + pompath.replace("/", "_")
31             print("     - '{}':".format(project))
32             print("         repo: '{}'".format(repo))
33             if pompath:
34                 print("         pom: '{}/pom.xml'".format(pompath))
35             else:
36                 print("         pom: 'pom.xml'")