Documentation
¶
Index ¶
- Constants
- func CalculateContentHash(content []byte) string
- func EnsureTool(bin string) error
- func GetBuildCmd(inputFile string, outputFile string, rootFolder string) *exec.Cmd
- func GetWorkflowLanguage(inputFile string) string
- func IsBinaryFile(fileName string) (bool, error)
- func ScanFilesForContent(dirPath string) (string, error)
- type ArtifactType
- type ArtifactUpload
- type Artifacts
- func (a *Artifacts) Compile() error
- func (a *Artifacts) DurableUpload(uploadInput *UploadInput) error
- func (a *Artifacts) GetBinaryData() []byte
- func (a *Artifacts) GetBinaryPath() string
- func (a *Artifacts) GetConfigData() []byte
- func (a *Artifacts) GetWorkflowID() string
- func (a *Artifacts) GetWorkflowMainFile(workflowPath string) (string, error)
- func (a *Artifacts) Prepare() error
- type Field
- type Input
- type UploadInput
Constants ¶
const ( WorkflowLanguageGolang = "golang" WorkflowLanguageTypeScript = "typescript" )
Variables ¶
This section is empty.
Functions ¶
func CalculateContentHash ¶
Calculate the content hash of the artifact to generate the presigned URL for the artifact in the storage service
func EnsureTool ¶
EnsureTool checks that the binary exists on PATH
func GetBuildCmd ¶
Gets a build command for either Golang or Typescript based on the filename
func GetWorkflowLanguage ¶
GetWorkflowLanguage determines the workflow language based on the file extension Note: inputFile can be a file path (e.g., "main.ts" or "main.go") or a directory (for Go workflows, e.g., ".") Returns constants.WorkflowLanguageTypeScript for .ts or .tsx files, constants.WorkflowLanguageGolang otherwise
func IsBinaryFile ¶
There is only a small group of acceptable file extensions by this tool and only few of them are considered to be binary files
func ScanFilesForContent ¶
ScanFilesForContent scans all files in the specified directory (non-recursive) and returns the name of the first file whose content contains all the specified substrings. Returns an error if no file matches all substrings or if there's an error reading the directory.
Types ¶
type ArtifactType ¶
type ArtifactType string
const ( ArtifactTypeBinary ArtifactType = "BINARY" ArtifactTypeConfig ArtifactType = "CONFIG" )
type ArtifactUpload ¶
type ArtifactUpload struct {
Content []byte
ContentType ArtifactType
ContentHash string
}
Read in an artifact file from a given filepath and calculate the content hash
func NewArtifactUpload ¶
func NewArtifactUpload(filepath string, contentType ArtifactType) (*ArtifactUpload, error)
Constructor for ArtifactUpload
type Artifacts ¶
type Artifacts struct {
// contains filtered or unexported fields
}
func NewWorkflowArtifacts ¶
Constructor for WorkflowArtifacts
func (*Artifacts) Compile ¶
Function to compile CRE workflow into a WASM binary, brotli compress it and base64 encode it Input.WorkflowPath is the path to the workflow directory or file. If it's a directory, it will be scanned for a main workflow file either in .go or .ts/.tsx files for CRE Workflow Runner execution.
func (*Artifacts) DurableUpload ¶
func (a *Artifacts) DurableUpload(uploadInput *UploadInput) error
DurableUpload uploads an artifact with up to 3 attempts and exponential backoff.
func (*Artifacts) GetBinaryData ¶
Returns the binary data after preparing the artifacts This value is empty until Prepare() is called
func (*Artifacts) GetBinaryPath ¶
Returns the binary path after preparing the artifacts This value is empty until Prepare() is called
func (*Artifacts) GetConfigData ¶
Returns the config data after preparing the artifacts This value is empty until Prepare() is called
func (*Artifacts) GetWorkflowID ¶
Returns the generated workflow ID after preparing the artifacts This value is empty until Prepare() is called
func (*Artifacts) GetWorkflowMainFile ¶
Get the path to main workflow file for a Go workflow
type UploadInput ¶
type UploadInput struct {
PresignedURL string `json:"presignedUrl"`
PresignedFields []Field `json:"presignedFields"`
ContentType ArtifactType `json:"contentType"`
Filepath string `json:"-"`
Timeout time.Duration `json:"-"`
}
Input for uploading artifacts to storage service using presigned URLs