Documentation
¶
Index ¶
- Variables
- func AmountArtifact(artifactName string) error
- func AutoCheckSource(ctx context.Context, req *clientpb.BuildConfig) (*clientpb.BuildConfig, error)
- func CheckSource(ctx context.Context, req *clientpb.BuildConfig) (*clientpb.BuildConfig, error)
- func ConvertArtifact(artifact *clientpb.Artifact, format string, rdi string) (*clientpb.Artifact, error)
- func CopyProfileFilesExceptConfig(profilePath, targetPath string) error
- func DeleteSuccessWorkflow(owner, repo, token string, workflowID int64) error
- func GetActionStatus(owner, repo, token, artifactName string) (string, string, error)
- func GetContainerID(d *DockerBuilder) string
- func GetDockerClient() (*client.Client, error)
- func GetDockerStatus(cli *client.Client, containerName string) (string, error)
- func GetFilePath(name, target, buildType, format string) string
- func GetImage(target string) string
- func GetWorkflowStatus(config *clientpb.GithubActionBuildConfig) error
- func MoveBuildOutput(target, buildType string, enable3RD bool) (string, string, error)
- func MutantSrdi(path string) ([]byte, error)
- func ObjcopyPulse(path, platform, arch string) ([]byte, error)
- func ProcessAutorunWithProfile(paramsBytes []byte, profilePath, targetPath string) error
- func ProcessAutorunZip(zipData []byte, targetPath string) error
- func ProcessAutorunZipToBase64(paramsByte []byte, profileName string) (string, string, error)
- func PushArtifact(owner, repo, token, buildName string, isRemove bool) (*models.Artifact, error)
- func SRDIArtifact(bin []byte, platform, arch string, RDIType string) ([]byte, error)
- func SaveArtifact(dst string, bin []byte) error
- func SendBuildMsg(artifact *clientpb.Artifact, status string, params []byte, err error)
- func SetLicenseID(d *DockerBuilder, licenseID string)
- func WriteAutoYaml(data []byte) error
- func WriteProfile(data []byte) error
- type ActionBuilder
- type Artifact
- type ArtifactsResponse
- type Builder
- type BuilderState
- type DockerBuilder
- type Job
- type JobsResponse
- type SaasBuilder
- type Step
- type Workflow
- type WorkflowDispatchPayload
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ERRORSRDI = errors.New("srdi error") ERROROBJCOPY = errors.New("objcopy error") )
View Source
var ( //NameSpace = "ghcr.io/chainreactors" //Tag = "nightly-2023-09-18-latest" ContainerSourceCodePath = "/root/src" ContainerCargoRegistryCache = "/root/cargo/registry" ContainerCargoGitCache = "/root/cargo/git" ContainerBinPath = "/root/bin" ContainerResourcePath = "/root/src/resources" // 新增:容器内的资源路径 ContainerAutoRunPath = "/root/src/autorun.yaml" ContainerConfigPath = "/root/src/config.yaml" 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, BinPathVolume} PATH_ENV = ContainerBinPath + ":/root/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/osxcross/bin:/usr/bin/mingw-w64" )
Functions ¶
func AmountArtifact ¶
func AutoCheckSource ¶ added in v0.1.2
func AutoCheckSource(ctx context.Context, req *clientpb.BuildConfig) (*clientpb.BuildConfig, error)
func CheckSource ¶ added in v0.1.2
func CheckSource(ctx context.Context, req *clientpb.BuildConfig) (*clientpb.BuildConfig, error)
CheckSource
func ConvertArtifact ¶ added in v0.1.2
func CopyProfileFilesExceptConfig ¶ added in v0.1.2
CopyProfileFilesExceptConfig copies all files from the profile directory except config.yaml to the target path
func DeleteSuccessWorkflow ¶
删除成功workflow
func GetActionStatus ¶
获取action状态
func GetContainerID ¶
func GetContainerID(d *DockerBuilder) string
func GetDockerClient ¶
func GetDockerStatus ¶
func GetFilePath ¶
func GetWorkflowStatus ¶
func GetWorkflowStatus(config *clientpb.GithubActionBuildConfig) error
func MoveBuildOutput ¶
func MutantSrdi ¶ added in v0.1.2
func ObjcopyPulse ¶ added in v0.1.2
ObjcopyPulse extracts shellcode from compiled artifact using objcopy
func ProcessAutorunWithProfile ¶ added in v0.1.2
ProcessAutorunWithProfile processes autorun.zip and copies profile files
func ProcessAutorunZip ¶ added in v0.1.2
ProcessAutorunZip processes autorun.zip file, extracting only files from the resource directory to the target root directory
func ProcessAutorunZipToBase64 ¶ added in v0.1.2
func PushArtifact ¶
主流程
func SRDIArtifact ¶ added in v0.1.2
func SaveArtifact ¶
func SendBuildMsg ¶
func SetLicenseID ¶ added in v0.1.2
func SetLicenseID(d *DockerBuilder, licenseID string)
func WriteAutoYaml ¶ added in v0.1.2
func WriteProfile ¶ added in v0.1.2
Types ¶
type ActionBuilder ¶
type ActionBuilder struct {
// contains filtered or unexported fields
}
func NewActionBuilder ¶
func NewActionBuilder(req *clientpb.BuildConfig) *ActionBuilder
func (*ActionBuilder) Execute ¶
func (a *ActionBuilder) Execute() error
type Artifact ¶
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 ¶
type ArtifactsResponse struct {
TotalCount int `json:"total_count"`
Artifacts []Artifact `json:"artifacts"`
}
ArtifactsResponse is the response structure for listing artifacts
type Builder ¶
type Builder interface {
Generate() (*clientpb.Artifact, error)
Execute() error
Collect() (string, string, error)
}
Builder
func NewBuilder ¶
func NewBuilder(req *clientpb.BuildConfig) (Builder, error)
type BuilderState ¶
type DockerBuilder ¶
type DockerBuilder struct {
// contains filtered or unexported fields
}
func NewDockerBuilder ¶
func NewDockerBuilder(req *clientpb.BuildConfig) *DockerBuilder
func (*DockerBuilder) Execute ¶
func (d *DockerBuilder) Execute() error
type JobsResponse ¶
type SaasBuilder ¶
type SaasBuilder struct {
// contains filtered or unexported fields
}
func NewSaasBuilder ¶
func NewSaasBuilder(req *clientpb.BuildConfig) *SaasBuilder
func (*SaasBuilder) Execute ¶
func (s *SaasBuilder) Execute() error
type Workflow ¶
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 ¶
type WorkflowDispatchPayload struct {
Ref string `json:"ref"`
Inputs map[string]string `json:"inputs,omitempty"`
}
WorkflowDispatchPayload defines the payload for triggering a workflow dispatch event
Click to show internal directories.
Click to hide internal directories.