From 945ff390619f20fcceab5b7313147c21cc6ea6e1 Mon Sep 17 00:00:00 2001 From: duplo-bot Date: Wed, 3 Jan 2024 16:56:14 +0000 Subject: [PATCH 01/15] version bump --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d449e3c..6d57aaf 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=0.5.5 +VERSION=0.5.6 default: all From 449719a3d56eada43377aecf235d8414ed300abe Mon Sep 17 00:00:00 2001 From: Joe Khoobyar Date: Tue, 23 Jan 2024 13:27:15 -0500 Subject: [PATCH 02/15] add codium AI pr agent --- .pr_agent.toml | 23 +++++++++++++++++++++++ CHANGELOG.md | 0 2 files changed, 23 insertions(+) create mode 100644 .pr_agent.toml create mode 100644 CHANGELOG.md diff --git a/.pr_agent.toml b/.pr_agent.toml new file mode 100644 index 0000000..674df36 --- /dev/null +++ b/.pr_agent.toml @@ -0,0 +1,23 @@ +# See: https://github.com/Codium-ai/pr-agent/blob/main/Usage.md#working-with-github-app +# See: https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml + +[pr_reviewer] +enable_review_labels_effort = true + +[pr_description] +add_original_user_description = true +keep_original_user_title = true + +[github_app] +handle_pr_actions = ['opened', 'reopened', 'ready_for_review', 'review_requested'] +pr_commands = [ + "/describe", + "/review", + "/update_changelog" +] +handle_push_trigger = true +push_commands = [ + "/describe", + "/review -i --pr_reviewer.remove_previous_review_comment=true", + "/update_changelog --pr_update_changelog.push_changelog_changes=true" +] diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e69de29 From b4a6fd08561c1f4e40ffa6550af8bf246e7f798c Mon Sep 17 00:00:00 2001 From: Joe Khoobyar Date: Tue, 23 Jan 2024 14:39:50 -0500 Subject: [PATCH 03/15] update codium AI pr agent --- .pr_agent.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pr_agent.toml b/.pr_agent.toml index 674df36..e8ffc85 100644 --- a/.pr_agent.toml +++ b/.pr_agent.toml @@ -13,11 +13,11 @@ handle_pr_actions = ['opened', 'reopened', 'ready_for_review', 'review_requested pr_commands = [ "/describe", "/review", - "/update_changelog" + "/update_changelog --pr_update_changelog.push_changelog_changes=true" ] handle_push_trigger = true push_commands = [ "/describe", "/review -i --pr_reviewer.remove_previous_review_comment=true", - "/update_changelog --pr_update_changelog.push_changelog_changes=true" + "/update_changelog" ] From b115da40046f6bd64bfe48e3180d5099fd646886 Mon Sep 17 00:00:00 2001 From: David Wolfe Date: Wed, 24 Jan 2024 09:44:16 -0800 Subject: [PATCH 04/15] DUPLO-13650 improve format of tenant missing message --- cmd/duplo-jit/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/duplo-jit/main.go b/cmd/duplo-jit/main.go index aeea7e9..9822dce 100644 --- a/cmd/duplo-jit/main.go +++ b/cmd/duplo-jit/main.go @@ -224,7 +224,7 @@ func GetTenantIdAndName(tenantIDorName string, client *duplocloud.Client) (strin tenantName = tenantIDorName tenant, err := client.GetTenantByNameForUser(tenantName) if tenant == nil || err != nil { - internal.Fatal(fmt.Sprintf("%s: tenant missing or not allowed", tenantName), err) + internal.Fatal(fmt.Sprintf("tenant '%s' missing or not allowed", tenantName), err) } else { tenantID = tenant.TenantID } @@ -234,7 +234,7 @@ func GetTenantIdAndName(tenantIDorName string, client *duplocloud.Client) (strin tenantID = tenantIDorName tenant, err := client.GetTenantForUser(tenantIDorName) if tenant == nil || err != nil { - internal.Fatal(fmt.Sprintf("%s: tenant missing or not allowed", tenantID), err) + internal.Fatal(fmt.Sprintf("tenant '%s' missing or not allowed", tenantID), err) } else { tenantName = tenant.AccountName } From dd17024071292b39731c9f4c6284ceaf98e89cab Mon Sep 17 00:00:00 2001 From: David Wolfe Date: Wed, 24 Jan 2024 09:45:42 -0800 Subject: [PATCH 05/15] DUPLO-13650 elide err when nil in fatal messages --- internal/util.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/util.go b/internal/util.go index 7a53183..b65ea3e 100644 --- a/internal/util.go +++ b/internal/util.go @@ -12,5 +12,8 @@ func DieIf(err error, msg string) { } func Fatal(msg string, err error) { - log.Fatalf("%s: %s: %s", os.Args[0], msg, err) + if err != nil { + log.Fatalf("%s: %s: %s", os.Args[0], msg, err) + } + log.Fatalf("%s: %s", os.Args[0], msg) } From 0e883b66d60f7863fa454a57ec4968b61473e411 Mon Sep 17 00:00:00 2001 From: "codiumai-pr-agent-pro[bot]" <151058649+codiumai-pr-agent-pro[bot]@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:54:01 +0000 Subject: [PATCH 06/15] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29..cfe5bbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +## 2024-01-24 + +### Fixed +- Improved error message format when a tenant is missing or not allowed. +- Prevented appending a nil error object to fatal error messages. \ No newline at end of file From e91edbb27408331aca8e3b33ff943363cd3ef828 Mon Sep 17 00:00:00 2001 From: Matheus Bafutto Date: Wed, 14 Feb 2024 11:13:42 -0500 Subject: [PATCH 07/15] DUPLO docs: add Homebrew installation section --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 4e8f5c0..7715d4b 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,18 @@ Command-line tools for JIT Duplo, AWS and Kubernetes access ## Installation +### From release zip files + See the *Releases* section of this repository. - Download a release artifact that matches your system's architecture. - Unzip the artifact. - Install the binaries somewhere in your `PATH`, such as the `/usr/local/bin` directory. +### With Homebrew + +run `brew install duplocloud/tap/duplo-jit` from your terminal + ## Usage ### duplo-jit aws From 8ba97b4605ae3e2b5b9e0fab77eeabef77f0c2c8 Mon Sep 17 00:00:00 2001 From: "codiumai-pr-agent-pro[bot]" <151058649+codiumai-pr-agent-pro[bot]@users.noreply.github.com> Date: Wed, 14 Feb 2024 16:15:07 +0000 Subject: [PATCH 08/15] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfe5bbf..956bbf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2024-02-14 + +### Added +- Introduced a new section in the README for Homebrew installation, enhancing the accessibility of the tool for macOS users. + ## 2024-01-24 ### Fixed From 7ca0c45fd7660f46ff44c33b3f471a0f497c65e7 Mon Sep 17 00:00:00 2001 From: Zafar Abbas Date: Thu, 31 Oct 2024 13:12:53 -0700 Subject: [PATCH 09/15] DUPLO-26089: use a predetermined localPort (#29) * Allowing to choose port in interactive auth * Fixing port usage --------- Co-authored-by: notofir --- README.md | 4 ++++ cmd/duplo-aws-credential-process/main.go | 11 ++++++----- cmd/duplo-jit/main.go | 13 +++++++------ internal/duplo.go | 4 ++-- internal/interactive.go | 8 ++++---- 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 7715d4b..04f85f4 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,8 @@ Usage of duplo-jit: Duplo API base URL -interactive Allow getting Duplo credentials via an interactive browser session + -port + Allow choosing a port for the interactive browser session. Default is random -no-cache Disable caching (not recommended) -tenant string @@ -73,6 +75,8 @@ Usage of duplo-jit: Duplo API base URL -interactive Allow getting Duplo credentials via an interactive browser session + -port + Allow choosing a port for the interactive browser session. Default is random -no-cache Disable caching (not recommended) -token string diff --git a/cmd/duplo-aws-credential-process/main.go b/cmd/duplo-aws-credential-process/main.go index 8575588..85185d2 100644 --- a/cmd/duplo-aws-credential-process/main.go +++ b/cmd/duplo-aws-credential-process/main.go @@ -12,7 +12,7 @@ import ( "github.com/duplocloud/duplo-jit/internal" ) -func mustDuploClient(host, token string, interactive, admin bool) *duplocloud.Client { +func mustDuploClient(host, token string, interactive, admin bool, port int) *duplocloud.Client { otp := "" // Possibly get a token from an interactive process. @@ -21,7 +21,7 @@ func mustDuploClient(host, token string, interactive, admin bool) *duplocloud.Cl log.Fatalf("%s: --token not specified and --interactive mode is disabled", os.Args[0]) } - tokenResult := internal.MustTokenInteractive(host, admin, "duplo-aws-credential-process") + tokenResult := internal.MustTokenInteractive(host, admin, "duplo-aws-credential-process", port) token = tokenResult.Token otp = tokenResult.OTP } @@ -50,6 +50,7 @@ func main() { noCache := flag.Bool("no-cache", false, "Disable caching (not recommended)") interactive := flag.Bool("interactive", false, "Allow getting Duplo credentials via an interactive browser session") showVersion := flag.Bool("version", false, "Output version information and exit") + port := flag.Int("port", 0, "Port to use for the local web server") flag.Parse() // Output version information @@ -92,7 +93,7 @@ func main() { // Otherwise, get the credentials from Duplo. if creds == nil { - client := mustDuploClient(*host, *token, *interactive, true) + client := mustDuploClient(*host, *token, *interactive, true, *port) result, err := client.AdminGetJitAwsCredentials() internal.DieIf(err, "failed to get credentials") creds = internal.ConvertAwsCreds(result) @@ -108,7 +109,7 @@ func main() { // Otherwise, get the credentials from Duplo. if creds == nil { - client := mustDuploClient(*host, *token, *interactive, true) + client := mustDuploClient(*host, *token, *interactive, true, *port) result, err := client.AdminAwsGetJitAccess("duplo-ops") internal.DieIf(err, "failed to get credentials") creds = internal.ConvertAwsCreds(result) @@ -129,7 +130,7 @@ func main() { // Otherwise, get the credentials from Duplo. if creds == nil { - client := mustDuploClient(*host, *token, *interactive, false) + client := mustDuploClient(*host, *token, *interactive, false, *port) // If it doesn't look like a UUID, get the tenant ID from the name. if len(*tenantID) < 32 { diff --git a/cmd/duplo-jit/main.go b/cmd/duplo-jit/main.go index 9822dce..70113ef 100644 --- a/cmd/duplo-jit/main.go +++ b/cmd/duplo-jit/main.go @@ -31,6 +31,7 @@ func main() { debug := flag.Bool("debug", false, "Turn on verbose (debugging) output") noCache := flag.Bool("no-cache", false, "Disable caching (not recommended)") interactive := flag.Bool("interactive", false, "Allow getting Duplo credentials via an interactive browser session") + port := flag.Int("port", 0, "Port to use for the local web server") showVersion := flag.Bool("version", false, "Output version information and exit") admin = new(bool) duploOps = new(bool) @@ -105,7 +106,7 @@ func main() { // Otherwise, get the credentials from Duplo. if creds == nil { - client, _ := internal.MustDuploClient(*host, *token, *interactive, true) + client, _ := internal.MustDuploClient(*host, *token, *interactive, true, *port) result, err := client.AdminGetJitAwsCredentials() internal.DieIf(err, "failed to get credentials") creds = internal.ConvertAwsCreds(result) @@ -121,7 +122,7 @@ func main() { // Otherwise, get the credentials from Duplo. if creds == nil { - client, _ := internal.MustDuploClient(*host, *token, *interactive, true) + client, _ := internal.MustDuploClient(*host, *token, *interactive, true, *port) result, err := client.AdminAwsGetJitAccess("duplo-ops") internal.DieIf(err, "failed to get credentials") creds = internal.ConvertAwsCreds(result) @@ -136,7 +137,7 @@ func main() { // Identify the tenant name to use for the cache key. var tenantName string - client, _ := internal.MustDuploClient(*host, *token, *interactive, false) + client, _ := internal.MustDuploClient(*host, *token, *interactive, false, *port) *tenantID, tenantName = GetTenantIdAndName(*tenantID, client) // Build the cache key. @@ -158,7 +159,7 @@ func main() { internal.OutputAwsCreds(creds, cacheKey) case "duplo": - _, creds := internal.MustDuploClient(*host, *token, *interactive, true) + _, creds := internal.MustDuploClient(*host, *token, *interactive, true, *port) internal.OutputDuploCreds(creds) case "k8s": @@ -174,7 +175,7 @@ func main() { // Otherwise, get the credentials from Duplo. if creds == nil { - client, _ := internal.MustDuploClient(*host, *token, *interactive, true) + client, _ := internal.MustDuploClient(*host, *token, *interactive, true, *port) result, err := client.AdminGetK8sJitAccess(*planID) internal.DieIf(err, "failed to get credentials") creds = internal.ConvertK8sCreds(result) @@ -189,7 +190,7 @@ func main() { // Identify the tenant name to use for the cache key. var tenantName string - client, _ := internal.MustDuploClient(*host, *token, *interactive, false) + client, _ := internal.MustDuploClient(*host, *token, *interactive, false, *port) *tenantID, tenantName = GetTenantIdAndName(*tenantID, client) // Build the cache key. diff --git a/internal/duplo.go b/internal/duplo.go index 5308b7a..83c8571 100644 --- a/internal/duplo.go +++ b/internal/duplo.go @@ -38,7 +38,7 @@ func duploClientAndOtpFlag(host, token, otp string, admin bool) (*duplocloud.Cli } // MustDuploClient retrieves a duplo client (and credentials) or panics. -func MustDuploClient(host, token string, interactive, admin bool) (client *duplocloud.Client, creds *DuploCredsOutput) { +func MustDuploClient(host, token string, interactive, admin bool, port int) (client *duplocloud.Client, creds *DuploCredsOutput) { needsOtp := false cacheKey := strings.TrimPrefix(host, "https://") @@ -91,7 +91,7 @@ func MustDuploClient(host, token string, interactive, admin bool) (client *duplo } // Get the token, or fail. - tokenResult := MustTokenInteractive(host, admin, "duplo-jit") + tokenResult := MustTokenInteractive(host, admin, "duplo-jit", port) if tokenResult.Token == "" { log.Fatalf("%s: authentication failure: failed to get token interactively", os.Args[0]) } diff --git a/internal/interactive.go b/internal/interactive.go index 64eea7f..dd38522 100644 --- a/internal/interactive.go +++ b/internal/interactive.go @@ -60,10 +60,10 @@ func handlerTokenViaPost(baseUrl string, res http.ResponseWriter, req *http.Requ return } -func TokenViaPost(baseUrl string, admin bool, cmd string, timeout time.Duration) TokenResult { +func TokenViaPost(baseUrl string, admin bool, cmd string, port int, timeout time.Duration) TokenResult { // Create the listener on a random port. - listener, err := net.Listen("tcp", "127.0.0.1:0") + listener, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", port)) if err != nil { return TokenResult{err: err} } @@ -127,8 +127,8 @@ func TokenViaPost(baseUrl string, admin bool, cmd string, timeout time.Duration) } } -func MustTokenInteractive(host string, admin bool, cmd string) (tokenResult TokenResult) { - tokenResult = TokenViaPost(host, admin, cmd, 180*time.Second) +func MustTokenInteractive(host string, admin bool, cmd string, port int) (tokenResult TokenResult) { + tokenResult = TokenViaPost(host, admin, cmd, port, 180*time.Second) DieIf(tokenResult.err, "failed to get token from interactive browser session") return } From d8f74debc2f6c5612c3ff09325a0a4678e61879d Mon Sep 17 00:00:00 2001 From: David Wolfe Date: Thu, 7 Nov 2024 09:39:45 -0800 Subject: [PATCH 10/15] DUPLO-26089 Update versions in workflows --- .github/workflows/dev-check.yml | 6 +++--- .github/workflows/dev-test.yml | 2 +- .github/workflows/release-publish.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dev-check.yml b/.github/workflows/dev-check.yml index e799327..43c7bb1 100644 --- a/.github/workflows/dev-check.yml +++ b/.github/workflows/dev-check.yml @@ -18,10 +18,10 @@ jobs: name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: 1.23 - name: Run linting - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 with: only-new-issues: true # Only show new issues for pull requests. format: @@ -34,7 +34,7 @@ jobs: name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: 1.23 - name: Run formatting run: gofmt -s -w duplocloud cmd/duplo-aws-credential-process diff --git a/.github/workflows/dev-test.yml b/.github/workflows/dev-test.yml index de48c81..52d66e2 100644 --- a/.github/workflows/dev-test.yml +++ b/.github/workflows/dev-test.yml @@ -18,7 +18,7 @@ jobs: name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: 1.23 - name: Run tests run: make test diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 6a190c0..de6064e 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -17,7 +17,7 @@ jobs: name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: 1.23 - name: Run tests run: make test From 0122e1a29731ff9db01edb3174fa4664ffa1495b Mon Sep 17 00:00:00 2001 From: David Wolfe Date: Thu, 7 Nov 2024 09:44:11 -0800 Subject: [PATCH 11/15] DUPLO-26089 update go.mod to 1.23 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 294bee3..c9aefd3 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/duplocloud/duplo-jit -go 1.21 +go 1.23 require ( github.com/aws/aws-sdk-go-v2 v1.23.5 From 12efea23f04662944b172c68e99b9f934503cb88 Mon Sep 17 00:00:00 2001 From: David Wolfe Date: Thu, 7 Nov 2024 10:07:25 -0800 Subject: [PATCH 12/15] DUPLO-26089 fix a few lint issues --- cmd/duplo-jit/main.go | 6 +++--- duplocloud/api.go | 11 ++++++----- duplocloud/client.go | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cmd/duplo-jit/main.go b/cmd/duplo-jit/main.go index 70113ef..2485c89 100644 --- a/cmd/duplo-jit/main.go +++ b/cmd/duplo-jit/main.go @@ -138,7 +138,7 @@ func main() { // Identify the tenant name to use for the cache key. var tenantName string client, _ := internal.MustDuploClient(*host, *token, *interactive, false, *port) - *tenantID, tenantName = GetTenantIdAndName(*tenantID, client) + *tenantID, tenantName = getTenantIDAndName(*tenantID, client) // Build the cache key. cacheKey = strings.Join([]string{strings.TrimPrefix(*host, "https://"), "tenant", tenantName}, ",") @@ -191,7 +191,7 @@ func main() { // Identify the tenant name to use for the cache key. var tenantName string client, _ := internal.MustDuploClient(*host, *token, *interactive, false, *port) - *tenantID, tenantName = GetTenantIdAndName(*tenantID, client) + *tenantID, tenantName = getTenantIDAndName(*tenantID, client) // Build the cache key. cacheKey = strings.Join([]string{strings.TrimPrefix(*host, "https://"), "tenant", tenantName}, ",") @@ -215,7 +215,7 @@ func main() { } } -func GetTenantIdAndName(tenantIDorName string, client *duplocloud.Client) (string, string) { +func getTenantIDAndName(tenantIDorName string, client *duplocloud.Client) (string, string) { var tenantID string var tenantName string diff --git a/duplocloud/api.go b/duplocloud/api.go index c8a4e56..9a3032b 100644 --- a/duplocloud/api.go +++ b/duplocloud/api.go @@ -100,12 +100,12 @@ func (c *Client) AdminGetK8sJitAccess(plan string) (*DuploPlanK8ClusterConfig, C return &creds, nil } -// AdminGetJITAwsCredentials retrieves just-in-time admin AWS credentials via the Duplo API. +// AdminGetJitAwsCredentials retrieves just-in-time admin AWS credentials via the Duplo API. func (c *Client) AdminGetJitAwsCredentials() (*AwsJitCredentials, ClientError) { return c.AdminAwsGetJitAccess("admin") } -// TenantGetJITAwsCredentials retrieves just-in-time AWS credentials for a tenant via the Duplo API. +// TenantGetJitAwsCredentials retrieves just-in-time AWS credentials for a tenant via the Duplo API. func (c *Client) TenantGetJitAwsCredentials(tenantID string) (*AwsJitCredentials, ClientError) { creds := AwsJitCredentials{} err := c.getAPI( @@ -143,11 +143,12 @@ func (c *Client) ListTenantsForUser() (*[]UserTenant, ClientError) { return &list, nil } -func (c *Client) GetTenantFeatures(tenantId string) (*DuploTenantFeatures, ClientError) { +// GetTenantFeatures retrieves a tenant's current configuration via the Duplo API. +func (c *Client) GetTenantFeatures(tenantID string) (*DuploTenantFeatures, ClientError) { features := DuploTenantFeatures{} err := c.getAPI( - fmt.Sprintf("GetTenantFeatures(%s)", tenantId), - fmt.Sprintf("v3/features/tenant/%s", tenantId), + fmt.Sprintf("GetTenantFeatures(%s)", tenantID), + fmt.Sprintf("v3/features/tenant/%s", tenantID), &features, ) if err != nil { diff --git a/duplocloud/client.go b/duplocloud/client.go index daf51f1..90a0fe9 100644 --- a/duplocloud/client.go +++ b/duplocloud/client.go @@ -9,7 +9,7 @@ import ( "time" ) -// Represents a connection to the Duplo API +// Client represents a connection to the Duplo API type Client struct { HTTPClient *http.Client HostURL string @@ -66,7 +66,7 @@ func (e clientError) Response() map[string]interface{} { return e.response } -// Represents an error from an API call. +// ClientError represents an error from an API call. type ClientError interface { Error() string Status() int From 74f60f7534a2e2ea531eac2cef6e6636b366c9d2 Mon Sep 17 00:00:00 2001 From: David Wolfe Date: Thu, 7 Nov 2024 10:08:37 -0800 Subject: [PATCH 13/15] DUPLO-26089 fix two more lint issues --- internal/cache.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/cache.go b/internal/cache.go index 51e3e59..21342fa 100644 --- a/internal/cache.go +++ b/internal/cache.go @@ -98,7 +98,7 @@ func CacheGetAwsConfigOutput(cacheKey string) (creds *AwsConfigOutput) { // Check credentials for expiry. if creds != nil { - five_minutes_from_now := time.Now().UTC().Add(5 * time.Minute) + fiveMinutesFromNow := time.Now().UTC().Add(5 * time.Minute) expiration, err := time.Parse(time.RFC3339, creds.Expiration) // Invalid expiration? @@ -107,7 +107,7 @@ func CacheGetAwsConfigOutput(cacheKey string) (creds *AwsConfigOutput) { creds = nil // Expires in five minutes or less? - } else if five_minutes_from_now.After(expiration) { + } else if fiveMinutesFromNow.After(expiration) { creds = nil } } @@ -189,9 +189,9 @@ func CacheGetK8sConfigOutput(cacheKey string, tenantName string) (creds *clienta // Check credentials for expiry. if creds != nil { // Expires in five minutes or less? - five_minutes_from_now := time.Now().UTC().Add(5 * time.Minute) + fiveMinutesFromNow := time.Now().UTC().Add(5 * time.Minute) expiration := creds.Status.ExpirationTimestamp.Time - if five_minutes_from_now.After(expiration) { + if fiveMinutesFromNow.After(expiration) { creds = nil } } From 33d263be6066e08c7e6bce9f0ac8a503efd3ccdb Mon Sep 17 00:00:00 2001 From: David Wolfe Date: Mon, 11 Nov 2024 14:38:49 -0800 Subject: [PATCH 14/15] DUPLO-26240 use infra@duplocloud.net --- .github/workflows/dev-check.yml | 2 +- .github/workflows/finish-release.yml | 2 +- .github/workflows/start-release.yml | 2 +- .goreleaser.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dev-check.yml b/.github/workflows/dev-check.yml index 43c7bb1..c7545bf 100644 --- a/.github/workflows/dev-check.yml +++ b/.github/workflows/dev-check.yml @@ -47,7 +47,7 @@ jobs: if: steps.git-check.outputs.modified == 'true' run: | git config --global user.name 'Duplo Github Bot' - git config --global user.email 'joe+github-bot@duplocloud.net' + git config --global user.email 'infra+github-bot@duplocloud.net' git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} git commit -am "lint: go fmt" git push diff --git a/.github/workflows/finish-release.yml b/.github/workflows/finish-release.yml index 864721c..28aca78 100644 --- a/.github/workflows/finish-release.yml +++ b/.github/workflows/finish-release.yml @@ -7,7 +7,7 @@ on: - master env: git_user: duplo-bot - git_email: joe+github-bot@duplocloud.net + git_email: infra+github-bot@duplocloud.net jobs: finish-release: if: github.event.pull_request.merged == true && (startsWith(github.head_ref, 'refs/heads/release/') || startsWith(github.head_ref, 'release/')) diff --git a/.github/workflows/start-release.yml b/.github/workflows/start-release.yml index fcfd015..2a5952f 100644 --- a/.github/workflows/start-release.yml +++ b/.github/workflows/start-release.yml @@ -8,7 +8,7 @@ on: default: '' # default to current version env: git_user: duplo-bot - git_email: joe+github-bot@duplocloud.net + git_email: infra+github-bot@duplocloud.net jobs: start-release: runs-on: ubuntu-latest diff --git a/.goreleaser.yml b/.goreleaser.yml index 21a569e..4579fd0 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -81,7 +81,7 @@ brews: url_template: "https://github.com/duplocloud/duplo-jit/releases/download/{{ .Tag }}/{{ .ArtifactName }}" commit_author: name: duplo-bot - email: joe+github-bot@duplocloud.net + email: infra+github-bot@duplocloud.net commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}" folder: Formula homepage: "https://github.com/duplocloud/duplo-jit" From d396e13070466b60890b92831163a9df36d10340 Mon Sep 17 00:00:00 2001 From: David Wolfe Date: Mon, 11 Nov 2024 14:45:44 -0800 Subject: [PATCH 15/15] DUPLO-26240 ignore two lines for lint, these are not new --- duplocloud/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/duplocloud/client.go b/duplocloud/client.go index 90a0fe9..a43b769 100644 --- a/duplocloud/client.go +++ b/duplocloud/client.go @@ -193,6 +193,7 @@ func (c *Client) doAPI(verb string, apiName string, apiPath string, rp interface return nil } message := fmt.Sprintf("%s: received unexpected response: %s", apiName, bodyString) + //nolint:govet logf(TRACE, message) return appHttpError(req, message) } @@ -201,6 +202,7 @@ func (c *Client) doAPI(verb string, apiName string, apiPath string, rp interface err = json.Unmarshal(body, rp) if err != nil { message := fmt.Sprintf("%s: cannot unmarshal response from JSON: %s", apiName, err.Error()) + //nolint:govet logf(TRACE, message) return newHttpError(req, -1, message) }