Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error should be returned if BYORegistryEnabled is true but BYORegistryDomain is empty #1639

Merged
merged 2 commits into from
May 2, 2024
Merged
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
3 changes: 3 additions & 0 deletions cmd/software/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ func deployAirflow(cmd *cobra.Command, args []string) error {
if appConfig != nil && appConfig.Flags.BYORegistryEnabled {
byoRegistryEnabled = true
byoRegistryDomain = appConfig.BYORegistryDomain
if byoRegistryDomain == "" {
return deploy.ErrBYORegistryDomainNotSet
}
}
if isDagOnlyDeploy {
return DagsOnlyDeploy(houstonClient, appConfig, ws, deploymentID, config.WorkingPath, nil, true)
Expand Down
15 changes: 15 additions & 0 deletions cmd/software/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,19 @@ func TestDeploy(t *testing.T) {
err := execDeployCmd([]string{"test-deployment-id", "--dags", "--force"}...)
assert.ErrorIs(t, err, deploy.ErrDagOnlyDeployDisabledInConfig)
})

t.Run("error should be returned if BYORegistryEnabled is true but BYORegistryDomain is empty", func(t *testing.T) {
appConfig = &houston.AppConfig{
BYORegistryDomain: "",
Flags: houston.FeatureFlags{
BYORegistryEnabled: true,
},
}
DagsOnlyDeploy = func(houstonClient houston.ClientInterface, appConfig *houston.AppConfig, wsID, deploymentID, dagsParentPath string, dagDeployURL *string, cleanUpFiles bool) error {
return deploy.ErrNoWorkspaceID
}
err := execDeployCmd([]string{"-f"}...)
assert.ErrorIs(t, err, deploy.ErrBYORegistryDomainNotSet)
DagsOnlyDeploy = deploy.DagsOnlyDeploy
})
}
1 change: 1 addition & 0 deletions software/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var (
ErrDagOnlyDeployDisabledInConfig = errors.New("to perform this operation, set both deployments.dagOnlyDeployment and deployments.configureDagDeployment to true in your Astronomer cluster")
ErrDagOnlyDeployNotEnabledForDeployment = errors.New("to perform this operation, first set the Deployment type to 'dag_deploy' via the UI or the API or the CLI")
ErrEmptyDagFolderUserCancelledOperation = errors.New("no DAGs found in the dags folder. User canceled the operation")
ErrBYORegistryDomainNotSet = errors.New("Custom registry host is not set in config. It can be set at astronomer.houston.config.deployments.registry.protectedCustomRegistry.updateRegistry.host") //nolint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rishkarajgi is this wording is okay

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the linting check removed for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kushalmalani It says Capital letters are not allowed within a string. So, protectedCustomRegistry was giving an error :P

)

const (
Expand Down