Esempio n. 1
0
            public RunnableJob(IPipelineRunManager pipelineRunManager, BuildJob job, IDictionary <BuildJob, IJobStatus> jobMap)
            {
                BuildTask = job.Task;
                Status    = new JobStatus(pipelineRunManager.BuildPath(job), job);

                var inputHandlers = new List <(BuildInputHandler handler, string path)>();

                foreach (var input in job.Input)
                {
                    var handler = input.Source switch {
                        GitBuildInput git => HandleGitInput(pipelineRunManager, git),
                        HttpRequestBuildInput http => HandleHttpInput(pipelineRunManager, http),
                        ArtifactBuildInput artifact => HandleArtifactInput(artifact, jobMap[artifact.Job]),
                        _ => throw new Exception("Unknown build input type")
                    };

                    inputHandlers.Add((handler, input.Path));
                }
                this.inputHandlers = inputHandlers;
            }
Esempio n. 2
0
            private static BuildInputHandler HandleHttpInput(IPipelineRunManager pipelineRunManager, HttpRequestBuildInput http) => async cancellationToken => {
                var tempFile = pipelineRunManager.NextInputPath();

                await HttpUtil.FetchFileValidate(http.Url, tempFile, http.Hash.Validate);

                return(tempFile);
            };