parser

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BakeSchema = &schema.BodySchema{
	Blocks: map[string]*schema.BlockSchema{
		"group": {
			Labels: []*schema.LabelSchema{
				{
					Name: "groupName",
				},
			},
			Body: &schema.BodySchema{
				Attributes: map[string]*schema.AttributeSchema{
					"name": {
						IsOptional: true,
						Constraint: schema.LiteralType{Type: cty.String},
					},
					"description": {
						IsOptional: true,
						Constraint: schema.LiteralType{Type: cty.String},
					},
					"targets": {
						IsOptional: true,
						Constraint: schema.List{Elem: schema.AnyExpression{OfType: cty.String}},
					},
				},
			},
		},
		"variable": {
			Labels: []*schema.LabelSchema{
				{
					Name: "variableName",
				},
			},
			Body: &schema.BodySchema{
				Attributes: map[string]*schema.AttributeSchema{
					"default": {
						IsOptional: true,
						Constraint: schema.OneOf{
							schema.AnyExpression{OfType: cty.Bool},
							schema.AnyExpression{OfType: cty.Number},
							schema.AnyExpression{OfType: cty.String},
							schema.AnyExpression{OfType: cty.List(cty.Bool)},
							schema.AnyExpression{OfType: cty.List(cty.Number)},
							schema.AnyExpression{OfType: cty.List(cty.String)},
						},
					},
				},
				Blocks: map[string]*schema.BlockSchema{
					"validation": {
						Body: &schema.BodySchema{
							Attributes: map[string]*schema.AttributeSchema{
								"condition": {
									IsOptional: false,
									Constraint: schema.AnyExpression{OfType: cty.Bool},
								},
								"error_message": {
									IsOptional: true,
									Constraint: schema.AnyExpression{OfType: cty.String},
								},
							},
						},
					},
				},
			},
		},
		"function": {
			Labels: []*schema.LabelSchema{
				{
					Name: "functionName",
				},
			},
			Body: &schema.BodySchema{
				Attributes: map[string]*schema.AttributeSchema{
					"params": {
						IsOptional: false,
						Constraint: schema.Map{Elem: schema.LiteralType{Type: cty.String}},
					},
					"variadic_param": {
						IsOptional: true,
						Constraint: schema.LiteralType{Type: cty.String},
					},
					"result": {
						IsOptional: false,
						Constraint: schema.LiteralType{Type: cty.String},
					},
				},
			},
		},
		"target": {
			Description: lang.MarkupContent{
				Value: "A target reflects a single `docker build` invocation.",
				Kind:  lang.MarkdownKind,
			},
			Labels: []*schema.LabelSchema{
				{
					Name: "targetName",
				},
			},
			Body: &schema.BodySchema{
				Attributes: map[string]*schema.AttributeSchema{
					"args": {
						IsOptional: true,
						Constraint: schema.Map{Elem: schema.LiteralType{Type: cty.String}},
						Description: lang.MarkupContent{
							Value: "Use the `args` attribute to define build arguments for the target. This has the same effect as passing a [`--build-arg`](https://docs.docker.com/reference/cli/docker/buildx/build/#build-arg) flag to the build command.",
							Kind:  lang.MarkdownKind,
						},
					},
					"annotations": {
						IsOptional: true,
						Constraint: schema.List{Elem: schema.AnyExpression{OfType: cty.String}},
					},
					"attest": {
						IsOptional: true,
						Constraint: schema.List{Elem: schema.AnyExpression{OfType: cty.String}},
					},
					"cache-from": {
						IsOptional: true,
						Constraint: schema.List{Elem: schema.AnyExpression{OfType: cty.String}},
					},
					"cache-to": {
						IsOptional: true,
						Constraint: schema.List{Elem: schema.AnyExpression{OfType: cty.String}},
					},
					"call": {
						IsOptional: true,
						Constraint: schema.AnyExpression{OfType: cty.String},
					},
					"context": {
						IsOptional: true,
						Constraint: schema.AnyExpression{OfType: cty.String},
					},
					"contexts": {
						IsOptional: true,
						Constraint: schema.Map{Elem: schema.LiteralType{Type: cty.String}},
					},
					"description": {
						IsOptional: true,
						Constraint: schema.AnyExpression{OfType: cty.String},
					},
					"dockerfile-inline": {
						IsOptional: true,
						Constraint: schema.AnyExpression{OfType: cty.String},
					},
					"dockerfile": {
						IsOptional: true,
						Constraint: schema.AnyExpression{OfType: cty.String},
					},
					"entitlements": {
						IsOptional: true,
						Constraint: schema.List{Elem: schema.OneOf{
							schema.LiteralValue{Value: cty.StringVal("network.host")},
							schema.LiteralValue{Value: cty.StringVal("security.insecure")},
						}},
					},
					"inherits": {
						IsOptional: true,
						Constraint: schema.List{Elem: schema.AnyExpression{OfType: cty.String}},
					},
					"labels": {
						IsOptional: true,
						Constraint: schema.Map{Elem: schema.LiteralType{Type: cty.String}},
					},
					"matrix": {
						IsOptional: true,
						Constraint: schema.Map{Elem: schema.List{Elem: schema.LiteralType{Type: cty.String}}},
					},
					"name": {
						IsOptional: true,
						Constraint: schema.AnyExpression{OfType: cty.String},
					},
					"network": {
						IsOptional: true,
						Constraint: schema.OneOf{
							schema.LiteralValue{Value: cty.StringVal("default")},
							schema.LiteralValue{Value: cty.StringVal("host")},
							schema.LiteralValue{Value: cty.StringVal("none")},
						},
					},
					"no-cache-filter": {
						IsOptional: true,
						Constraint: schema.List{Elem: schema.AnyExpression{OfType: cty.String}},
					},
					"no-cache": {
						IsOptional: true,
						Constraint: schema.LiteralType{Type: cty.Number},
					},
					"output": {
						IsOptional: true,
						Constraint: schema.List{Elem: schema.AnyExpression{OfType: cty.String}},
					},
					"platforms": {
						IsOptional: true,
						Constraint: schema.List{Elem: schema.AnyExpression{OfType: cty.String}},
					},
					"pull": {
						IsOptional: true,
						Constraint: schema.LiteralType{Type: cty.Bool},
					},
					"secret": {
						IsOptional: true,
						Constraint: schema.List{Elem: schema.AnyExpression{OfType: cty.String}},
					},
					"shm-size": {
						IsOptional: true,
						Constraint: schema.AnyExpression{OfType: cty.String},
					},
					"ssh": {
						IsOptional: true,
						Constraint: schema.List{Elem: schema.AnyExpression{OfType: cty.String}},
					},
					"tags": {
						IsOptional: true,
						Constraint: schema.List{Elem: schema.AnyExpression{OfType: cty.String}},
					},
					"target": {
						IsOptional: true,
						Constraint: schema.AnyExpression{OfType: cty.String},
						Description: lang.MarkupContent{
							Value: "Set the target build stage to build. This is the same as the [`--target flag`](https://docs.docker.com/reference/cli/docker/image/build/#target).",
							Kind:  lang.MarkdownKind,
						},
					},
					"ulimits": {
						IsOptional: true,
						Constraint: schema.List{Elem: schema.AnyExpression{OfType: cty.String}},
					},
				},
			},
		},
	},
}

Functions

func ConvertToHCLPosition

func ConvertToHCLPosition(content string, line, column int) hcl.Pos

Types

type PathReaderImpl

type PathReaderImpl struct {
	File     *hcl.File
	Filename string
}

func (*PathReaderImpl) PathContext

func (r *PathReaderImpl) PathContext(path lang.Path) (*decoder.PathContext, error)

func (*PathReaderImpl) Paths

func (r *PathReaderImpl) Paths(ctx context.Context) []lang.Path

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL