public override void Execute(PipelineHistoryCreatedArgs args)
        {
            Console.WriteLine($"PipelineRun:{args.Id} is being Created in background");

            var diagram     = Digram.CreateInstance(args.Diagram);
            var pipelineRun = new PipelineRun(args.Id.ToString(), "ci-nebula");

            foreach (var node in diagram.NodeList)
            {
                var @params        = new List <Param>();
                var inputResources = new List <PipelineTaskInputResource>();
                var runAfter       = new List <string>();
                node.Property?.Params.ForEach(r => @params.Add(new Param(r.Name, r.Value)));
                node.Property?.Resources?.Inputs.ForEach(r => inputResources.Add(new PipelineTaskInputResource(r.Name, r.Resource)));
                node.Source.ForEach(r => runAfter.Add(r));
                pipelineRun.AddTask(node.Id, node.Name, @params, inputResources, runAfter);
            }
            _pipelineHistoryService.Create(pipelineRun);

            Console.WriteLine($"PipelineRun:{args.Id} is Created in background");

            //_pipelineHistoryStatusCheckerWorker.AddPipelineHistoryId(args.Id);
            _pipelineHistoryStatusCheckerWorker.PipelineHistoryCreatedQueue.Enqueue(args.Id);

            Console.WriteLine($"PipelineRun:{args.Id} status check id added to background");
        }
Пример #2
0
        public void Create(PipelineRun pipelineRun)
        {
            var pvc = CreatePVC(pipelineRun.Metadata.Name, pipelineRun.Metadata.Namespace);

            _client.CreateNamespacedPersistentVolumeClaim(pvc, pipelineRun.Metadata.Namespace);

            JsonSerializerSettings jss = new JsonSerializerSettings();

            jss.NullValueHandling = NullValueHandling.Ignore;
            jss.Formatting        = Formatting.Indented;
            jss.ContractResolver  = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver();

            var pr = JObject.Parse(JsonConvert.SerializeObject(pipelineRun, Formatting.None, jss));

            _client.CreateNamespacedCustomObject(pr, "tekton.dev", "v1beta1", pipelineRun.Metadata.Namespace, "pipelineruns");
        }