-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
39 lines (34 loc) · 955 Bytes
/
Copy pathmain.go
File metadata and controls
39 lines (34 loc) · 955 Bytes
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
package main
import (
l "github.com/ragurney/samson-job/internal/lib"
s "github.com/ragurney/samson-job/pkg/samson"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"strconv"
)
func main() {
zerolog.TimeFieldFormat = ""
deployTimeout, err := strconv.Atoi(l.Env("DEPLOY_TIMEOUT", "120"))
if err != nil {
log.Fatal().Msg("Failed to parse DEPLOY_TIMEOUT")
}
pollInterval, err := strconv.Atoi(l.Env("POLL_INTERVAL", "30"))
if err != nil {
log.Fatal().Msg("Failed to parse POLL_INTERVAL")
}
project := l.Env("SAMSON_PROJECT", "")
reference := l.Env("REFERENCE", "")
stage := l.Env("SAMSON_STAGE", "")
token := l.Env("SAMSON_TOKEN", "")
url := l.Env("SAMSON_URL", "")
log.Debug().Msg("Starting Samson deploy...")
s.NewJob(
s.WithDeployTimeout(deployTimeout),
s.WithPollInterval(pollInterval),
s.WithProject(project),
s.WithReference(reference),
s.WithStage(stage),
s.WithToken(token),
s.WithURL(url),
).Execute()
}