• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

astronomer / astro-cli / fc632fcc-6f64-4bcc-a917-49c509c77432

28 Nov 2025 01:32AM UTC coverage: 39.41% (+6.3%) from 33.132%
fc632fcc-6f64-4bcc-a917-49c509c77432

Pull #1988

circleci

Simpcyclassy
Add Houston API 1.1.0 support - remove desiredRuntimeVersion and AC fields

- Add version 1.1.0 queries for DeploymentGetRequest
- Add version 1.1.0 queries for DeploymentsGetRequest
- Add version 1.1.0 queries for PaginatedDeploymentsGetRequest
- Add version 1.1.0 mutations for DeploymentCreateRequest
- Add version 1.1.0 mutations for DeploymentUpdateRequest
- Remove airflowVersion, desiredAirflowVersion, desiredRuntimeVersion fields
- Use runtimeVersion and runtimeAirflowVersion instead

Houston API 1.1.0 no longer returns desired version and AC fields.
All version information is now managed through runtimeVersion.
Pull Request #1988: Add Houston API 1.1.0 support - remove desiredRuntimeVersion and AC fields

23684 of 60096 relevant lines covered (39.41%)

11.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.43
/cmd/cloud/deploy.go
1
package cloud
2

3
import (
4
        "fmt"
5

6
        cloud "github.com/astronomer/astro-cli/cloud/deploy"
7
        "github.com/astronomer/astro-cli/cmd/utils"
8
        "github.com/astronomer/astro-cli/config"
9
        "github.com/astronomer/astro-cli/pkg/git"
10
        "github.com/astronomer/astro-cli/pkg/util"
11
        "github.com/pkg/errors"
12
        "github.com/spf13/cobra"
13
)
14

15
var (
16
        forceDeploy       bool
17
        forcePrompt       bool
18
        saveDeployConfig  bool
19
        pytest            bool
20
        parse             bool
21
        dags              bool
22
        waitForDeploy     bool
23
        image             bool
24
        dagsPath          string
25
        pytestFile        string
26
        envFile           string
27
        imageName         string
28
        deploymentName    string
29
        deployDescription string
30
        deployExample     = `
31
Specify the ID of the Deployment on Astronomer you would like to deploy this project to:
32

33
  $ astro deploy <deployment ID>
34

35
Menu will be presented if you do not specify a deployment ID:
36

37
  $ astro deploy
38
`
39

40
        DeployImage       = cloud.Deploy
41
        EnsureProjectDir  = utils.EnsureProjectDir
42
        buildSecrets      = []string{}
43
        forceUpgradeToAF3 bool
44
)
45

46
const (
47
        registryUncommitedChangesMsg = "Project directory has uncommitted changes, use `astro deploy [deployment-id] -f` to force deploy."
48
)
49

50
func NewDeployCmd() *cobra.Command {
13✔
51
        cmd := &cobra.Command{
13✔
52
                Use:     "deploy DEPLOYMENT-ID",
13✔
53
                Short:   "Deploy your project to a Deployment on Astro",
13✔
54
                Long:    "Deploy your project to a Deployment on Astro. This command bundles your project files into a Docker image and pushes that Docker image to Astronomer. It does not include any metadata associated with your local Airflow environment.",
13✔
55
                Args:    cobra.MaximumNArgs(1),
13✔
56
                PreRunE: EnsureProjectDir,
13✔
57
                RunE:    deploy,
13✔
58
                Example: deployExample,
13✔
59
        }
13✔
60
        cmd.Flags().BoolVarP(&forceDeploy, "force", "f", false, "Force deploy even if project contains errors or uncommitted changes")
13✔
61
        cmd.Flags().BoolVarP(&forcePrompt, "prompt", "p", false, "Force prompt to choose target deployment")
13✔
62
        cmd.Flags().BoolVarP(&saveDeployConfig, "save", "s", false, "Save deployment in config for future deploys")
13✔
63
        cmd.Flags().StringVar(&workspaceID, "workspace-id", "", "Workspace for your Deployment")
13✔
64
        cmd.Flags().BoolVar(&pytest, "pytest", false, "Deploy code to Astro only if the specified Pytests are passed")
13✔
65
        cmd.Flags().StringVarP(&envFile, "env", "e", ".env", "Location of file containing environment variables for Pytests")
13✔
66
        cmd.Flags().StringVarP(&pytestFile, "test", "t", "", "Location of Pytests or specific Pytest file. All Pytest files must be located in the tests directory")
13✔
67
        cmd.Flags().StringVarP(&imageName, "image-name", "i", "", "Name of a custom image to deploy")
13✔
68
        cmd.Flags().BoolVarP(&dags, "dags", "d", false, "Push only DAGs to your Astro Deployment")
13✔
69
        cmd.Flags().BoolVarP(&image, "image", "", false, "Push only an image to your Astro Deployment. If you have DAG Deploy enabled your DAGs will not be affected.")
13✔
70
        cmd.Flags().StringVar(&dagsPath, "dags-path", "", "If set deploy dags from this path instead of the dags from working directory")
13✔
71
        cmd.Flags().StringVarP(&deploymentName, "deployment-name", "n", "", "Name of the deployment to deploy to")
13✔
72
        cmd.Flags().BoolVar(&parse, "parse", false, "Succeed only if all DAGs in your Astro project parse without errors")
13✔
73
        cmd.Flags().BoolVarP(&waitForDeploy, "wait", "w", false, "Wait for the Deployment to become healthy before ending the command")
13✔
74
        cmd.Flags().MarkHidden("dags-path") //nolint:errcheck
13✔
75
        cmd.Flags().StringVarP(&deployDescription, "description", "", "", "Add a description for more context on this deploy")
13✔
76
        cmd.Flags().StringSliceVar(&buildSecrets, "build-secrets", []string{}, "Mimics docker build --secret flag. See https://docs.docker.com/build/building/secrets/ for more information. Example input id=mysecret,src=secrets.txt")
13✔
77
        cmd.Flags().BoolVar(&forceUpgradeToAF3, "force-upgrade-to-af3", false, "Force allow upgrade from Airflow 2 to Airflow 3")
13✔
78
        return cmd
13✔
79
}
13✔
80

81
func deployTests(parse, pytest, forceDeploy bool, pytestFile string) string {
10✔
82
        if pytest && pytestFile == "" {
15✔
83
                pytestFile = "all-tests"
5✔
84
        }
5✔
85

86
        if !parse && !pytest && !forceDeploy || parse && !pytest && !forceDeploy || parse && !pytest && forceDeploy {
13✔
87
                pytestFile = "parse"
3✔
88
        }
3✔
89

90
        if parse && pytest {
13✔
91
                pytestFile = "parse-and-all-tests"
3✔
92
        }
3✔
93

94
        return pytestFile
10✔
95
}
96

97
func deploy(cmd *cobra.Command, args []string) error {
12✔
98
        deploymentID = ""
12✔
99

12✔
100
        // Get deploymentId from args, if passed
12✔
101
        if len(args) > 0 {
23✔
102
                deploymentID = args[0]
11✔
103
        }
11✔
104

105
        if deploymentID == "" || forcePrompt || workspaceID == "" {
24✔
106
                var err error
12✔
107
                workspaceID, err = coalesceWorkspace()
12✔
108
                if err != nil {
12✔
109
                        return errors.Wrap(err, "failed to find a valid workspace")
×
110
                }
×
111
        }
112

113
        if dags && image {
12✔
114
                return errors.New("cannot use both --dags and --image together. Run 'astro deploy' to update both your image and dags")
×
115
        }
×
116

117
        // Save deploymentId in config if specified
118
        if deploymentID != "" && saveDeployConfig {
13✔
119
                err := config.CFG.ProjectDeployment.SetProjectString(deploymentID)
1✔
120
                if err != nil {
1✔
121
                        return nil
×
122
                }
×
123
        }
124

125
        if git.HasUncommittedChanges("") && !forceDeploy {
12✔
126
                fmt.Println(registryUncommitedChangesMsg)
×
127
                return nil
×
128
        }
×
129

130
        // case for astro deploy --dags whose default operation should be not running any tests
131
        if dags && !parse && !pytest {
14✔
132
                pytestFile = ""
2✔
133
        } else {
12✔
134
                pytestFile = deployTests(parse, pytest, forceDeploy, pytestFile)
10✔
135
        }
10✔
136

137
        // Silence Usage as we have now validated command input
138
        cmd.SilenceUsage = true
12✔
139

12✔
140
        BuildSecretString := util.GetbuildSecretString(buildSecrets)
12✔
141

12✔
142
        deployInput := cloud.InputDeploy{
12✔
143
                Path:              config.WorkingPath,
12✔
144
                RuntimeID:         deploymentID,
12✔
145
                WsID:              workspaceID,
12✔
146
                Pytest:            pytestFile,
12✔
147
                EnvFile:           envFile,
12✔
148
                ImageName:         imageName,
12✔
149
                DeploymentName:    deploymentName,
12✔
150
                Prompt:            forcePrompt,
12✔
151
                Dags:              dags,
12✔
152
                Image:             image,
12✔
153
                WaitForStatus:     waitForDeploy,
12✔
154
                DagsPath:          dagsPath,
12✔
155
                Description:       deployDescription,
12✔
156
                BuildSecretString: BuildSecretString,
12✔
157
                ForceUpgradeToAF3: forceUpgradeToAF3,
12✔
158
        }
12✔
159

12✔
160
        return DeployImage(deployInput, platformCoreClient, astroCoreClient)
12✔
161
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc