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

astronomer / astro-cli / 28970289308

08 Jul 2026 07:35PM UTC coverage: 43.611% (-1.7%) from 45.328%
28970289308

Pull #2198

github

web-flow
Merge c33eb2682 into 44bc04a46
Pull Request #2198: Expose non-DAG bundle deploys and bundle management

376 of 3398 new or added lines in 11 files covered. (11.07%)

17 existing lines in 2 files now uncovered.

25531 of 58542 relevant lines covered (43.61%)

8.25 hits per line

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

90.0
/cmd/cloud/deployment_bundle.go
1
package cloud
2

3
import (
4
        "io"
5

6
        "github.com/pkg/errors"
7
        "github.com/spf13/cobra"
8

9
        "github.com/astronomer/astro-cli/cloud/deployment"
10
        "github.com/astronomer/astro-cli/pkg/output"
11
)
12

13
var (
14
        bundleName            string
15
        bundleMountPath       string
16
        bundleNonDagType      string
17
        bundleDescription     string
18
        bundleDagBundleIDs    []string
19
        forceBundleDelete     bool
20
        bundleListOutputFlags output.Flags
21
)
22

23
func newDeploymentBundleRootCmd(out io.Writer) *cobra.Command {
87✔
24
        cmd := &cobra.Command{
87✔
25
                Use:     "bundle",
87✔
26
                Aliases: []string{"bundles"},
87✔
27
                Short:   "Manage the DAG and non-DAG bundles on an Astro Deployment",
87✔
28
                Long:    "Manage the bundles registered on an Astro Deployment. DAG bundles carry DAGs and are targeted by 'astro deploy --dag-bundle-name'; non-DAG bundles mount other content (e.g. dbt projects) at a path.",
87✔
29
                Hidden:  true,
87✔
30
        }
87✔
31
        cmd.SetOut(out)
87✔
32
        cmd.AddCommand(
87✔
33
                newDeploymentBundleCreateCmd(out),
87✔
34
                newDeploymentBundleListCmd(out),
87✔
35
                newDeploymentBundleUpdateCmd(out),
87✔
36
                newDeploymentBundleDeleteCmd(out),
87✔
37
        )
87✔
38
        cmd.PersistentFlags().StringVar(&deploymentID, "deployment-id", "", "The Deployment whose bundles you'd like to manage. Run 'astro deployment list' to find valid IDs")
87✔
39
        return cmd
87✔
40
}
87✔
41

42
func newDeploymentBundleCreateCmd(out io.Writer) *cobra.Command {
87✔
43
        cmd := &cobra.Command{
87✔
44
                Use:   "create",
87✔
45
                Short: "Create a bundle on an Astro Deployment",
87✔
46
                Long:  "Create a DAG bundle (with --name) or a non-DAG bundle (with --mount-path) on an Astro Deployment.",
87✔
47
                Example: `  # Create a named DAG bundle
87✔
48
  astro deployment bundle create --deployment-id <id> --name my-dags
87✔
49

87✔
50
  # Create a non-DAG bundle mounted at a path
87✔
51
  astro deployment bundle create --deployment-id <id> --mount-path /usr/local/airflow/dbt --bundle-type dbt`,
87✔
52
                RunE: func(cmd *cobra.Command, args []string) error {
89✔
53
                        ws, err := coalesceWorkspace()
2✔
54
                        if err != nil {
2✔
NEW
55
                                return errors.Wrap(err, "failed to find a valid workspace")
×
NEW
56
                        }
×
57
                        cmd.SilenceUsage = true
2✔
58
                        return deployment.CreateBundle(bundleName, bundleMountPath, bundleNonDagType, bundleDescription, bundleDagBundleIDs, ws, deploymentID, out, astroV1Client, astroV1Alpha1Client)
2✔
59
                },
60
        }
61
        cmd.Flags().StringVar(&bundleName, "name", "", "Name of the DAG bundle to create. Mutually exclusive with --mount-path")
87✔
62
        cmd.Flags().StringVar(&bundleMountPath, "mount-path", "", "Mount path for a non-DAG bundle. Mutually exclusive with --name")
87✔
63
        cmd.Flags().StringVar(&bundleNonDagType, "bundle-type", "", "Type of a non-DAG bundle (e.g. dbt). Only valid with --mount-path")
87✔
64
        cmd.Flags().StringVar(&bundleDescription, "description", "", "Description for the bundle")
87✔
65
        cmd.Flags().StringSliceVar(&bundleDagBundleIDs, "dag-bundle-ids", nil, "DAG bundle IDs a non-DAG bundle is served alongside. Only valid with --mount-path")
87✔
66
        return cmd
87✔
67
}
68

69
func newDeploymentBundleListCmd(out io.Writer) *cobra.Command {
87✔
70
        cmd := &cobra.Command{
87✔
71
                Use:     "list",
87✔
72
                Aliases: []string{"ls"},
87✔
73
                Short:   "List the bundles on an Astro Deployment",
87✔
74
                Long:    "List every DAG and non-DAG bundle registered on an Astro Deployment.",
87✔
75
                Example: `  astro deployment bundle list --deployment-id <id>
87✔
76
  astro deployment bundle list --deployment-id <id> --json`,
87✔
77
                RunE: func(cmd *cobra.Command, args []string) error {
88✔
78
                        format, err := bundleListOutputFlags.Resolve()
1✔
79
                        if err != nil {
1✔
NEW
80
                                return err
×
NEW
81
                        }
×
82
                        ws, err := coalesceWorkspace()
1✔
83
                        if err != nil {
1✔
NEW
84
                                return errors.Wrap(err, "failed to find a valid workspace")
×
NEW
85
                        }
×
86
                        cmd.SilenceUsage = true
1✔
87
                        return deployment.ListBundlesWithFormat(ws, deploymentID, format, bundleListOutputFlags.Template, out, astroV1Client, astroV1Alpha1Client)
1✔
88
                },
89
        }
90
        bundleListOutputFlags.AddFlags(cmd)
87✔
91
        return cmd
87✔
92
}
93

94
func newDeploymentBundleUpdateCmd(out io.Writer) *cobra.Command {
87✔
95
        cmd := &cobra.Command{
87✔
96
                Use:   "update BUNDLE-ID",
87✔
97
                Short: "Update a bundle on an Astro Deployment",
87✔
98
                Long:  "Update a bundle's description or, for a non-DAG bundle, the DAG bundles it is served alongside.",
87✔
99
                Example: `  # Update a bundle's description
87✔
100
  astro deployment bundle update <bundle-id> --deployment-id <id> --description "my bundle"
87✔
101

87✔
102
  # Re-associate a non-DAG bundle with a different set of DAG bundles
87✔
103
  astro deployment bundle update <bundle-id> --deployment-id <id> --dag-bundle-ids <dag-bundle-id>`,
87✔
104
                Args: cobra.ExactArgs(1),
87✔
105
                RunE: func(cmd *cobra.Command, args []string) error {
88✔
106
                        ws, err := coalesceWorkspace()
1✔
107
                        if err != nil {
1✔
NEW
108
                                return errors.Wrap(err, "failed to find a valid workspace")
×
NEW
109
                        }
×
110
                        cmd.SilenceUsage = true
1✔
111
                        return deployment.UpdateBundle(args[0], bundleDescription, bundleDagBundleIDs, ws, deploymentID, out, astroV1Client, astroV1Alpha1Client)
1✔
112
                },
113
        }
114
        cmd.Flags().StringVar(&bundleDescription, "description", "", "New description for the bundle")
87✔
115
        cmd.Flags().StringSliceVar(&bundleDagBundleIDs, "dag-bundle-ids", nil, "DAG bundle IDs a non-DAG bundle is served alongside. Replaces the existing set")
87✔
116
        return cmd
87✔
117
}
118

119
func newDeploymentBundleDeleteCmd(out io.Writer) *cobra.Command {
87✔
120
        cmd := &cobra.Command{
87✔
121
                Use:     "delete BUNDLE-ID",
87✔
122
                Aliases: []string{"rm"},
87✔
123
                Short:   "Delete a bundle from an Astro Deployment",
87✔
124
                Long:    "Delete a DAG or non-DAG bundle from an Astro Deployment.",
87✔
125
                Example: `  astro deployment bundle delete <bundle-id> --deployment-id <id>`,
87✔
126
                Args:    cobra.ExactArgs(1),
87✔
127
                RunE: func(cmd *cobra.Command, args []string) error {
88✔
128
                        ws, err := coalesceWorkspace()
1✔
129
                        if err != nil {
1✔
NEW
130
                                return errors.Wrap(err, "failed to find a valid workspace")
×
NEW
131
                        }
×
132
                        cmd.SilenceUsage = true
1✔
133
                        return deployment.DeleteBundle(args[0], ws, deploymentID, forceBundleDelete, out, astroV1Client, astroV1Alpha1Client)
1✔
134
                },
135
        }
136
        cmd.Flags().BoolVarP(&forceBundleDelete, "force", "f", false, "Delete the bundle without confirmation")
87✔
137
        return cmd
87✔
138
}
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