Example #1
0
        protected virtual JenkinsPipelineStage GetStage(ExecutableTarget executableTarget, IReadOnlyDictionary <string, JenkinsPipelineAgent> registeredAgents)
        {
            IEnumerable <string> artifactProduct       = executableTarget.GetArtifactProducts().ToArray();
            IEnumerable <JenkinsPipelineStash> stashes = artifactProduct
                                                         .Select((v, i) => GetStash(executableTarget, v))
                                                         .OrderBy(s => s.Name);

            IEnumerable <(Target, string[])>     artifactDependencies = ArtifactExtensionsAccessor.ArtifactDependencies[executableTarget.GetDefinition()].ToArray();
            IEnumerable <JenkinsPipelineUnstash> unstashes            = artifactDependencies
                                                                        .SelectMany(d => GetUnstashesFromDependency(executableTarget, d.Item1, d.Item2))
                                                                        .OrderBy(s => s.Name)
                                                                        .Prepend(new JenkinsPipelineUnstash
            {
                Name = "source",
            });

            JenkinsPipelineAgent agent = GetAgent(executableTarget, registeredAgents);

            return(new JenkinsPipelineStage
            {
                Name = executableTarget.Name,
                InvokedTarget = executableTarget.Name,
                Agent = agent,
                Stashes = stashes.ToArray(),
                Unstashes = unstashes.ToArray(),
            });
        }
 public static IEnumerable <string> GetArtifactProducts(this ExecutableTarget executableTarget)
 {
     return(ArtifactExtensionsAccessor.ArtifactProducts[executableTarget.GetDefinition()]);
 }
Example #3
0
 public static IEnumerable <string> GetAgents(this ExecutableTarget executableTarget)
 {
     return(Agents[executableTarget.GetDefinition()]);
 }