Skip to content

Commit a7d44e1

Browse files
committed
Use workspaceID as session name
1 parent bdc8668 commit a7d44e1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

components/gitpod-cli/cmd/idp-login-aws.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"os/exec"
1313
"time"
1414

15+
"github.com/gitpod-io/gitpod/gitpod-cli/pkg/gitpod"
1516
"github.com/spf13/cobra"
1617
)
1718

@@ -41,7 +42,12 @@ var idpLoginAwsCmd = &cobra.Command{
4142
return err
4243
}
4344

44-
awsCmd := exec.Command("aws", "sts", "assume-role-with-web-identity", "--role-arn", idpLoginAwsOpts.RoleARN, "--role-session-name", fmt.Sprintf("gitpod-%d", time.Now().Unix()), "--web-identity-token", tkn)
45+
wsInfo, err := gitpod.GetWSInfo(ctx)
46+
if err != nil {
47+
return err
48+
}
49+
50+
awsCmd := exec.Command("aws", "sts", "assume-role-with-web-identity", "--role-arn", idpLoginAwsOpts.RoleARN, "--role-session-name", fmt.Sprintf("%s-%d", wsInfo.WorkspaceId, time.Now().Unix()), "--web-identity-token", tkn)
4551
out, err := awsCmd.CombinedOutput()
4652
if err != nil {
4753
return fmt.Errorf("%w: %s", err, string(out))

0 commit comments

Comments
 (0)