diff --git a/.github/workflows/Test_CanClonePublicRepoWithoutAuthorizeddKeysAllFormats.yml b/.github/workflows/Test_CanClonePublicRepoWithoutAuthorizeddKeysAllFormats.yml index cdb4a632..e7606c5d 100644 --- a/.github/workflows/Test_CanClonePublicRepoWithoutAuthorizeddKeysAllFormats.yml +++ b/.github/workflows/Test_CanClonePublicRepoWithoutAuthorizeddKeysAllFormats.yml @@ -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 diff --git a/.github/workflows/Test_ChangePwd.yml b/.github/workflows/Test_ChangePwd.yml index 14c1a5a2..c335fb5b 100644 --- a/.github/workflows/Test_ChangePwd.yml +++ b/.github/workflows/Test_ChangePwd.yml @@ -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 diff --git a/.github/workflows/Test_CustomBranchCustomSetupCustomFolder.yml b/.github/workflows/Test_CustomBranchCustomSetupCustomFolder.yml index 032a7e0f..1f8f80d7 100644 --- a/.github/workflows/Test_CustomBranchCustomSetupCustomFolder.yml +++ b/.github/workflows/Test_CustomBranchCustomSetupCustomFolder.yml @@ -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 diff --git a/.github/workflows/Test_NoProjectBrev.yml b/.github/workflows/Test_NoProjectBrev.yml index 603acbb9..922ad116 100644 --- a/.github/workflows/Test_NoProjectBrev.yml +++ b/.github/workflows/Test_NoProjectBrev.yml @@ -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 diff --git a/.github/workflows/Test_NoUserBrevNoProj.yml b/.github/workflows/Test_NoUserBrevNoProj.yml index ae78eafd..610d9b1d 100644 --- a/.github/workflows/Test_NoUserBrevNoProj.yml +++ b/.github/workflows/Test_NoUserBrevNoProj.yml @@ -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 diff --git a/.github/workflows/Test_NoUserBrevProj.yml b/.github/workflows/Test_NoUserBrevProj.yml index ea624f73..f162a9af 100644 --- a/.github/workflows/Test_NoUserBrevProj.yml +++ b/.github/workflows/Test_NoUserBrevProj.yml @@ -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 diff --git a/.github/workflows/Test_ProjectRepoNoBrev.yml b/.github/workflows/Test_ProjectRepoNoBrev.yml index b17487e9..349d0f1d 100644 --- a/.github/workflows/Test_ProjectRepoNoBrev.yml +++ b/.github/workflows/Test_ProjectRepoNoBrev.yml @@ -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 diff --git a/.github/workflows/Test_ProvidedSetupFileChange.yml b/.github/workflows/Test_ProvidedSetupFileChange.yml index ed67a598..be3ae883 100644 --- a/.github/workflows/Test_ProvidedSetupFileChange.yml +++ b/.github/workflows/Test_ProvidedSetupFileChange.yml @@ -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 diff --git a/.github/workflows/Test_ProvidedSetupRanNoProj.yml b/.github/workflows/Test_ProvidedSetupRanNoProj.yml index c9c9bb86..6454367f 100644 --- a/.github/workflows/Test_ProvidedSetupRanNoProj.yml +++ b/.github/workflows/Test_ProvidedSetupRanNoProj.yml @@ -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 diff --git a/.github/workflows/Test_ProvidedSetupUpdated.yml b/.github/workflows/Test_ProvidedSetupUpdated.yml index 9b9e9c9e..4055dc01 100644 --- a/.github/workflows/Test_ProvidedSetupUpdated.yml +++ b/.github/workflows/Test_ProvidedSetupUpdated.yml @@ -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 diff --git a/.github/workflows/Test_UnauthenticatedSSHKey.yml b/.github/workflows/Test_UnauthenticatedSSHKey.yml index ae6a49ab..15813cc5 100644 --- a/.github/workflows/Test_UnauthenticatedSSHKey.yml +++ b/.github/workflows/Test_UnauthenticatedSSHKey.yml @@ -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 diff --git a/.github/workflows/Test_UserBrevProjectBrevV0.yml b/.github/workflows/Test_UserBrevProjectBrevV0.yml index 47d86cff..8c9fffda 100644 --- a/.github/workflows/Test_UserBrevProjectBrevV0.yml +++ b/.github/workflows/Test_UserBrevProjectBrevV0.yml @@ -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 diff --git a/.github/workflows/Test_UserBrevProjectBrevV1All.yml b/.github/workflows/Test_UserBrevProjectBrevV1All.yml index dc88cb60..00211e2a 100644 --- a/.github/workflows/Test_UserBrevProjectBrevV1All.yml +++ b/.github/workflows/Test_UserBrevProjectBrevV1All.yml @@ -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 diff --git a/.github/workflows/Test_UserBrevProjectBrevV1Minimal.yml b/.github/workflows/Test_UserBrevProjectBrevV1Minimal.yml index 5698d02a..e315cd60 100644 --- a/.github/workflows/Test_UserBrevProjectBrevV1Minimal.yml +++ b/.github/workflows/Test_UserBrevProjectBrevV1Minimal.yml @@ -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 diff --git a/.github/workflows/Test_VscodeExtension.yml b/.github/workflows/Test_VscodeExtension.yml index 4c1d27fb..4e309015 100644 --- a/.github/workflows/Test_VscodeExtension.yml +++ b/.github/workflows/Test_VscodeExtension.yml @@ -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 diff --git a/.github/workflows/Test_httpGit.yml b/.github/workflows/Test_httpGit.yml index 3cc5cc6b..171a7e10 100644 --- a/.github/workflows/Test_httpGit.yml +++ b/.github/workflows/Test_httpGit.yml @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0ee62778..2126acc8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version: 1.18 + cache: true - name: Build run: make fast-build diff --git a/.github/workflows/fmt.yml b/.github/workflows/fmt.yml index 52e8a9a2..e50a034b 100644 --- a/.github/workflows/fmt.yml +++ b/.github/workflows/fmt.yml @@ -23,6 +23,8 @@ jobs: - uses: actions/setup-go@v3 with: go-version: 1.18 + cache: true + - name: install run: make install diff --git a/.github/workflows/legacy.yml b/.github/workflows/legacy.yml index e47c53df..4b424251 100644 --- a/.github/workflows/legacy.yml +++ b/.github/workflows/legacy.yml @@ -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 @@ -63,6 +63,6 @@ jobs: - uses: actions/setup-go@v3 with: go-version: 1.18 - + cache: true - name: Release test run: make build diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5f2cdf68..660108aa 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version: 1.18 - + cache: true - name: install run: make install - name: lint @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a78dee7e..7ef900e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d1ae95d1..de4f4f8c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version: 1.18 - + cache: true - name: install run: make install - name: test @@ -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 }} diff --git a/.github/workflows/vet.yml b/.github/workflows/vet.yml index 18ecf3fd..1478c137 100644 --- a/.github/workflows/vet.yml +++ b/.github/workflows/vet.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version: 1.18 - + cache: true - name: install run: make install - name: vet @@ -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 }} diff --git a/bin/gen-e2e-actions.py b/bin/gen-e2e-actions.py index 7e57a6f0..9246eeb7 100644 --- a/bin/gen-e2e-actions.py +++ b/bin/gen-e2e-actions.py @@ -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: """ diff --git a/pkg/autostartconf/autostartconf.go b/pkg/autostartconf/autostartconf.go index 5a90eb99..74b0a6b9 100644 --- a/pkg/autostartconf/autostartconf.go +++ b/pkg/autostartconf/autostartconf.go @@ -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", diff --git a/pkg/cmd/envsetup/envsetup.go b/pkg/cmd/envsetup/envsetup.go index ef3d94d4..a9414f31 100644 --- a/pkg/cmd/envsetup/envsetup.go +++ b/pkg/cmd/envsetup/envsetup.go @@ -83,6 +83,7 @@ func NewCmdEnvSetup(store envsetupStore, noLoginStore nologinEnvStore) *cobra.Co token, noLoginStore, datadogAPIKey, + disableAutostop, ) if err != nil { errors = multierror.Append(err) @@ -111,6 +112,7 @@ func RunEnvSetup( workspaceid, token string, noLoginStore nologinEnvStore, datadogAPIKey string, + disableAutostop bool, ) error { if token != "" { err := noLoginStore.LoginWithToken(token) @@ -156,6 +158,7 @@ func RunEnvSetup( params, configureSystemSSHConfig, datadogAPIKey, + disableAutostop, ) if err != nil { return breverrors.WrapAndTrace(err) @@ -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, } @@ -468,6 +472,7 @@ func setupEnv( params *store.SetupParamsV0, configureSystemSSHConfig bool, datadogAPIKey string, + disableAutoStop bool, ) error { err := store.BuildBrevHome() if err != nil { @@ -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") diff --git a/pkg/cmd/postinstall/postinstall.go b/pkg/cmd/postinstall/postinstall.go index a34d6308..4dd915a6 100644 --- a/pkg/cmd/postinstall/postinstall.go +++ b/pkg/cmd/postinstall/postinstall.go @@ -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 {