Help us shape the future of Go! Take the 2026 Go Developer Survey

cicd

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. * * This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.

* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. * * This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.

* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. * * This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ASTNode

type ASTNode struct {
	Type     string    `json:"type"`               // Node type from tree-sitter
	Value    string    `json:"value,omitempty"`    // Text content
	Children []ASTNode `json:"children,omitempty"` // Child nodes
}

ASTNode represents a simplified AST node

type ExpressionMatch

type ExpressionMatch struct {
	Full       string `json:"full"`       // Full match including ${{ }}
	Expression string `json:"expression"` // Just the expression inside
	FullSpan   Span   `json:"full_span"`  // Span of full match
	ExprSpan   Span   `json:"expr_span"`  // Span of expression
}

ExpressionMatch represents a found expression in text

type ParsedArg

type ParsedArg struct {
	Type  string `json:"type"`          // "literal", "expansion", "command_substitution"
	Value string `json:"value"`         // The text content
	Var   string `json:"var,omitempty"` // Variable name if type is expansion
}

ParsedArg represents a command argument

type ParsedCommand

type ParsedCommand struct {
	Type     string          `json:"type"`    // "command", "pipeline", "redirected_statement"
	Command  string          `json:"command"` // Command name (e.g., "echo", "cargo")
	Args     []ParsedArg     `json:"args"`    // Command arguments
	Redirect *ParsedRedirect `json:"redirect,omitempty"`
	Pipeline []ParsedCommand `json:"pipeline,omitempty"`
}

ParsedCommand represents a parsed shell command

type ParsedExpression

type ParsedExpression struct {
	Raw                   string                `json:"raw"`                      // Original expression text
	AST                   ASTNode               `json:"ast,omitempty"`            // Parsed AST
	ParseOK               bool                  `json:"parse_ok"`                 // Whether parsing succeeded
	Error                 error                 `json:"error,omitempty"`          // Parse error if any
	ConstantReducible     bool                  `json:"constant_reducible"`       // Can be evaluated at parse time
	ConstantSubexprs      []ParsedSubExpression `json:"constant_subexprs"`        // Sub-expressions that are constant
	ComputedIndices       []ParsedSubExpression `json:"computed_indices"`         // Dynamic array/object accesses
	HasSecretsExpansion   bool                  `json:"has_secrets_expansion"`    // Uses toJSON(secrets) pattern
	SecretsExpansionNodes []ParsedSubExpression `json:"secrets_expansion_nodes"`  // Nodes with secrets expansion
	HasDynamicSecretKey   bool                  `json:"has_dynamic_secret_key"`   // Uses secrets[variable]
	DynamicSecretKeyNodes []ParsedSubExpression `json:"dynamic_secret_key_nodes"` // Nodes with dynamic secret access
}

ParsedExpression represents a parsed GitHub Actions expression

type ParsedRedirect

type ParsedRedirect struct {
	Operator string    `json:"operator"` // ">>", ">", etc.
	Target   ParsedArg `json:"target"`   // Redirect target
}

ParsedRedirect represents a file redirection

type ParsedRun

type ParsedRun struct {
	Shell    string          `json:"shell"`           // "bash", "pwsh", etc.
	Commands []ParsedCommand `json:"commands"`        // All commands found
	ParseOK  bool            `json:"parse_ok"`        // Whether parsing succeeded
	Error    error           `json:"error,omitempty"` // Parse error if any
}

ParsedRun represents a fully parsed run block

type ParsedSubExpression

type ParsedSubExpression struct {
	Type  string `json:"type"`  // Type of sub-expression
	Value string `json:"value"` // Text value
}

ParsedSubExpression represents a sub-expression in the AST

type Parser

type Parser struct{}

Parser defines a parser type

func (*Parser) GetCommentToken

func (p *Parser) GetCommentToken() string

GetCommentToken return the comment token of YAML - #

func (*Parser) GetKind

func (p *Parser) GetKind() model.FileKind

GetKind returns YAML constant kind

func (*Parser) Parse

func (p *Parser) Parse(ctx context.Context, fileContent []byte, filePath string,
	resolveReferences bool, maxResolverDepth int) (
	resolved []byte,
	documents []model.Document,
	ignoreLines []int,
	resolvedFiles map[string]model.ResolvedFile,
	err error)

Parse parses yaml/yml file and returns it as a Document

func (*Parser) StringifyContent

func (p *Parser) StringifyContent(content []byte) (string, error)

StringifyContent converts original content into string formatted version

func (*Parser) SupportedExtensions

func (p *Parser) SupportedExtensions() []string

SupportedExtensions returns extensions supported by this parser, which are yaml and yml extension

func (*Parser) SupportedTypes

func (p *Parser) SupportedTypes() map[string]bool

SupportedTypes returns types supported by this parser, which are ansible, cloudFormation, k8s

type Span

type Span struct {
	Start int `json:"start"`
	End   int `json:"end"`
}

Span represents a text span

Jump to

Keyboard shortcuts

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