Skip to content

Pass parameters into a pipeline #571

@roberttriggs

Description

@roberttriggs

Hi,
I am really interested in this library, looking for some guidance on running mutliple pipelines with run specific parameters - my use case requires the same pipeline to run multiple times based on specific run parameters (e.q. from build queue to produce a pipeline run per customer)
so the pipeline steps are the same but passing in build parameters to make the run specific to the customer based on their build Params (these params are accessed in the modules).

At the moment I am created a new pipeline each time via a createPipeLine method:

  private static PipelineHostBuilder CreateuildPipeline(BuildParameters parameters)
  {
      var pipeline = PipelineHostBuilder.Create()
                      .ConfigureAppConfiguration((context, builder) =>
                      {
                          builder.AddJsonFile("appsettings.json")
                              .AddUserSecrets<Program>()
                              .AddEnvironmentVariables();
                      }).ConfigureServices((context, collection) =>
                      {
                          collection.Configure<SiteBuildRequest>(_ => GetSiteBuildRequest(parameters));
                      });
      pipeline.AddModule<FirstStepModule>();

      return pipeline;
  }

then execute each create pipeline

await pipeline.ExecutePipelineAsync();

Would this be the best way? (Not yet tried to see happens if I try to execute more than one concurrently yet and whether there is any issue having multiple instances of the pipeline host? (also can you confirm if multiple instances of the same pipeline would be ok?)

I wondered if there could be a way like having a version of ExecutePipeline that allows a parameters class to be passed in but the underlying pipeline is the same each time.
something like:
await pipeline.ExecutePipelineAsync(buildParameters)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions