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

track github action deploys #1679

Merged
merged 4 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 8 additions & 3 deletions astro-client-core/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"net/http"
"net/url"
"os"
"runtime"

"github.com/astronomer/astro-cli/context"
Expand Down Expand Up @@ -49,7 +50,7 @@ func CoreRequestEditor(ctx httpContext.Context, req *http.Request) error {
if err != nil {
return nil
}
os := runtime.GOOS
operatingSystem := runtime.GOOS
arch := runtime.GOARCH
baseURL := currentCtx.GetPublicRESTAPIURL("v1alpha1")
requestURL, err := url.Parse(baseURL + req.URL.String())
Expand All @@ -58,9 +59,13 @@ func CoreRequestEditor(ctx httpContext.Context, req *http.Request) error {
}
req.URL = requestURL
req.Header.Add("authorization", currentCtx.Token)
req.Header.Add("x-astro-client-identifier", "cli")
if os.Getenv("GITHUB_ACTIONS") == "true" {
req.Header.Add("x-astro-client-identifier", "github-action")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we track github actions version also?

Copy link
Contributor

Choose a reason for hiding this comment

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

we should make the user agent also for github actions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'm not really sure how to do that

} else {
req.Header.Add("x-astro-client-identifier", "cli")
}
req.Header.Add("x-astro-client-version", version.CurrVersion)
req.Header.Add("x-client-os-identifier", os+"-"+arch)
req.Header.Add("x-client-os-identifier", operatingSystem+"-"+arch)
req.Header.Add("User-Agent", fmt.Sprintf("astro-cli/%s", version.CurrVersion))
return nil
}
11 changes: 8 additions & 3 deletions astro-client-iam-core/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"net/http"
"net/url"
"os"
"runtime"

"github.com/astronomer/astro-cli/context"
Expand Down Expand Up @@ -48,7 +49,7 @@ func CoreRequestEditor(ctx httpContext.Context, req *http.Request) error {
if err != nil {
return nil
}
os := runtime.GOOS
operatingSystem := runtime.GOOS
arch := runtime.GOARCH
baseURL := currentCtx.GetPublicRESTAPIURL("iam/v1beta1")
requestURL, err := url.Parse(baseURL + req.URL.String())
Expand All @@ -57,9 +58,13 @@ func CoreRequestEditor(ctx httpContext.Context, req *http.Request) error {
}
req.URL = requestURL
req.Header.Add("authorization", currentCtx.Token)
req.Header.Add("x-astro-client-identifier", "cli")
if os.Getenv("GITHUB_ACTIONS") == "true" {
req.Header.Add("x-astro-client-identifier", "github-action")
} else {
req.Header.Add("x-astro-client-identifier", "cli")
}
req.Header.Add("x-astro-client-version", version.CurrVersion)
req.Header.Add("x-client-os-identifier", os+"-"+arch)
req.Header.Add("x-client-os-identifier", operatingSystem+"-"+arch)
req.Header.Add("User-Agent", fmt.Sprintf("astro-cli/%s", version.CurrVersion))
return nil
}
11 changes: 8 additions & 3 deletions astro-client-platform-core/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"net/http"
"net/url"
"os"
"runtime"

"github.com/astronomer/astro-cli/context"
Expand Down Expand Up @@ -37,7 +38,7 @@ func requestEditor(ctx httpContext.Context, req *http.Request) error {
if err != nil {
return nil
}
os := runtime.GOOS
operatingSystem := runtime.GOOS
arch := runtime.GOARCH
baseURL := currentCtx.GetPublicRESTAPIURL("platform/v1beta1")
requestURL, err := url.Parse(baseURL + req.URL.String())
Expand All @@ -46,10 +47,14 @@ func requestEditor(ctx httpContext.Context, req *http.Request) error {
}
req.URL = requestURL
req.Header.Add("authorization", currentCtx.Token)
req.Header.Add("x-astro-client-identifier", "cli")
if os.Getenv("GITHUB_ACTIONS") == "true" {
req.Header.Add("x-astro-client-identifier", "github-action")
} else {
req.Header.Add("x-astro-client-identifier", "cli")
}

req.Header.Add("x-astro-client-version", version.CurrVersion)
req.Header.Add("x-client-os-identifier", os+"-"+arch)
req.Header.Add("x-client-os-identifier", operatingSystem+"-"+arch)
req.Header.Add("User-Agent", fmt.Sprintf("astro-cli/%s", version.CurrVersion))
return nil
}
Expand Down