Skip to content

Use ssl to connect to databases in lambdas #64

Use ssl to connect to databases in lambdas

Use ssl to connect to databases in lambdas #64

name: opt-out-export integration tests
on:
pull_request:
paths:
- .github/workflows/opt-out-export-test-integration.yml
- .github/workflows/opt-out-export-test-deploy.yml
- lambda/opt-out-export/**
workflow_dispatch:
# Ensure we have only one integration test running at a time
concurrency:
group: opt-out-export-test-integration
jobs:
# Deploy first if triggered by pull_request
deploy:
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/workflows/opt-out-export-test-deploy.yml
secrets: inherit
trigger:
if: ${{ always() }}
needs: deploy
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./lambda/opt-out-export
outputs:
start_time: ${{ steps.invoke-lambda.outputs.STARTTIME }}
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.ACCOUNT_ID }}:role/delegatedadmin/developer/dpc-test-github-actions
- name: Send event to trigger export lambda function
id: invoke-lambda
run: |
echo "STARTTIME=`date +%s`" >> "$GITHUB_OUTPUT"
aws lambda invoke --function-name dpc-test-opt-out-export test-result.txt
verify-bucket:
needs: trigger
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.ACCOUNT_ID }}:role/delegatedadmin/developer/dpc-test-opt-out-import-function
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
# Note that we use the BFD role with access to the bucket
role-to-assume: arn:aws:iam::${{ secrets.BFD_ACCOUNT_ID }}:role/bfd-test-eft-dpc-bucket-role
role-chaining: true
role-skip-session-tagging: true
- name: Verify confirmation file put in bucket
env:
STARTTIME: ${{needs.trigger.outputs.start_time}}
run: |
while read line; do
filedate_s=`echo $line | awk '{print $1 " " $2}'`
filedate=`date -d "$filedate_s" +%s`
if [[ $((filedate > STARTTIME)) == 1 ]]; then
echo "we have a winner!"
exit 0
fi
done < <(aws s3 ls s3://bfd-test-eft/bfdeft01/dpc/out/ | grep REQ)
echo "no new file found"
exit 1