Skip to content

Commit f0bd2ae

Browse files
read pk from workflow secrets
1 parent 84d1697 commit f0bd2ae

File tree

2 files changed

+6
-52
lines changed

2 files changed

+6
-52
lines changed

.github/workflows/deploy-changed-samples.yml

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,36 +34,12 @@ jobs:
3434
exit 0
3535
fi
3636
37-
- name: Configure AWS Credentials for CI
38-
id: creds
39-
uses: aws-actions/configure-aws-credentials@v4
40-
with:
41-
aws-region: us-west-2
42-
output-credentials: true
43-
role-to-assume: arn:aws:iam::488659951590:role/ci-role-d4fe904 # ciRoleArn from defang-io/infrastructure stack
44-
45-
- name: Configure AWS Credentials for Playground
46-
uses: aws-actions/configure-aws-credentials@v4
47-
with:
48-
aws-region: us-west-2
49-
role-duration-seconds: 1200
50-
role-chaining: true
51-
role-to-assume: arn:aws:iam::426819183542:role/admin # adminUserRoleArn from defang-io/bootstrap stack
52-
5337
- name: Install Golang
5438
uses: actions/setup-go@v5
5539
with:
56-
go-version-file: defang-mvp/tools/testing/go.mod
40+
go-version-file: tools/testing/go.mod
5741
cache-dependency-path: |
58-
defang-mvp/tools/testing/go.sum
59-
defang/src/go.sum
60-
61-
- name: Install latest defang cli
62-
run: |
63-
go install github.com/DefangLabs/defang/src/cmd/cli@latest
64-
which cli
65-
mv $(which cli) $(dirname $(which cli))/defang
66-
defang --version
42+
tools/testing/go.sum
6743
6844
- name: Build the test tool using Go
6945
run: |
@@ -75,6 +51,7 @@ jobs:
7551
id: run-tests
7652
shell: bash # implies set -o pipefail, so pipe below will keep the exit code from loadtest
7753
env:
54+
FIXED_VERIFIED_PK: ${{ secrets.FIXED_VERIFIED_PK }}
7855
TEST_AWS_ACCESS_KEY: ${{ secrets.TEST_AWS_ACCESS_KEY }}
7956
TEST_AWS_SECRET_KEY: ${{ secrets.TEST_AWS_SECRET_KEY }}
8057
TEST_BOARD_PASSWORD: ${{ secrets.TEST_BOARD_PASSWORD }}

tools/testing/login/login.go

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,12 @@ import (
77
"encoding/pem"
88
"fmt"
99
"log"
10-
"strings"
10+
"os"
1111
"time"
1212

1313
defangclient "github.com/DefangLabs/defang/src/pkg/cli/client"
1414
"github.com/DefangLabs/defang/src/pkg/types"
1515
defangv1 "github.com/DefangLabs/defang/src/protos/io/defang/v1"
16-
"github.com/aws/aws-sdk-go-v2/config"
17-
"github.com/aws/aws-sdk-go-v2/service/ssm"
18-
"github.com/aws/smithy-go/ptr"
1916
"github.com/golang-jwt/jwt/v5"
2017
)
2118

@@ -25,28 +22,8 @@ type TokenIssuer struct {
2522
}
2623

2724
func NewTokenIssuer(ctx context.Context, cluster string) (*TokenIssuer, error) {
28-
parts := strings.Split(strings.TrimPrefix(cluster, "fabric-"), ".")
29-
if len(parts) < 2 {
30-
return nil, fmt.Errorf("invalid cluster: %v", cluster)
31-
}
32-
stack := parts[0]
33-
34-
config, err := config.LoadDefaultConfig(ctx)
35-
if err != nil {
36-
return nil, fmt.Errorf("unable to load SDK config: %w", err)
37-
}
38-
39-
ssmClient := ssm.NewFromConfig(config)
40-
privateKeyParamName := fmt.Sprintf("/ecs/%v/fixed-verifier-private-key-ed25519-pem", stack)
41-
out, err := ssmClient.GetParameter(ctx, &ssm.GetParameterInput{
42-
Name: ptr.String(privateKeyParamName),
43-
WithDecryption: ptr.Bool(true),
44-
})
45-
if err != nil {
46-
return nil, fmt.Errorf("failed to get fixed verifier key at %v parameter: %w", privateKeyParamName, err)
47-
}
48-
49-
pk, err := decodePrivateKeyPEM(*out.Parameter.Value)
25+
fixedVerifierPk := os.Getenv("FIXED_VERIFIER_PK")
26+
pk, err := decodePrivateKeyPEM(fixedVerifierPk)
5027
if err != nil {
5128
return nil, fmt.Errorf("failed to parse fixed verifier key: %w", err)
5229
}

0 commit comments

Comments
 (0)