Skip to content

Commit

Permalink
Add the Airflow API URL to the deployment inspect output (#1614)
Browse files Browse the repository at this point in the history
Our docs currently tell people to get the webserver_url and then
manually strip off the org id which is error prone (people forget to do
it).

Given that the API already has a field for exactly this lets just expose
it for users to use!
  • Loading branch information
ashb committed Apr 9, 2024
1 parent 635b0f1 commit f48a2a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cloud/deployment/inspect/inspect.go
Expand Up @@ -29,6 +29,7 @@ type deploymentMetadata struct {
UpdatedAt *time.Time `mapstructure:"updated_at" yaml:"updated_at" json:"updated_at"`
DeploymentURL *string `mapstructure:"deployment_url" yaml:"deployment_url" json:"deployment_url"`
WebserverURL *string `mapstructure:"webserver_url" yaml:"webserver_url" json:"webserver_url"`
AirflowAPIURL *string `mapstructure:"airflow_api_url" yaml:"airflow_api_url" json:"airflow_api_url"`
HibernationOverride *HibernationOverride `mapstructure:"hibernation_override,omitempty" yaml:"hibernation_override,omitempty" json:"hibernation_override,omitempty"`
}

Expand Down Expand Up @@ -200,6 +201,7 @@ func getDeploymentInfo(coreDeployment astroplatformcore.Deployment) (map[string]
"release_name": releaseName,
"deployment_url": deploymentURL,
"webserver_url": coreDeployment.WebServerUrl,
"airflow_api_url": coreDeployment.WebServerAirflowApiUrl,
"created_at": coreDeployment.CreatedAt,
"updated_at": coreDeployment.UpdatedAt,
"status": coreDeployment.Status,
Expand Down
4 changes: 3 additions & 1 deletion cloud/deployment/inspect/inspect_test.go
Expand Up @@ -180,7 +180,7 @@ var (
AirflowVersion: "2.4.0",
SchedulerAu: &schedulerAU,
SchedulerReplicas: schedulerReplicas,
WebServerAirflowApiUrl: "some-url",
WebServerAirflowApiUrl: "some-url/api/v1",
EnvironmentVariables: &deploymentEnvironmentVariable,
WorkerQueues: &workerqueue,
UpdatedAt: time.Now(),
Expand Down Expand Up @@ -877,6 +877,7 @@ func TestFormatPrintableDeployment(t *testing.T) {
updated_at: 2023-02-01T12:00:00Z
deployment_url: cloud.astronomer.io/test-ws-id/deployments/test-deployment-id/overview
webserver_url: some-url
airflow_api_url: some-url/api/v1
hibernation_override:
is_hibernating: true
override_until: 2023-02-01T12:00:00Z
Expand Down Expand Up @@ -976,6 +977,7 @@ func TestFormatPrintableDeployment(t *testing.T) {
"updated_at": "2022-11-17T12:26:45.362983-08:00",
"deployment_url": "cloud.astronomer.io/test-ws-id/deployments/test-deployment-id/overview",
"webserver_url": "some-url",
"airflow_api_url": "some-url/api/v1"
"hibernation_override": {
"is_hibernating": true,
"override_until": "2022-11-17T12:26:45.362983-08:00"
Expand Down

0 comments on commit f48a2a0

Please sign in to comment.