1. Packages
  2. Buildkite
  3. API Docs
  4. Pipeline
  5. getTemplate
Buildkite v3.1.6 published on Wednesday, Apr 3, 2024 by Pulumiverse

buildkite.Pipeline.getTemplate

Explore with Pulumi AI

buildkite logo
Buildkite v3.1.6 published on Wednesday, Apr 3, 2024 by Pulumiverse

    Use this data source to retrieve a pipeline template by its ID or name.

    More information on pipeline templates can be found in the documentation.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as buildkite from "@pulumi/buildkite";
    import * as buildkite from "@pulumiverse/buildkite";
    
    const repository = "git@github.com:my-org/my-repo.git";
    const devTemplate = buildkite.Pipeline.getTemplate({
        id: buildkite_pipeline_template.template_dev.id,
    });
    const frontendTemplate = buildkite.Pipeline.getTemplate({
        name: "Frontend app template",
    });
    const apiv2Dev = new buildkite.pipeline.Pipeline("apiv2Dev", {
        repository: repository,
        pipelineTemplateId: devTemplate.then(devTemplate => devTemplate.id),
    });
    const frontend = new buildkite.pipeline.Pipeline("frontend", {
        repository: repository,
        pipelineTemplateId: frontendTemplate.then(frontendTemplate => frontendTemplate.id),
    });
    
    import pulumi
    import pulumi_buildkite as buildkite
    import pulumiverse_buildkite as buildkite
    
    repository = "git@github.com:my-org/my-repo.git"
    dev_template = buildkite.Pipeline.get_template(id=buildkite_pipeline_template["template_dev"]["id"])
    frontend_template = buildkite.Pipeline.get_template(name="Frontend app template")
    apiv2_dev = buildkite.pipeline.Pipeline("apiv2Dev",
        repository=repository,
        pipeline_template_id=dev_template.id)
    frontend = buildkite.pipeline.Pipeline("frontend",
        repository=repository,
        pipeline_template_id=frontend_template.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-buildkite/sdk/v3/go/buildkite/Pipeline"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		repository := "git@github.com:my-org/my-repo.git"
    		devTemplate, err := Pipeline.GetTemplate(ctx, &pipeline.GetTemplateArgs{
    			Id: pulumi.StringRef(buildkite_pipeline_template.Template_dev.Id),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		frontendTemplate, err := Pipeline.GetTemplate(ctx, &pipeline.GetTemplateArgs{
    			Name: pulumi.StringRef("Frontend app template"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = Pipeline.NewPipeline(ctx, "apiv2Dev", &Pipeline.PipelineArgs{
    			Repository:         pulumi.String(repository),
    			PipelineTemplateId: *pulumi.String(devTemplate.Id),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = Pipeline.NewPipeline(ctx, "frontend", &Pipeline.PipelineArgs{
    			Repository:         pulumi.String(repository),
    			PipelineTemplateId: *pulumi.String(frontendTemplate.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Buildkite = Pulumi.Buildkite;
    using Buildkite = Pulumiverse.Buildkite;
    
    return await Deployment.RunAsync(() => 
    {
        var repository = "git@github.com:my-org/my-repo.git";
    
        var devTemplate = Buildkite.Pipeline.GetTemplate.Invoke(new()
        {
            Id = buildkite_pipeline_template.Template_dev.Id,
        });
    
        var frontendTemplate = Buildkite.Pipeline.GetTemplate.Invoke(new()
        {
            Name = "Frontend app template",
        });
    
        var apiv2Dev = new Buildkite.Pipeline.Pipeline("apiv2Dev", new()
        {
            Repository = repository,
            PipelineTemplateId = devTemplate.Apply(getTemplateResult => getTemplateResult.Id),
        });
    
        var frontend = new Buildkite.Pipeline.Pipeline("frontend", new()
        {
            Repository = repository,
            PipelineTemplateId = frontendTemplate.Apply(getTemplateResult => getTemplateResult.Id),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.buildkite.Pipeline.PipelineFunctions;
    import com.pulumi.buildkite.Pipeline.inputs.GetTemplateArgs;
    import com.pulumi.buildkite.Pipeline.Pipeline;
    import com.pulumi.buildkite.Pipeline.PipelineArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var repository = "git@github.com:my-org/my-repo.git";
    
            final var devTemplate = PipelineFunctions.getTemplate(GetTemplateArgs.builder()
                .id(buildkite_pipeline_template.template_dev().id())
                .build());
    
            final var frontendTemplate = PipelineFunctions.getTemplate(GetTemplateArgs.builder()
                .name("Frontend app template")
                .build());
    
            var apiv2Dev = new Pipeline("apiv2Dev", PipelineArgs.builder()        
                .repository(repository)
                .pipelineTemplateId(devTemplate.applyValue(getTemplateResult -> getTemplateResult.id()))
                .build());
    
            var frontend = new Pipeline("frontend", PipelineArgs.builder()        
                .repository(repository)
                .pipelineTemplateId(frontendTemplate.applyValue(getTemplateResult -> getTemplateResult.id()))
                .build());
    
        }
    }
    
    resources:
      apiv2Dev:
        type: buildkite:Pipeline:Pipeline
        properties:
          repository: ${repository}
          pipelineTemplateId: ${devTemplate.id}
      frontend:
        type: buildkite:Pipeline:Pipeline
        properties:
          repository: ${repository}
          pipelineTemplateId: ${frontendTemplate.id}
    variables:
      repository: git@github.com:my-org/my-repo.git
      devTemplate:
        fn::invoke:
          Function: buildkite:Pipeline:getTemplate
          Arguments:
            id: ${buildkite_pipeline_template.template_dev.id}
      frontendTemplate:
        fn::invoke:
          Function: buildkite:Pipeline:getTemplate
          Arguments:
            name: Frontend app template
    

    Using getTemplate

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getTemplate(args: GetTemplateArgs, opts?: InvokeOptions): Promise<GetTemplateResult>
    function getTemplateOutput(args: GetTemplateOutputArgs, opts?: InvokeOptions): Output<GetTemplateResult>
    def get_template(id: Optional[str] = None,
                     name: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetTemplateResult
    def get_template_output(id: Optional[pulumi.Input[str]] = None,
                     name: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetTemplateResult]
    func GetTemplate(ctx *Context, args *GetTemplateArgs, opts ...InvokeOption) (*GetTemplateResult, error)
    func GetTemplateOutput(ctx *Context, args *GetTemplateOutputArgs, opts ...InvokeOption) GetTemplateResultOutput

    > Note: This function is named GetTemplate in the Go SDK.

    public static class GetTemplate 
    {
        public static Task<GetTemplateResult> InvokeAsync(GetTemplateArgs args, InvokeOptions? opts = null)
        public static Output<GetTemplateResult> Invoke(GetTemplateInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetTemplateResult> getTemplate(GetTemplateArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: buildkite:Pipeline/getTemplate:getTemplate
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    The GraphQL ID of the pipeline template.
    Name string
    The name of the pipeline template.
    Id string
    The GraphQL ID of the pipeline template.
    Name string
    The name of the pipeline template.
    id String
    The GraphQL ID of the pipeline template.
    name String
    The name of the pipeline template.
    id string
    The GraphQL ID of the pipeline template.
    name string
    The name of the pipeline template.
    id str
    The GraphQL ID of the pipeline template.
    name str
    The name of the pipeline template.
    id String
    The GraphQL ID of the pipeline template.
    name String
    The name of the pipeline template.

    getTemplate Result

    The following output properties are available:

    Available bool
    If the pipeline template is available for assignment by non admin users.
    Configuration string
    The YAML step configuration for the pipeline template.
    Description string
    The description for the pipeline template.
    Id string
    The GraphQL ID of the pipeline template.
    Name string
    The name of the pipeline template.
    Uuid string
    The UUID of the pipeline template.
    Available bool
    If the pipeline template is available for assignment by non admin users.
    Configuration string
    The YAML step configuration for the pipeline template.
    Description string
    The description for the pipeline template.
    Id string
    The GraphQL ID of the pipeline template.
    Name string
    The name of the pipeline template.
    Uuid string
    The UUID of the pipeline template.
    available Boolean
    If the pipeline template is available for assignment by non admin users.
    configuration String
    The YAML step configuration for the pipeline template.
    description String
    The description for the pipeline template.
    id String
    The GraphQL ID of the pipeline template.
    name String
    The name of the pipeline template.
    uuid String
    The UUID of the pipeline template.
    available boolean
    If the pipeline template is available for assignment by non admin users.
    configuration string
    The YAML step configuration for the pipeline template.
    description string
    The description for the pipeline template.
    id string
    The GraphQL ID of the pipeline template.
    name string
    The name of the pipeline template.
    uuid string
    The UUID of the pipeline template.
    available bool
    If the pipeline template is available for assignment by non admin users.
    configuration str
    The YAML step configuration for the pipeline template.
    description str
    The description for the pipeline template.
    id str
    The GraphQL ID of the pipeline template.
    name str
    The name of the pipeline template.
    uuid str
    The UUID of the pipeline template.
    available Boolean
    If the pipeline template is available for assignment by non admin users.
    configuration String
    The YAML step configuration for the pipeline template.
    description String
    The description for the pipeline template.
    id String
    The GraphQL ID of the pipeline template.
    name String
    The name of the pipeline template.
    uuid String
    The UUID of the pipeline template.

    Package Details

    Repository
    buildkite pulumiverse/pulumi-buildkite
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the buildkite Terraform Provider.
    buildkite logo
    Buildkite v3.1.6 published on Wednesday, Apr 3, 2024 by Pulumiverse