model

package
v0.0.0-...-7426b64 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OperationAdded Operation = iota
	OperationRemoved
	OperationUpdated

	// BuildPlan statuses
	Planning  = "PLANNING"
	Planned   = "PLANNED"
	Started   = "STARTED"
	Completed = "COMPLETED"

	// Artifact statuses
	ArtifactNotSubmitted      = "NOT_SUBMITTED"
	ArtifactBlocked           = "BLOCKED"
	ArtifactFailedPermanently = "FAILED_PERMANENTLY"
	ArtifactFailedTransiently = "FAILED_TRANSIENTLY"
	ArtifactReady             = "READY"
	ArtifactSkipped           = "SKIPPED"
	ArtifactStarted           = "STARTED"
	ArtifactSucceeded         = "SUCCEEDED"

	// Tag types
	TagSource     = "src"
	TagDependency = "deps"
	TagBuilder    = "builder"
	TagOrphan     = "orphans"

	// BuildLogID types
	BuildLogRecipeID = "RECIPE_ID"
	BuildRequestID   = "BUILD_REQUEST_ID"

	// Version Comparators
	ComparatorEQ  = "eq"
	ComparatorGT  = "gt"
	ComparatorGTE = "gte"
	ComparatorLT  = "lt"
	ComparatorLTE = "lte"
	ComparatorNE  = "ne"

	// Version Requirement keys
	VersionRequirementComparatorKey = "comparator"
	VersionRequirementVersionKey    = "version"

	// MIME types
	XArtifactMimeType            = "application/x.artifact"
	XActiveStateArtifactMimeType = "application/x-activestate-artifacts"
	XCamelInstallerMimeType      = "application/x-camel-installer"
	XGozipInstallerMimeType      = "application/x-gozip-installer"
	XActiveStateBuilderMimeType  = "application/x-activestate-builder"

	// RevertCommit strategies
	RevertCommitStrategyForce   = "Force"
	RevertCommitStrategyDefault = "Default"

	// MergeCommit strategies
	MergeCommitStrategyRecursive                    MergeStrategy = "Recursive"
	MergeCommitStrategyRecursiveOverwriteOnConflict MergeStrategy = "RecursiveOverwriteOnConflict"
	MergeCommitStrategyRecursiveKeepOnConflict      MergeStrategy = "RecursiveKeepOnConflict"
	MergeCommitStrategyFastForward                  MergeStrategy = "FastForward"

	// Error types
	ErrorType                         = "Error"
	NotFoundErrorType                 = "NotFound"
	ParseErrorType                    = "ParseError"
	AlreadyExistsErrorType            = "AlreadyExists"
	NoChangeSinceLastCommitErrorType  = "NoChangeSinceLastCommit"
	HeadOnBranchMovedErrorType        = "HeadOnBranchMoved"
	ForbiddenErrorType                = "Forbidden"
	GenericSolveErrorType             = "GenericSolveError"
	RemediableSolveErrorType          = "RemediableSolveError"
	PlanningErrorType                 = "PlanningError"
	MergeConflictType                 = "MergeConflict"
	FastForwardErrorType              = "FastForwardError"
	NoCommonBaseFoundType             = "NoCommonBaseFound"
	ValidationErrorType               = "ValidationError"
	MergeConflictErrorType            = "MergeConflict"
	RevertConflictErrorType           = "RevertConflict"
	CommitNotInTargetHistoryErrorType = "CommitNotInTargetHistory"
	ComitHasNoParentErrorType         = "CommitHasNoParent"
)

Variables

This section is empty.

Functions

func IsErrorResponse

func IsErrorResponse(errorType string) bool

func IsStateToolArtifact

func IsStateToolArtifact(mimeType string) bool

func IsSuccessArtifactStatus

func IsSuccessArtifactStatus(status string) bool

func ProcessBuildError

func ProcessBuildError(build *Build, fallbackMessage string) error

func ProcessCommitError

func ProcessCommitError(commit *Commit, fallbackMessage string) error

func ProcessMergedCommitError

func ProcessMergedCommitError(mcErr *mergedCommit, fallbackMessage string) error

func ProcessProjectCreatedError

func ProcessProjectCreatedError(pcErr *projectCreated, fallbackMessage string) error

func ProcessProjectError

func ProcessProjectError(project *Project, fallbackMessage string) error

func ProcessRevertCommitError

func ProcessRevertCommitError(rcErr *revertedCommit, fallbackMessage string) error

Types

type Artifact

type Artifact struct {
	Type                string        `json:"__typename"`
	NodeID              strfmt.UUID   `json:"nodeId"`
	DisplayName         string        `json:"displayName"`
	MimeType            string        `json:"mimeType"`
	GeneratedBy         strfmt.UUID   `json:"generatedBy"`
	RuntimeDependencies []strfmt.UUID `json:"runtimeDependencies"`
	Status              string        `json:"status"`
	URL                 string        `json:"url"`
	LogURL              string        `json:"logURL"`
	Checksum            string        `json:"checksum"`

	// Error fields
	Errors      []string `json:"errors"`
	Attempts    float64  `json:"attempts"`
	NextAttempt string   `json:"nextAttempt"`
}

Artifact represents a downloadable artifact. This artifact may or may not be installable by the State Tool.

type Build

type Build struct {
	Type                 string                 `json:"__typename"`
	BuildPlanID          strfmt.UUID            `json:"buildPlanID"`
	Status               string                 `json:"status"`
	Terminals            []*NamedTarget         `json:"terminals"`
	Artifacts            []*Artifact            `json:"artifacts"`
	Steps                []*Step                `json:"steps"`
	Sources              []*Source              `json:"sources"`
	BuildLogIDs          []*BuildLogID          `json:"buildLogIds"`
	ResolvedRequirements []*ResolvedRequirement `json:"resolvedRequirements"`
	*Error
	*PlanningError
}

Build is a directed acyclic graph. It begins with a set of terminal nodes that resolve to artifacts via a set of steps. The expected format of a build plan is:

{
    "build": {
        "__typename": "BuildReady",
        "buildLogIds": [
            {
                "id": "1f717bf7-3573-5144-834b-75917dd8f60c",
                "type": "RECIPE_ID",
                "platformId": ""
            }
        ],
        "status": "READY",
        "terminals": [
            {
                "tag": "platform:78977bc8-0f32-519d-80f3-9043f059398c",
                "targetIDs": [
                    "311aacc7-a596-59c3-bbc9-cf2340721136",
                    "e02c6998-5357-5bc5-a785-6bd890a4af46"
                ]
            }
        ],
        "sources": [
            {
                "targetID": "6c91bc10-e8e2-50a6-8cca-ebd3f1e3f549",
                "name": "zlib",
                "namespace": "shared",
                "version": "1.2.13"
            },
            ...
        ],
        "steps": [
            {
                "targetID": "ab276a34-0b24-51b5-aacc-7323442f59ad",
                "inputs": [
                    {
                        "tag": "builder",
                        "targetIDs": [
                            "357d394b-6ce6-5385-be81-1754348fe5dd"
                        ]
                    },
                    {
                        "tag": "src",
                        "targetIDs": [
                            "bd5232a0-55de-52bd-ba29-1c58b9072232"
                        ]
                    },
                    {
                        "tag": "deps",
                        "targetIDs": []
                    }
                ],
                "outputs": [
                    "3ca4edd7-7746-55a1-a3cb-15b41b83ae52"
                ]
            },
            ...
        ],
        "artifacts": [
            {
                "__typename": "ArtifactSucceeded",
                "targetID": "7322308b-9789-50eb-b843-446cca78d855",
                "mimeType": "application/x-activestate-builder",
                "generatedBy": "8e5a488c-25b4-54b6-adfb-9d66d60f449f",
                "runtimeDependencies": [
                    "9a02d063-e3b6-5230-8cbe-f8769ced5a06",
                    "f9c838fc-e477-5f39-9cfc-3ffa804b4d53",
                    "b04ea3ed-9632-5e59-a571-201cfc225d36",
                    "2c64301a-9789-5cc3-b9b6-011bc7554268"
                ],
                "status": "SUCCEEDED",
                "logURL": "",
                "url": "s3://platform-sources/builder/0705c78c125b8b0f30e7fa6aeb30ac5f71c99511df40a6b62223be528f89385d/wheel-builder-lib.tar.gz",
                "checksum": "0705c78c125b8b0f30e7fa6aeb30ac5f71c99511df40a6b62223be528f89385d"
            },
            ...
        ]
    }
}

type BuildExprLocation

type BuildExprLocation struct {
	Type             string                        `json:"__typename"`
	Path             string                        `json:"path"`
	Message          string                        `json:"message"`
	IsTransient      bool                          `json:"isTransient"`
	ValidationErrors []*SolverErrorValidationError `json:"validationErrors"`
	*RemediableSolveError
}

BuildExprLocation represents a location in the build script where an error occurred.

type BuildExpression

type BuildExpression struct {
	Type   string  `json:"__typename"`
	Commit *Commit `json:"commit"`
	*Error
}

type BuildLogID

type BuildLogID struct {
	ID         string      `json:"id"`
	PlatformID strfmt.UUID `json:"platformID"`
}

BuildLogID is the ID used to initiate a connection with the BuildLogStreamer.

type BuildPlan

type BuildPlan interface {
	Build() (*Build, error)
	Commit() (*Commit, error)
}

BuildPlan is the top level object returned by the build planner. It contains the commit and build.

func NewBuildPlanResponse

func NewBuildPlanResponse(owner, project string) BuildPlan

type BuildPlanByCommit

type BuildPlanByCommit struct {
	CommitInfo *Commit `json:"commit"`
}

func (*BuildPlanByCommit) Build

func (b *BuildPlanByCommit) Build() (*Build, error)

func (*BuildPlanByCommit) Commit

func (b *BuildPlanByCommit) Commit() (*Commit, error)

func (*BuildPlanByCommit) CommitID

func (b *BuildPlanByCommit) CommitID() (strfmt.UUID, error)

type BuildPlanByProject

type BuildPlanByProject struct {
	Project *Project `json:"project"`
}

func (*BuildPlanByProject) Build

func (b *BuildPlanByProject) Build() (*Build, error)

func (*BuildPlanByProject) Commit

func (b *BuildPlanByProject) Commit() (*Commit, error)

func (*BuildPlanByProject) CommitID

func (b *BuildPlanByProject) CommitID() (strfmt.UUID, error)

type BuildPlannerError

type BuildPlannerError struct {
	Err              error
	ValidationErrors []string
	IsTransient      bool
}

func (*BuildPlannerError) Error

func (e *BuildPlannerError) Error() string

func (*BuildPlannerError) InputError

func (e *BuildPlannerError) InputError() bool

InputError returns true as we want to treat all build planner errors as input errors and not report them to Rollbar. We defer the responsibility of logging these errors to the maintainers of the build planner.

func (*BuildPlannerError) LocalizedError

func (e *BuildPlannerError) LocalizedError() string

UserError returns the error message to be displayed to the user. This function is added so that BuildPlannerErrors will be displayed to the user

func (*BuildPlannerError) Unwrap

func (e *BuildPlannerError) Unwrap() error

type BuildTargetResult

type BuildTargetResult struct {
	Project *Project `json:"Project"`
	*Error
	*NotFoundError
}

type Commit

type Commit struct {
	Type       string          `json:"__typename"`
	AtTime     strfmt.DateTime `json:"atTime"`
	Expression json.RawMessage `json:"expr"`
	CommitID   strfmt.UUID     `json:"commitId"`
	Build      *Build          `json:"build"`
	*Error
	*ParseError
	*ForbiddenError
	*HeadOnBranchMovedError
	*NoChangeSinceLastCommitError
}

Commit contains the build and any errors.

type CommitError

type CommitError struct {
	Type                   string
	Message                string
	*locale.LocalizedError // for legacy, non-user-facing error usages
}

type CreateProjectResult

type CreateProjectResult struct {
	ProjectCreated *projectCreated `json:"createProject"`
}

type Error

type Error struct {
	Message string `json:"message"`
}

Error contains an error message.

type ForbiddenError

type ForbiddenError struct {
	Operation string `json:"operation"`
}

type HeadOnBranchMovedError

type HeadOnBranchMovedError struct {
	HeadBranchID strfmt.UUID `json:"branchId"`
}

HeadOnBranchMovedError represents an error that occurred because the head on a remote branch has moved.

type MergeCommitResult

type MergeCommitResult struct {
	MergedCommit *mergedCommit `json:"mergeCommit"`
}

MergeCommitResult is the result of a merge commit mutation. The resulting commit is only pushed to the platform automatically if the target ref was a named branch and the merge strategy was FastForward.

type MergeConflictError

type MergeConflictError struct {
	CommonAncestorID strfmt.UUID `json:"commonAncestorId"`
	ConflictPaths    []string    `json:"conflictPaths"`
}

MergeConflictError represents an error that occurred because of a merge conflict.

type MergeError

type MergeError struct {
	TargetVCSRef strfmt.UUID `json:"targetVcsRef"`
	OtherVCSRef  strfmt.UUID `json:"otherVcsRef"`
}

MergeError represents two different errors in the BuildPlanner's graphQL schema with the same fields. Those errors being: FastForwardError and NoCommonBaseFound. Inspect the Type field to determine which error it is.

type MergeStrategy

type MergeStrategy string

type MergedCommitError

type MergedCommitError struct {
	Type    string
	Message string
}

func (*MergedCommitError) Error

func (m *MergedCommitError) Error() string

type NamedTarget

type NamedTarget struct {
	Tag     string        `json:"tag"`
	NodeIDs []strfmt.UUID `json:"nodeIds"`
}

NamedTarget is a special target used for terminals.

type NoChangeSinceLastCommitError

type NoChangeSinceLastCommitError struct {
	NoChangeCommitID strfmt.UUID `json:"commitId"`
}

NoChangeSinceLastCommitError represents an error that occurred because there were no changes since the last commit.

type NotFoundError

type NotFoundError struct {
	Type                  string `json:"type"`
	Resource              string `json:"resource"`
	MayNeedAuthentication bool   `json:"mayNeedAuthentication"`
}

NotFoundError represents an error that occurred because a resource was not found.

type Operation

type Operation int

func (Operation) String

func (o Operation) String() string

func (*Operation) Unmarshal

func (o *Operation) Unmarshal(v string) error

type ParseError

type ParseError struct {
	Path string `json:"path"`
}

ParseError is an error that occurred while parsing the build expression.

type PlanningError

type PlanningError struct {
	SubErrors []*BuildExprLocation `json:"subErrors"`
}

PlanningError represents an error that occurred during planning.

type Project

type Project struct {
	Type   string  `json:"__typename"`
	Commit *Commit `json:"commit"`
	*Error
}

Project contains the commit and any errors.

type ProjectCreatedError

type ProjectCreatedError struct {
	Type    string
	Message string
}

func (*ProjectCreatedError) Error

func (p *ProjectCreatedError) Error() string

type PushCommitResult

type PushCommitResult struct {
	Type   string  `json:"__typename"`
	Commit *Commit `json:"pushCommit"`
	*Error
}

PushCommitResult is the result of a push commit mutation. It contains the resulting commit from the operation and any errors. The resulting commit is pushed to the platform automatically.

type RemediableSolveError

type RemediableSolveError struct {
	ErrorType         string                       `json:"errorType"`
	Remediations      []*SolverErrorRemediation    `json:"suggestedRemediations"`
	Requirements      []*Requirement               `json:"requirements"`
	Incompatibilities []*SolveErrorIncompatibility `json:"incompatibilities"`
}

RemediableSolveError represents a solver error that can be remediated.

type Requirement

type Requirement struct {
	Name               string               `json:"name"`
	Namespace          string               `json:"namespace"`
	VersionRequirement []VersionRequirement `json:"version_requirements,omitempty"`
	Revision           *int                 `json:"revision,omitempty"`
}

type ResolvedRequirement

type ResolvedRequirement struct {
	Requirement *Requirement `json:"requirement"`
	Source      strfmt.UUID  `json:"resolvedSource"`
}

type RevertCommitError

type RevertCommitError struct {
	Type    string
	Message string
}

func (*RevertCommitError) Error

func (m *RevertCommitError) Error() string

type RevertCommitResult

type RevertCommitResult struct {
	RevertedCommit *revertedCommit `json:"revertCommit"`
}

type SolveErrorIncompatibility

type SolveErrorIncompatibility struct {
	Type string `json:"type"`
	*SolveErrorPackageIncompatibility
	*SolveErrorPlatformIncompatibility
}

SolverErrorIncompatibility represents a solver incompatibility error.

type SolveErrorPackageIncompatibility

type SolveErrorPackageIncompatibility struct {
	Feature   string `json:"feature"`
	Namespace string `json:"namespace"`
}

SolveErrorPackageIncompatibility represents a package incompatibility error.

type SolveErrorPlatformIncompatibility

type SolveErrorPlatformIncompatibility struct {
	PlatformID     string `json:"platformID"`
	PlatformKernel string `json:"platformKernel"`
}

SolveErrorPlatformIncompatibility represents a platform incompatibility error.

type SolverErrorRemediation

type SolverErrorRemediation struct {
	RemediationType string `json:"solveErrorRemediationType"`
	Command         string `json:"command"`
}

SolverErrorRemediation contains the recommeneded remediation for remediable error.

type SolverErrorValidationError

type SolverErrorValidationError struct {
	JSONPath string `json:"jsonPath"`
	Error    string `json:"error"`
}

SolverErrorValidationError represents a validation error that occurred during planning.

type Source

type Source struct {
	NodeID    strfmt.UUID `json:"nodeId"`
	Name      string      `json:"name"`
	Namespace string      `json:"namespace"`
	Version   string      `json:"version"`
}

Source represents the source of an artifact.

type StageCommitResult

type StageCommitResult struct {
	Commit *Commit `json:"stageCommit"`
}

StageCommitResult is the result of a stage commit mutation. It contains the resulting commit from the operation and any errors. The resulting commit is NOT pushed to the platform automatically.

type Step

type Step struct {
	StepID  strfmt.UUID    `json:"stepId"`
	Inputs  []*NamedTarget `json:"inputs"`
	Outputs []string       `json:"outputs"`
}

Step represents a single step in the build plan. A step takes some input, processes it, and produces some output. This is usually a build step. The input represents a set of target IDs and the output are a set of artifact IDs.

type VersionRequirement

type VersionRequirement map[string]string

Jump to

Keyboard shortcuts

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