Skip to content

Commit

Permalink
Merge pull request compiler-explorer#359 from compiler-explorer/cecon…
Browse files Browse the repository at this point in the history
…anaccess

Conan Instance commands
  • Loading branch information
partouf authored Jul 7, 2020
2 parents b59f84f + f3dac74 commit 90f1fc1
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
35 changes: 34 additions & 1 deletion bin/lib/ce.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
get_autoscaling_groups_for, download_release_file, download_release_fileobj, log_new_build, list_all_build_logs, \
list_period_build_logs, get_ssm_param
from lib.cdn import DeploymentJob
from lib.instance import AdminInstance, BuilderInstance, Instance, print_instances
from lib.instance import ConanInstance, AdminInstance, BuilderInstance, Instance, print_instances
from lib.ssh import run_remote_shell, exec_remote, exec_remote_all, exec_remote_to_stdout

logger = logging.getLogger('ce')
Expand Down Expand Up @@ -193,6 +193,30 @@ def admin_cmd(args):
run_remote_shell(args, AdminInstance.instance())


def conan_cmd(args):
dispatch_global('conan', args)


def conan_login_cmd(args):
instance = ConanInstance.instance()
run_remote_shell(args, instance)


def conan_exec_cmd(args):
instance = ConanInstance.instance()
exec_remote_to_stdout(instance, args['remote_cmd'])


def conan_restart_cmd(_):
instance = ConanInstance.instance()
exec_remote(instance, ["sudo", "service", "ce-conan", "restart"])


def conan_reloadwww_cmd(_):
instance = ConanInstance.instance()
exec_remote(instance, ["sudo", "git", "-C", "/home/ubuntu/ceconan/conanproxy", "pull"])


def builder_cmd(args):
dispatch_global('builder', args)

Expand Down Expand Up @@ -787,6 +811,15 @@ def main():
builder_exec = builder_sub.add_parser('exec')
builder_exec.add_argument('remote_cmd', nargs='+', help='command to run on builder node')

conan_parser = subparsers.add_parser('conan')
conan_sub = add_required_sub_parsers(conan_parser, 'conan_sub')
conan_sub.required = True
conan_sub.add_parser('restart')
conan_sub.add_parser('reloadwww')
conan_sub.add_parser('login')
conan_exec = conan_sub.add_parser('exec')
conan_exec.add_argument('remote_cmd', nargs='+', help='command to run on conan node')

builds_parser = subparsers.add_parser('builds')
builds_sub = add_required_sub_parsers(builds_parser, 'builds_sub')
list_parser = builds_sub.add_parser('list')
Expand Down
10 changes: 10 additions & 0 deletions bin/lib/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ def __init__(self, instance):
def instance():
return AdminInstance(ec2.Instance(id='i-0988cd194a4a8a2c0'))

class ConanInstance:
def __init__(self, instance):
self.instance = instance
self.elb_health = 'unknown'
self.service_status = {'SubState': 'unknown'}
self.running_version = 'conan'

@staticmethod
def instance():
return ConanInstance(ec2.Instance(id='i-0fbc4d84c0f7994a2'))

class BuilderInstance:
def __init__(self, instance):
Expand Down

0 comments on commit 90f1fc1

Please sign in to comment.