Skip to content

Commit

Permalink
buildmaster/tools: check for confdir, error on missing. Add tools to …
Browse files Browse the repository at this point in the history
…path
  • Loading branch information
kallisti5 committed Oct 14, 2021
1 parent cf89615 commit 01f0371
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
7 changes: 6 additions & 1 deletion buildmaster/bin/builderctl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2016-2017 Haiku, Inc. All rights reserved.
# Copyright 2016-2021 Haiku, Inc. All rights reserved.
# Distributed under the terms of the MIT License.
#
# Authors:
Expand Down Expand Up @@ -159,6 +159,11 @@ parser.add_argument('-C', '--confdir', help='Builder config directory on local m
parser.add_argument('action', help='[ health | provision | reboot ]')
args = parser.parse_args()

if not os.path.isdir(args.confdir):
print("Error: Builder inventory not found!")
print("Please change to haikuports directory before running this tool (or pass --confdir)!")
sys.exit()

if args.action == "health":
cluster_health(args)
elif args.action == "provision":
Expand Down
8 changes: 7 additions & 1 deletion buildmaster/bin/builderssh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2016-2017 Haiku, Inc. All rights reserved.
# Copyright 2016-2021 Haiku, Inc. All rights reserved.
# Distributed under the terms of the MIT License.
#
# Authors:
Expand Down Expand Up @@ -49,4 +49,10 @@ parser = argparse.ArgumentParser(description='Open SSH connection to builder')
parser.add_argument('-C', '--confdir', help='Builder config directory on local machine', required=False, default=os.path.join(os.getcwd(), "buildmaster/builders"))
parser.add_argument('buildername', help='Name of builder')
args = parser.parse_args()

if not os.path.isdir(args.confdir):
print("Error: Builder inventory not found!");
print("Please change to haikuports directory before running this tool (or pass --confdir)!")
sys.exit()

launch_ssh(args)
7 changes: 6 additions & 1 deletion buildmaster/bin/createbuilder
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016-2017 Haiku, Inc. All rights reserved.
# Copyright 2016-2021 Haiku, Inc. All rights reserved.
# Distributed under the terms of the MIT License.
#
# Authors:
Expand All @@ -25,6 +25,11 @@ parser.add_argument('-f', '--force', help='Force overwrite of existing builder',
parser.add_argument('-w', '--workdir', help='Haikuports path on remote builder', required=False, default="/boot/home/haikuports")
args = parser.parse_args()

if not os.path.isdir(args.confdir):
print("Error: Builder inventory not found!")
print("Please change to haikuports directory before running this tool (or pass --confdir)!")
sys.exit()

if not os.path.isdir(args.confdir):
os.mkdir(args.confdir, 0755)

Expand Down
1 change: 1 addition & 0 deletions buildmaster/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN apt-get update \
&& apt-get clean

RUN mkdir /var/sources /var/buildmaster
RUN echo 'export PATH=$PATH:/var/sources/haikuporter/buildmaster/bin/' >> /etc/bash.bashrc

VOLUME ["/var/sources", "/var/buildmaster"]

Expand Down
4 changes: 4 additions & 0 deletions buildmaster/docker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default:
docker build --no-cache --tag docker.io/haikuporter/buildmaster:1.2.5 .
push:
docker push docker.io/haikuporter/buildmaster:1.2.5

0 comments on commit 01f0371

Please sign in to comment.