Skip to content

Commit

Permalink
Revert "Revert "disable autostop when set""
Browse files Browse the repository at this point in the history
This reverts commit 49a417e.
  • Loading branch information
r33drichards committed Oct 28, 2022
1 parent 49a417e commit 154d408
Show file tree
Hide file tree
Showing 27 changed files with 63 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_CanClonePublicRepoWithoutAuthorizeddKeysAllFormats$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test_ChangePwd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_ChangePwd$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_CustomBranchCustomSetupCustomFolder$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test_NoProjectBrev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_NoProjectBrev$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test_NoUserBrevNoProj.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_NoUserBrevNoProj$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test_NoUserBrevProj.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_NoUserBrevProj$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test_ProjectRepoNoBrev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_ProjectRepoNoBrev$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test_ProvidedSetupFileChange.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_ProvidedSetupFileChange$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test_ProvidedSetupRanNoProj.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_ProvidedSetupRanNoProj$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test_ProvidedSetupUpdated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_ProvidedSetupUpdated$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test_UnauthenticatedSSHKey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_UnauthenticatedSSHKey$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test_UserBrevProjectBrevV0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_UserBrevProjectBrevV0$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test_UserBrevProjectBrevV1All.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_UserBrevProjectBrevV1All$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test_UserBrevProjectBrevV1Minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_UserBrevProjectBrevV1Minimal$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test_VscodeExtension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_VscodeExtension$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Test_httpGit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: go test -timeout 240s -run ^Test_httpGit$ github.com/brevdev/brev-cli/e2etest/setup
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
cache: true

- name: Build
run: make fast-build
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18
cache: true


- name: install
run: make install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18

cache: true
- name: Build
run: make ci
- name: Upload coverage
Expand Down Expand Up @@ -63,6 +63,6 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18

cache: true
- name: Release test
run: make build
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18

cache: true
- name: install
run: make install
- name: lint
Expand All @@ -33,6 +33,6 @@ jobs:
uses: ravsamhq/notify-slack-action@v1
with:
status: ${{ job.status }}
notify_when: 'failure'
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18

cache: true
- name: Release
run: make ci smoke-test release
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18

cache: true
- name: install
run: make install
- name: test
Expand All @@ -50,6 +50,6 @@ jobs:
uses: ravsamhq/notify-slack-action@v1
with:
status: ${{ job.status }}
notify_when: 'failure'
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }}
4 changes: 2 additions & 2 deletions .github/workflows/vet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.18

cache: true
- name: install
run: make install
- name: vet
Expand All @@ -33,6 +33,6 @@ jobs:
uses: ravsamhq/notify-slack-action@v1
with:
status: ${{ job.status }}
notify_when: 'failure'
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }}
2 changes: 1 addition & 1 deletion bin/gen-e2e-actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def generate_file_content(test_name):
- uses: actions/setup-go@v2
with:
go-version: 1.18
- name: expire test cache
cache: true - name: expire test cache
run: go clean -testcache
- name: test
run: """
Expand Down
35 changes: 26 additions & 9 deletions pkg/autostartconf/autostartconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,27 +237,44 @@ User=` + store.GetOSUser() + `

func NewBrevMonConfigure(
store AutoStartStore,
disableAutostop bool,
) DaemonConfigurer {
return AptBinaryConfigurer{
LinuxSystemdConfigurer: LinuxSystemdConfigurer{
Store: store,
ValueConfigFile: `
[Unit]
configFile := `[Unit]
Description=brevmon
After=network.target
[Service]
User=root
Type=exec
ExecStart=/usr/local/bin/brevmon
ExecStart=
ExecReload=/usr/local/bin/brevmon
Restart=always
[Install]
WantedBy=default.target
`,
ServiceName: "brevmon.service",
ServiceType: "system",
`
if disableAutostop {
configFile = `[Unit]
Description=brevmon
After=network.target
[Service]
User=root
Type=exec
ExecStart=
ExecReload=/usr/local/bin/brevmon --disable-autostop
Restart=always
[Install]
WantedBy=default.target
`
}
return AptBinaryConfigurer{
LinuxSystemdConfigurer: LinuxSystemdConfigurer{
Store: store,
ValueConfigFile: configFile,
ServiceName: "brevmon.service",
ServiceType: "system",
},

URL: "https://s3.amazonaws.com/brevmon.brev.dev/brevmon.tar.gz",
Expand Down
8 changes: 7 additions & 1 deletion pkg/cmd/envsetup/envsetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func NewCmdEnvSetup(store envsetupStore, noLoginStore nologinEnvStore) *cobra.Co
token,
noLoginStore,
datadogAPIKey,
disableAutostop,
)
if err != nil {
errors = multierror.Append(err)
Expand Down Expand Up @@ -111,6 +112,7 @@ func RunEnvSetup(
workspaceid, token string,
noLoginStore nologinEnvStore,
datadogAPIKey string,
disableAutostop bool,
) error {
if token != "" {
err := noLoginStore.LoginWithToken(token)
Expand Down Expand Up @@ -156,6 +158,7 @@ func RunEnvSetup(
params,
configureSystemSSHConfig,
datadogAPIKey,
disableAutostop,
)
if err != nil {
return breverrors.WrapAndTrace(err)
Expand Down Expand Up @@ -451,13 +454,14 @@ func newEnvIniter(
configureSystemSSHConfig bool,
store envsetupStore,
datadogAPIKey string,
disableAbleAUtosop bool,
) *envInitier {
workspaceIniter := setupworkspace.NewWorkspaceIniter(user.HomeDir, user, params)

return &envInitier{
*workspaceIniter,
configureSystemSSHConfig,
autostartconf.NewBrevMonConfigure(store),
autostartconf.NewBrevMonConfigure(store, disableAbleAUtosop),
datadogAPIKey,
store,
}
Expand All @@ -468,6 +472,7 @@ func setupEnv(
params *store.SetupParamsV0,
configureSystemSSHConfig bool,
datadogAPIKey string,
disableAutoStop bool,
) error {
err := store.BuildBrevHome()
if err != nil {
Expand All @@ -483,6 +488,7 @@ func setupEnv(
configureSystemSSHConfig,
store,
datadogAPIKey,
disableAutoStop,
)
// set logfile path to ~/.brev/envsetup.log
logFilePath := filepath.Join(user.HomeDir, ".brev", "envsetup.log")
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/postinstall/postinstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func Runpostinstall(
return breverrors.WrapAndTrace(err)
}

brevmonConfigurer := autostartconf.NewBrevMonConfigure(store)
brevmonConfigurer := autostartconf.NewBrevMonConfigure(store, false)

err = brevmonConfigurer.Install()
if err != nil {
Expand Down

0 comments on commit 154d408

Please sign in to comment.