Documentation
¶
Index ¶
- Variables
- func BuildBeacon(cli *client.Client, req *clientpb.Generate) error
- func BuildBind(cli *client.Client, req *clientpb.Generate) error
- func BuildModules(cli *client.Client, req *clientpb.Generate) error
- func BuildPrelude(cli *client.Client, req *clientpb.Generate) error
- func BuildPulse(cli *client.Client, req *clientpb.Generate) error
- func DeleteSuccessWorkflow(owner, repo, token string, workflowID int64) error
- func GenerateProfile(req *clientpb.Generate) (string, error)
- func GetDockerClient() (*client.Client, error)
- func GetFilePath(name, target, buildType string, isSrdi bool) string
- func GetWorkflowStatus(owner, repo, workflowID, token string) error
- func MoveBuildOutput(target, buildType string) (string, string, error)
- func NewMaleficSRDIArtifact(name, typ, src, platform, arch, stage, funcName, dataPath string) (*models.Builder, []byte, error)
- func OBJCOPYPulse(builder *models.Builder, platform, arch string) ([]byte, error)
- func PushArtifact(owner, repo, token, buildName string, isRemove bool) (*models.Builder, error)
- func SRDIArtifact(builder *models.Builder, platform, arch string) ([]byte, error)
- func SaveArtifact(dst string, bin []byte) error
- func TriggerWorkflowDispatch(owner, repo, workflowID, token string, inputs map[string]string, isRemove bool, ...) (*clientpb.Builder, error)
- type Artifact
- type ArtifactsResponse
- type BuildQueueManager
- type BuildTask
- type Workflow
- type WorkflowDispatchPayload
Constants ¶
This section is empty.
Variables ¶
var ( //NameSpace = "ghcr.io/chainreactors" //Tag = "nightly-2023-09-18-latest" DefaultImage = "ghcr.io/chainreactors/malefic-builder:v0.0.4" ContainerSourceCodePath = "/root/src" ContainerCargoRegistryCache = "/root/cargo/registry" ContainerCargoGitCache = "/root/cargo/git" ContainerBinPath = "/root/bin" LocalMutantPath = filepath.Join(configs.BinPath, "malefic-mutant") SourceCodeVolume = fmt.Sprintf("%s:%s", filepath.ToSlash(sourcePath), ContainerSourceCodePath) CargoRegistryCacheVolume = fmt.Sprintf("%s:%s", filepath.ToSlash(registryPath), ContainerCargoRegistryCache) CargoGitCacheVolume = fmt.Sprintf("%s:%s", filepath.ToSlash(gitPath), ContainerCargoGitCache) BinPathVolume = fmt.Sprintf("%s:%s", filepath.ToSlash(binPath), ContainerBinPath) //Volumes = []string{SourceCodeVolume, CargoRegistryCacheVolume, CargoGitCacheVolume, BinPathVolume} Volumes = []string{SourceCodeVolume} )
Functions ¶
func DeleteSuccessWorkflow ¶ added in v0.1.0
func GetDockerClient ¶
func GetFilePath ¶ added in v0.1.0
func GetWorkflowStatus ¶ added in v0.1.0
func NewMaleficSRDIArtifact ¶
func OBJCOPYPulse ¶ added in v0.1.0
for pulse
func PushArtifact ¶ added in v0.1.0
func SRDIArtifact ¶ added in v0.1.0
func SaveArtifact ¶
func TriggerWorkflowDispatch ¶ added in v0.1.0
func TriggerWorkflowDispatch(owner, repo, workflowID, token string, inputs map[string]string, isRemove bool, req *clientpb.Generate) (*clientpb.Builder, error)
TriggerWorkflowDispatch is a reusable function to trigger a GitHub Actions workflow dispatch event
Types ¶
type Artifact ¶ added in v0.1.0
type Artifact struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Name string `json:"name"`
SizeInBytes int64 `json:"size_in_bytes"`
URL string `json:"url"`
ArchiveDownloadURL string `json:"archive_download_url"`
Expired bool `json:"expired"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt time.Time `json:"expires_at"`
UpdatedAt time.Time `json:"updated_at"`
WorkflowRun struct {
ID int64 `json:"id"`
RepositoryID int64 `json:"repository_id"`
HeadRepositoryID int64 `json:"head_repository_id"`
HeadBranch string `json:"head_branch"`
HeadSHA string `json:"head_sha"`
} `json:"workflow_run"`
}
Artifact represents a GitHub Actions artifact
type ArtifactsResponse ¶ added in v0.1.0
type ArtifactsResponse struct {
TotalCount int `json:"total_count"`
Artifacts []Artifact `json:"artifacts"`
}
ArtifactsResponse is the response structure for listing artifacts
type BuildQueueManager ¶ added in v0.1.0
type BuildQueueManager struct {
// contains filtered or unexported fields
}
BuildQueueManager manages the build task queue
var GlobalBuildQueueManager *BuildQueueManager
GlobalBuildQueueManager is the global build queue manager instance
func NewBuildQueueManager ¶ added in v0.1.0
func NewBuildQueueManager(workerCount int) *BuildQueueManager
NewBuildQueueManager creates a new BuildQueueManager instance
func (*BuildQueueManager) AddTask ¶ added in v0.1.0
func (bqm *BuildQueueManager) AddTask(req *clientpb.Generate, builder *models.Builder) (*clientpb.Artifact, error)
AddTask adds a build task to the queue and waits for the result
func (*BuildQueueManager) Start ¶ added in v0.1.0
func (bqm *BuildQueueManager) Start()
Start starts the worker goroutines that will process the tasks
func (*BuildQueueManager) Stop ¶ added in v0.1.0
func (bqm *BuildQueueManager) Stop()
Stop stops the queue manager and waits for all workers to finish
type BuildTask ¶ added in v0.1.0
type BuildTask struct {
// contains filtered or unexported fields
}
BuildTask defines a task structure for the build process
type Workflow ¶ added in v0.1.0
type Workflow struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Name string `json:"name"`
Path string `json:"path"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Status string `json:"status"`
State string `json:"state"`
Conclusion string `json:"conclusion"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
ArtifactsURL string `json:"artifacts_url"`
}
Workflow represents a GitHub Actions workflow
type WorkflowDispatchPayload ¶ added in v0.1.0
type WorkflowDispatchPayload struct {
Ref string `json:"ref"`
Inputs map[string]string `json:"inputs,omitempty"`
}
WorkflowDispatchPayload defines the payload for triggering a workflow dispatch event