Documentation
¶
Index ¶
Constants ¶
const DEFAULT_AGENT = "6524a5fc-0772-4684-82d7-6900c444162b"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
sync.Mutex
BusySig *sync.Cond `json:"-"` // Signal informing if the Agent is busy
Identifier string `json:"identifier"` // unique string representing an Agent
Busy bool `json:"-"` // true if the agent is executing a pipeline
State *GlobalStateProvider `json:"-"` // The application config
}
Agent represents a process that executes a pipeline in its personal directory and cleans it up afterward. The Identifier uniquely identifies the agent.
func (*Agent) CleanUp ¶
CleanUp sends a signal to tell it is not busy anymore, and cleans up it's directory
func (*Agent) Initialize ¶
Initialize first waits until the agent has finished his previous work, then creates the directory it will work in
type Config ¶
type Config struct {
sync.RWMutex // Can be read and written to by multiple routines, so we should lock it
AgentDir string `json:"agent-dir"` // Source directory where agents do their work
PipelineDir string `json:"pipeline-dir"` // Source directory where pipelines cache the results of commands that should run once
ReportDir string `json:"report-dir"`
JerminalResourcePath string `json:"-"`
AgentResourcePath string `json:"-"`
GithubWebhookSecret string `json:"github-webhook-secret"` // pour l'authentification des webhooks github
Secret string `json:"secret"`
UserParams map[string]interface{} `json:"project"`
}
Configurable variables for the app
func (*Config) UpdateConfig ¶
UpdateConfig Creates the config object
It should only be called by the server
type GlobalStateProvider ¶
type GlobalStateProvider struct {
*Config
// contains filtered or unexported fields
}
GlobalStateProvider represents global config of the application
func GetState ¶
func GetState() (*GlobalStateProvider, error)
Gets the current config of the application with a default config. Updates the config of the config, so if you change the config file between getting the previous config and this one, it will run with the updated config
Mutually exclusive with GetStateCustomConf ¶
Should be used by default
func GetStateCustomConf ¶
func GetStateCustomConf(conf *Config) *GlobalStateProvider
Gets the current config of the application with a custom config.
Mutually exclusive with GetState ¶
Should be used for tests
func (*GlobalStateProvider) CloneConfig ¶
func (s *GlobalStateProvider) CloneConfig() *Config
Allows for retreival of configuration at an instant allowing for the pipeline to stay coherent even if a change to the config is made during it's runtime
func (*GlobalStateProvider) DefaultAgent ¶
func (s *GlobalStateProvider) DefaultAgent() *Agent
Gets the default agent back
func (*GlobalStateProvider) GetAgent ¶
func (s *GlobalStateProvider) GetAgent(id string) *Agent
GetAgent returns an agent from the map of agents
Creates it does not exist yet
func (*GlobalStateProvider) GetAnyAgent ¶
func (s *GlobalStateProvider) GetAnyAgent() *Agent
Gets the first non busy existing agent
If every agent is busy, gets the default agent