Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAPS_SSH_KEY: ${{ secrets.HOMEBREW_TAPS_SSH_KEY }}
MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }}
MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }}
6 changes: 6 additions & 0 deletions cmd/auth/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func setupTestEnvironment(t *testing.T) (*httptest.Server, func()) {
require.NoError(t, err)

originalHome := os.Getenv("HOME")

os.Setenv("HOME", tempDir)

// Save original callback function.
Expand Down Expand Up @@ -62,6 +63,7 @@ func setupTestEnvironment(t *testing.T) (*httptest.Server, func()) {
}
}))
viper.Set(config.DataRobotURL, server.URL+"/api/v2")

err = config.CreateConfigFileDirIfNotExists()
require.NoError(t, err)

Expand Down Expand Up @@ -153,14 +155,17 @@ func TestEnsureAuthenticated_NoURL(t *testing.T) {
defer os.RemoveAll(tempDir)

originalHome := os.Getenv("HOME")

os.Setenv("HOME", tempDir)

defer os.Setenv("HOME", originalHome)

viper.Reset()

os.Unsetenv("DATAROBOT_ENDPOINT")
os.Unsetenv("DATAROBOT_API_TOKEN")
viper.Set(config.DataRobotURL, "")

baseURL := config.GetBaseURL()
assert.Empty(t, baseURL, "Expected GetBaseURL to return empty string")

Expand Down Expand Up @@ -202,6 +207,7 @@ func TestConfig_ConfigFilePath(t *testing.T) {
defer os.RemoveAll(tempDir)

originalHome := os.Getenv("HOME")

os.Setenv("HOME", tempDir)

defer os.Setenv("HOME", originalHome)
Expand Down
2 changes: 2 additions & 0 deletions cmd/task/list/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func Cmd() *cobra.Command {

if !runner.Installed() {
_, _ = fmt.Fprintln(os.Stderr, `"`+binaryName+`" binary not found in PATH. Please install Task from https://taskfile.dev/installation/`)

os.Exit(1)

return
Expand All @@ -51,6 +52,7 @@ func Cmd() *cobra.Command {
tasks, err := runner.ListTasks()
if err != nil {
_, _ = fmt.Fprintln(os.Stderr, "Error:", err)

os.Exit(1)

return
Expand Down
2 changes: 2 additions & 0 deletions cmd/task/run/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func Cmd() *cobra.Command {

if !runner.Installed() {
_, _ = fmt.Fprintln(os.Stderr, `"`+binaryName+`" binary not found in PATH. Please install Task from https://taskfile.dev/installation/`)

os.Exit(1)

return
Expand All @@ -74,6 +75,7 @@ func Cmd() *cobra.Command {
}

_, _ = fmt.Fprintln(os.Stderr, "Error:", err)

os.Exit(exitCode)
}
},
Expand Down
1 change: 1 addition & 0 deletions cmd/templates/setup/loginModel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func (suite *LoginModelTestSuite) AfterTest(suiteName, testName string) {
_, _ = suiteName, testName

os.RemoveAll(suite.tempDir) // Clean up the temporary directory after each test

dir, _ := os.MkdirTemp("", "datarobot-config-test")
suite.tempDir = dir
suite.T().Setenv("HOME", suite.tempDir)
Expand Down
16 changes: 16 additions & 0 deletions goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,19 @@ homebrew_casks:
commit_author:
name: goreleaserbot
email: bot@goreleaser.com

notarize:
macos:
- enabled: '{{ isEnvSet "MACOS_SIGN_P12" }}'
ids: [darwin]
sign:
certificate: "{{ .Env.MACOS_SIGN_P12 }}"
password: "{{ .Env.MACOS_SIGN_PASSWORD }}"
notarize:
issuer_id: "{{.Env.MACOS_NOTARY_ISSUER_ID}}"
key_id: "{{.Env.MACOS_NOTARY_KEY_ID}}"
key: "{{.Env.MACOS_NOTARY_KEY}}"
# Whether to wait for the notarization to finish.
# Not recommended, as it could take a really long time.
wait: true
timeout: 20m
2 changes: 2 additions & 0 deletions internal/config/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ func SaveURLToConfig(newURL string) error {
if newURL == "" {
viper.Set(DataRobotURL, "")
viper.Set(DataRobotAPIKey, "")

_ = viper.WriteConfig()

return nil
}

viper.Set(DataRobotURL, newURL+"/api/v2")

_ = viper.WriteConfig()

return nil
Expand Down
1 change: 1 addition & 0 deletions internal/task/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func ExitWithError(err error) {
}

_, _ = fmt.Fprintln(os.Stderr, "Error discovering tasks:", err)

os.Exit(1)
}

Expand Down
Loading