Add ability to just build one package at a time
This commit is contained in:
parent
4447ad27f0
commit
ba3898de97
|
@ -1,6 +1,6 @@
|
||||||
# peach-package-builder
|
# peach-package-builder
|
||||||
|
|
||||||
![Generic badge](https://img.shields.io/badge/version-0.3.4-<COLOR>.svg)
|
![Generic badge](https://img.shields.io/badge/version-0.3.5-<COLOR>.svg)
|
||||||
|
|
||||||
Scripts for building debian packages for PeachCloud microservices.
|
Scripts for building debian packages for PeachCloud microservices.
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,16 @@ from peach_package_builder.build_rust_packages import build_rust_packages
|
||||||
from peach_package_builder.build_peach_config import build_peach_config
|
from peach_package_builder.build_peach_config import build_peach_config
|
||||||
|
|
||||||
|
|
||||||
def build_packages(default_branch=False):
|
def build_packages(default_branch=False, package=None):
|
||||||
"""
|
"""
|
||||||
builds all PeachCloud microservices as .deb files and adds them to the freight repo
|
builds all PeachCloud microservices as .deb files and adds them to the freight repo
|
||||||
|
:param default_branch: checks out main git branch if True
|
||||||
|
:param package: if provided, only builds this package
|
||||||
"""
|
"""
|
||||||
build_rust_packages(default_branch=default_branch)
|
build_rust_packages(default_branch=default_branch, package=package)
|
||||||
build_peach_config(default_branch=default_branch)
|
# only build peach-config if no package argument was provided or if peach-config is what is being built
|
||||||
|
if not package or package == 'peach-config':
|
||||||
|
build_peach_config(default_branch=default_branch)
|
||||||
print("[ MICROSERVICE PACKAGE ARCHIVE UPDATED ]")
|
print("[ MICROSERVICE PACKAGE ARCHIVE UPDATED ]")
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,5 +25,10 @@ if __name__ == '__main__':
|
||||||
help="Ensure default branch for all repos for build",
|
help="Ensure default branch for all repos for build",
|
||||||
action="store_true"
|
action="store_true"
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-p",
|
||||||
|
"--package",
|
||||||
|
help="Ensure default branch for all repos for build",
|
||||||
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
build_packages(default_branch=args.default)
|
build_packages(default_branch=args.default, package=args.package)
|
|
@ -20,12 +20,19 @@ def add_debs_dir_to_freight():
|
||||||
update_freight_cache()
|
update_freight_cache()
|
||||||
|
|
||||||
|
|
||||||
def build_rust_packages(default_branch=False):
|
def build_rust_packages(default_branch=False, package=None):
|
||||||
"""
|
"""
|
||||||
builds all PeachCloud microservices written in rust and copies them to MICROSERVICES_DEB_DIR
|
builds all PeachCloud microservices written in rust and copies them to MICROSERVICES_DEB_DIR
|
||||||
|
:param default_branch: checks out main git branch if True
|
||||||
|
:param package: if provided, only builds this package
|
||||||
"""
|
"""
|
||||||
print("[ BUILDING AND UPDATING RUST MICROSERVICE PACKAGES ]")
|
print("[ BUILDING AND UPDATING RUST MICROSERVICE PACKAGES ]")
|
||||||
for service in SERVICES:
|
# if package argument was provided, then only build that one package, otherwise build all packages
|
||||||
|
if package:
|
||||||
|
services = filter(lambda s: s["name"] == package, SERVICES)
|
||||||
|
else:
|
||||||
|
services = SERVICES
|
||||||
|
for service in services:
|
||||||
service_name = service["name"]
|
service_name = service["name"]
|
||||||
service_path = os.path.join(MICROSERVICES_SRC_DIR, service_name)
|
service_path = os.path.join(MICROSERVICES_SRC_DIR, service_name)
|
||||||
print("[ BUILIDING SERVICE {} ]".format(service_name))
|
print("[ BUILIDING SERVICE {} ]".format(service_name))
|
||||||
|
@ -46,8 +53,12 @@ def build_rust_packages(default_branch=False):
|
||||||
cwd=service_path).decode("utf-8").strip()
|
cwd=service_path).decode("utf-8").strip()
|
||||||
subprocess.call(["cp", debian_package_path, MICROSERVICES_DEB_DIR])
|
subprocess.call(["cp", debian_package_path, MICROSERVICES_DEB_DIR])
|
||||||
|
|
||||||
# this function adds all .deb files in MICROSERVICES_DEB_DIR to freight
|
# add deb to freight
|
||||||
add_debs_dir_to_freight()
|
package_name = os.path.basename(debian_package_path)
|
||||||
|
add_deb_to_freight(package_name=package_name, package_path=debian_package_path)
|
||||||
|
|
||||||
|
# update freight cache
|
||||||
|
update_freight_cache()
|
||||||
|
|
||||||
|
|
||||||
def build_packages(default_branch=False):
|
def build_packages(default_branch=False):
|
||||||
|
|
|
@ -31,4 +31,5 @@ SERVICES = [
|
||||||
{"name": "peach-probe", "repo_url": "https://github.com/peachcloud/peach-probe.git"},
|
{"name": "peach-probe", "repo_url": "https://github.com/peachcloud/peach-probe.git"},
|
||||||
{"name": "peach-dyndns-updater", "repo_url": "https://github.com/peachcloud/peach-dyndns-updater.git"},
|
{"name": "peach-dyndns-updater", "repo_url": "https://github.com/peachcloud/peach-dyndns-updater.git"},
|
||||||
{"name": "peach-web", "repo_url": "https://github.com/peachcloud/peach-web.git"},
|
{"name": "peach-web", "repo_url": "https://github.com/peachcloud/peach-web.git"},
|
||||||
|
{"name": "peach-tbot", "repo_url": "https://github.com/peachcloud/peach-tbot.git"},
|
||||||
]
|
]
|
Loading…
Reference in New Issue