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

astronomer / astro-cli / ad3bf534-ee25-491b-9886-17cbc3b80c2e

08 Apr 2026 04:33PM UTC coverage: 39.38% (+0.04%) from 39.344%
ad3bf534-ee25-491b-9886-17cbc3b80c2e

Pull #2075

circleci

jeremybeard
Support local spec files for --spec-url flag

Allow --spec-url to accept local file paths (absolute, relative, ~/,
file://) in addition to HTTP URLs. Local specs are read fresh on every
Load() call with no caching, which is ideal for development workflows.
Pull Request #2075: Support local spec files for --spec-url

48 of 52 new or added lines in 2 files covered. (92.31%)

6 existing lines in 1 file now uncovered.

24885 of 63192 relevant lines covered (39.38%)

9.51 hits per line

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

34.62
/docker/docker.go
1
package docker
2

3
import (
4
        "fmt"
5
        "io"
6
        "os"
7
        "os/exec"
8

9
        "github.com/docker/docker/api/types"
10
        "github.com/docker/docker/pkg/stdcopy"
11
        "golang.org/x/term"
12

13
        "github.com/astronomer/astro-cli/airflow/runtimes"
14
)
15

16
const (
17
        // Docker is the docker command.
18
        Docker = "docker"
19
)
20

21
// AirflowCommand is the main method of interaction with Airflow
22
func AirflowCommand(id, airflowCommand string) (string, error) {
×
23
        containerRuntime, err := runtimes.GetContainerRuntimeBinary()
×
24
        if err != nil {
×
25
                return "", err
×
26
        }
×
27
        args := []string{"exec", "-i"}
×
28
        if term.IsTerminal(int(os.Stdin.Fd())) {
×
29
                args = append(args, "-t")
×
30
        }
×
31
        args = append(args, id, "bash", "-c", airflowCommand)
×
32
        cmd := exec.Command(containerRuntime, args...)
×
33
        cmd.Stdin = os.Stdin
×
34
        cmd.Stderr = os.Stderr
×
35

×
36
        out, err := cmd.Output()
×
37
        if err != nil {
×
38
                return "", fmt.Errorf("error encountered while running the airflow command: %w", err)
×
39
        }
×
40

41
        stringOut := string(out)
×
42
        return stringOut, nil
×
43
}
44

45
// ExecPipe does pipe stream into stdout/stdin and stderr
46
// so now we can pipe out during exec'ing any commands inside container
47
func ExecPipe(resp types.HijackedResponse, inStream io.Reader, outStream, errorStream io.Writer) error {
1✔
48
        var err error
1✔
49
        receiveStdout := make(chan error, 1)
1✔
50
        if outStream != nil || errorStream != nil {
2✔
51
                go func() {
2✔
52
                        // always do this because we are never tty
1✔
53
                        _, err = stdcopy.StdCopy(outStream, errorStream, resp.Reader)
1✔
54
                        receiveStdout <- err
1✔
55
                }()
1✔
56
        }
57

58
        stdinDone := make(chan struct{})
1✔
59
        go func() {
2✔
60
                if inStream != nil {
2✔
61
                        _, err := io.Copy(resp.Conn, inStream)
1✔
62
                        if err != nil {
1✔
63
                                fmt.Println("Error copying input stream: ", err.Error())
×
64
                        }
×
65
                }
66

UNCOV
67
                err := resp.CloseWrite()
×
UNCOV
68
                if err != nil {
×
69
                        fmt.Println("Error closing response body: ", err.Error())
×
70
                }
×
UNCOV
71
                close(stdinDone)
×
72
        }()
73

74
        select {
1✔
75
        case err := <-receiveStdout:
1✔
76
                if err != nil {
1✔
77
                        return err
×
78
                }
×
UNCOV
79
        case <-stdinDone:
×
UNCOV
80
                if outStream != nil || errorStream != nil {
×
UNCOV
81
                        if err := <-receiveStdout; err != nil {
×
82
                                return err
×
83
                        }
×
84
                }
85
        }
86

87
        return nil
1✔
88
}
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