-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuilder.go
More file actions
42 lines (37 loc) · 1.23 KB
/
builder.go
File metadata and controls
42 lines (37 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Package pkg provides common libraries for the Deis builder.
//
// The Deis builder is responsible for building slugs and docker images for use in the Deis
// on the Deis PaaS platform.
package pkg
import (
"fmt"
"github.com/deis/builder/pkg/sshd"
"github.com/deis/pkg/log"
)
// Return codes that will be sent to the shell.
const (
StatusOk = iota
StatusLocalError
)
// RunBuilder starts the Builder service.
//
// The Builder service is responsible for setting up the local container
// environment and then listening for new builds. The main listening service
// is SSH. Builder listens for new Git commands and then sends those on to
// Git.
//
// Run returns on of the Status* status code constants.
func RunBuilder(sshHostIP string, sshHostPort int, gitHomeDir string, sshServerCircuit *sshd.Circuit, pushLock sshd.RepositoryLock) int {
address := fmt.Sprintf("%s:%d", sshHostIP, sshHostPort)
cfg, err := sshd.Configure()
if err != nil {
log.Err("SSH server configuration failed: %s", err)
return StatusLocalError
}
receivetype := "gitreceive"
if err := sshd.Serve(cfg, sshServerCircuit, gitHomeDir, pushLock, address, receivetype); err != nil {
log.Err("SSH server failed: %s", err)
return StatusLocalError
}
return StatusOk
}