github.com/semaphoreui/semaphore/services/tasks
No package summary is available.
Package
Files: 7. Third party imports: 1. Imports from organisation: 0. Tests: 0. Benchmarks: 0.
Constants
Vars
Types
Alert
Alert represents an alert that will be templated and sent to the appropriate service
| Field name | Field type | Comment |
|---|---|---|
| Name |
|
No comment on field. |
| Author |
|
No comment on field. |
| Color |
|
No comment on field. |
| Task |
|
No comment on field. |
| Chat |
|
No comment on field. |
EventType
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| type |
|
No comment on field. |
Job
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| type |
|
No comment on field. |
LocalJob
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Task |
|
No comment on field. |
| Template |
|
No comment on field. |
| Inventory |
|
No comment on field. |
| Repository |
|
No comment on field. |
| Environment |
|
No comment on field. |
| Secret |
|
No comment on field. |
| Logger |
|
No comment on field. |
| App |
|
No comment on field. |
| killed |
|
No comment on field. |
| Process |
|
No comment on field. |
| sshKeyInstallation |
|
No comment on field. |
| becomeKeyInstallation |
|
No comment on field. |
| vaultFileInstallations |
|
No comment on field. |
PoolEvent
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| eventType |
|
No comment on field. |
| task |
|
No comment on field. |
RemoteJob
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| RunnerTag |
|
No comment on field. |
| Task |
|
No comment on field. |
| taskPool |
|
No comment on field. |
| killed |
|
No comment on field. |
TaskPool
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Queue |
|
Queue contains list of tasks in status TaskWaitingStatus. |
| register |
|
register channel used to put tasks to queue. |
| activeProj |
|
activeProj ??? |
| RunningTasks |
|
RunningTasks contains tasks with status TaskRunningStatus. Map key is a task ID. |
| logger |
|
logger channel used to putting log records to database. |
| store |
|
No comment on field. |
| queueEvents |
|
No comment on field. |
| aliases |
|
No comment on field. |
TaskRunner
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Task |
|
No comment on field. |
| Template |
|
No comment on field. |
| Inventory |
|
No comment on field. |
| Repository |
|
No comment on field. |
| Environment |
|
No comment on field. |
| currentStage |
|
No comment on field. |
| currentOutput |
|
No comment on field. |
| currentState |
|
No comment on field. |
| users |
|
No comment on field. |
| alert |
|
No comment on field. |
| alertChat |
|
No comment on field. |
| pool |
|
No comment on field. |
| job |
|
job executes Ansible and returns stdout to Semaphore logs |
| RunnerID |
|
No comment on field. |
| Username |
|
No comment on field. |
| IncomingVersion |
|
No comment on field. |
| statusListeners |
|
No comment on field. |
| logListeners |
|
No comment on field. |
| Alias |
|
Alias uses if task require an alias for run. For example, terraform task require an alias for run. |
| logWG |
|
No comment on field. |
alertChat
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| ID |
|
No comment on field. |
alertTask
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| ID |
|
No comment on field. |
| URL |
|
No comment on field. |
| Result |
|
No comment on field. |
| Desc |
|
No comment on field. |
| Version |
|
No comment on field. |
logRecord
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| task |
|
No comment on field. |
| output |
|
No comment on field. |
| time |
|
No comment on field. |
runnerWebhookPayload
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Action |
|
No comment on field. |
| ProjectID |
|
No comment on field. |
| TaskID |
|
No comment on field. |
| TemplateID |
|
No comment on field. |
| RunnerID |
|
No comment on field. |
Functions
func CreateTaskPool
func (*LocalJob) IsKilled
func (*LocalJob) Kill
func (*LocalJob) Log
func (*LocalJob) Run
func (*LocalJob) SetCommit
func (*LocalJob) SetStatus
func (*RemoteJob) IsKilled
func (*RemoteJob) Kill
func (*RemoteJob) Run
func (*TaskPool) AddTask
AddTask creates and queues a new task for execution in the task pool.
Parameters:
- taskObj: The task object with initial configuration
- userID: Optional ID of the user initiating the task
- username: Username of the user initiating the task
- projectID: ID of the project this task belongs to
- needAlias: Whether to generate a unique alias for the task
The method:
- Sets initial task properties (created time, waiting status, etc.)
- Validates the task against its template
- For build templates, calculates the next version number
- Creates the task record in the database
- Sets up appropriate job handler (local or remote)
- Queues the task for execution
Returns:
- The newly created task with all properties set
- An error if task creation or validation fails
func (*TaskPool) ConfirmTask
func (*TaskPool) GetNumberOfRunningTasksOfRunner
func (*TaskPool) GetRunningTasks
func (*TaskPool) GetTask
func (*TaskPool) GetTaskByAlias
func (*TaskPool) MoveToNextStage
func (*TaskPool) RejectTask
func (*TaskPool) Run
nolint: gocyclo
Uses: db.StoreSession, db.TaskOutput, log.Debug, log.Error, log.Info, strconv.Itoa, time.NewTicker, time.Second.func (*TaskPool) StopTask
func (*TaskRunner) AddLogListener
func (*TaskRunner) AddStatusListener
func (*TaskRunner) Log
func (*TaskRunner) LogCmd
func (*TaskRunner) LogWithTime
func (*TaskRunner) Logf
func (*TaskRunner) LogfWithTime
func (*TaskRunner) SetCommit
func (*TaskRunner) SetStatus
func (*TaskRunner) WaitLog
Private functions
func callRunnerWebhook
func checkTmpDir
checkTmpDir checks to see if the temporary directory exists and if it does not attempts to create it
References: os.IsNotExist, os.MkdirAll, os.Stat.func getNextBuildVersion
func runTask
func checkoutRepository
func cloneInventoryRepo
func destroyInventoryFile
func destroyKeys
func getCLIArgs
func getEnvironmentENV
func getEnvironmentExtraVars
func getEnvironmentExtraVarsJSON
func getParams
func getPlaybookArgs
nolint: gocyclo
References: db.AccessKeyLoginPassword, db.AccessKeyNone, db.AccessKeyRole, db.AccessKeyRoleAnsibleBecomeUser, db.AccessKeyRoleAnsibleUser, db.AccessKeySSH, db.AnsibleTaskParams, db.AnsibleTemplateParams, db.EnvironmentSecretVar, db.InventoryFile, db.InventoryStatic, db.InventoryStaticYaml, fmt.Errorf, fmt.Sprintf, path.Join, strings.Join, strings.Repeat.func getShellArgs
nolint: gocyclo
References: db.EnvironmentSecretVar, fmt.Sprintf.func getTemplateParams
func getTerraformArgs
nolint: gocyclo
References: db.EnvironmentSecretVar, db.TerraformTaskParams, fmt.Sprintf.func installInventory
func installStaticInventory
func installVaultKeyFiles
func prepareRun
func tmpInventoryFilename
func tmpInventoryFullPath
func updateRepository
func blocks
func handleQueue
func onTaskRun
func onTaskStop
func alertColor
func alertInfos
func createTaskEvent
func kill
func logPipe
func panicOnError
func populateDetails
nolint: gocyclo
References: db.FillEnvironmentSecrets, db.RetrieveQueryParams, json.Marshal, json.Unmarshal.func prepareError
func run
func saveStatus
func sendDingTalkAlert
func sendGotifyAlert
func sendMailAlert
func sendMicrosoftTeamsAlert
func sendRocketChatAlert
func sendSlackAlert
func sendTelegramAlert
func taskLink
Tests
Files: 2. Third party imports: 0. Imports from organisation: 0. Tests: 11. Benchmarks: 0.