
package cn.orionsec.ops.task.impl;

import cn.orionsec.kit.lang.utils.time.Dates;
import cn.orionsec.kit.spring.SpringHolder;
import cn.orionsec.ops.service.api.ApplicationPipelineTaskService;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class PipelineTaskImpl implements Runnable {

    protected static ApplicationPipelineTaskService applicationPipelineTaskService = SpringHolder.getBean(ApplicationPipelineTaskService.class);

    private final Long pipelineRecordId;

    public PipelineTaskImpl(Long pipelineRecordId) {
        this.pipelineRecordId = pipelineRecordId;
    }

    @Override
    public void run() {
        log.info("定时执行流水线任务-触发 releaseId: {}, time: {}", pipelineRecordId, Dates.current());
        applicationPipelineTaskService.execPipeline(pipelineRecordId, true);
    }

}
