Skip to content

Commit ba5337e

Browse files
authored
Merge pull request #80 from silinternational/develop
Release 2024.11.04 -- parallel deployment
2 parents 70a1a07 + fdc5b5e commit ba5337e

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

.github/workflows/test-deploy-publish.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Test, Deploy, Publish
22

33
on:
44
push:
5-
branches: ["**"]
6-
tags: ['v[0-9]+.[0-9]+.[0-9]+']
5+
branches: [ '**' ]
6+
tags: [ 'v*' ]
77
paths-ignore:
88
- 'terraform/**'
99

@@ -26,8 +26,11 @@ jobs:
2626
deploy:
2727
name: Deploy to AWS Lambda
2828
needs: tests
29-
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
29+
if: github.ref_name == 'main' || github.ref_name == 'develop'
3030
runs-on: ubuntu-latest
31+
strategy:
32+
matrix:
33+
region: [ us-east-1, us-west-2 ]
3134
env:
3235
AWS_REGION: ${{ vars.AWS_REGION }}
3336
STG_AWS_ACCESS_KEY_ID: ${{ vars.STG_AWS_ACCESS_KEY_ID }}
@@ -45,7 +48,7 @@ jobs:
4548
- name: Checkout code
4649
uses: actions/checkout@v4
4750
- name: Deploy
48-
run: docker compose -f actions-services.yml run --rm app ./scripts/deploy.sh
51+
run: docker compose -f actions-services.yml run --rm app ./scripts/deploy.sh ${{ matrix.region }}
4952

5053
build-and-publish:
5154
name: Build and Publish
@@ -77,8 +80,9 @@ jobs:
7780
ghcr.io/${{ github.repository_owner }}/${{ vars.IMAGE_NAME }}
7881
tags: |
7982
type=ref,event=branch
80-
type=semver,pattern={{version}},enable=true
81-
type=semver,pattern={{major.minor}},enable=true
83+
type=semver,pattern={{version}}
84+
type=semver,pattern={{major.minor}}
85+
type=semver,pattern={{major}}
8286
8387
- name: Build and push Docker image
8488
uses: docker/build-push-action@v5

scripts/deploy.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,5 @@ fi
3939
# Print the Serverless version in the logs
4040
serverless --version
4141

42-
echo "Deploying stage $STAGE of serverless package..."
43-
serverless deploy --verbose --stage "$STAGE" --region us-east-1
44-
serverless deploy --verbose --stage "$STAGE" --region us-west-2
42+
echo "Deploying stage $STAGE of serverless package to region $1..."
43+
serverless deploy --verbose --stage "$STAGE" --region "$1"

user.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,17 +286,18 @@ func (u *DynamoUser) FinishRegistration(r *http.Request) (string, error) {
286286
if err != nil {
287287
var protocolError *protocol.Error
288288
if errors.As(err, &protocolError) {
289-
fmt.Printf("body: %s\n", string(body))
290-
fmt.Printf("protocolError: %+v\n", protocolError)
291-
fmt.Printf("DevInfo: %s\n", protocolError.DevInfo)
292-
return "", fmt.Errorf("unable to parse credential creation response body: %v -- %s", protocolError,
293-
protocolError.DevInfo)
289+
log.Printf("unable to parse body: %s", body)
290+
log.Printf("ProtocolError: %s, DevInfo: %s", protocolError.Details, protocolError.DevInfo)
294291
}
295292
return "", fmt.Errorf("unable to parse credential creation response body: %w", err)
296293
}
297294

298295
credential, err := u.WebAuthnClient.CreateCredential(u, u.SessionData, parsedResponse)
299296
if err != nil {
297+
var protocolError *protocol.Error
298+
if errors.As(err, &protocolError) {
299+
log.Printf("ProtocolError: %s, DevInfo: %s", protocolError.Details, protocolError.DevInfo)
300+
}
300301
return "", fmt.Errorf("unable to create credential: %w", err)
301302
}
302303

0 commit comments

Comments
 (0)