import pipes import shutil import threading import fileinput from utils.shell import Executer as shell from utils.docker import DockerfileItem from clients.region import RegionAPI from clients.region_api import RegionBackAPI from clients.acp_api import ACPAPI from clients.userconsole import UserConsoleAPI load_dict = {} with open("plugins/config.json", 'r') as load_f: load_dict = json.load(load_f) logging.config.dictConfig(settings.get_logging(load_dict)) logger = logging.getLogger('default') reload(sys) sys.setdefaultencoding('utf-8') TENANT_DIR = '/grdata/build/tenant/{tenantId}' SOURCE_DIR = '/cache/build/{tenantId}' + '/' + 'source/{serviceId}' TGZ_DIR = TENANT_DIR + '/' + 'slug/{serviceId}' CACHE_DIR = '/cache/build/{tenantId}' + '/' + 'cache/{serviceId}' BUILD_LOG_DIR = '/grdata/logs/{tenantId}/{serviceId}/' CLONE_TIMEOUT = 180 REGISTRY_DOMAIN = 'goodrain.me' MAX_BUILD_TASK = 5
import sys from clients.region import RegionAPI from clients.userconsole import UserConsoleAPI from clients.region_api import RegionBackAPI from utils.shell import Executer from clients.etcdcli import TaskLocker from utils.log import EventLog import logging import logging.config from etc import settings import fileinput load_dict = {} with open("plugins/config.json", 'r') as load_f: load_dict = json.load(load_f) logging.config.dictConfig(settings.get_logging(load_dict)) logger = logging.getLogger('default') class CodeCheck(): watching_topics = ('service_event_msg', ) required_configs = ('region', 'userconsole', 'etcd.lock') def __init__(self, job, *args, **kwargs): self.job = job self.configs = kwargs.get("config") self.user_cs_client = UserConsoleAPI(conf=self.configs['userconsole']) self.region_client = RegionBackAPI() task = json.loads(self.job.body) self.base_dir = kwargs.get('base_dir') for k in ('tenant_id', 'service_id', 'action'):