Skip to content

np-47772: increase cache ttl for organization fetch to 1 hour #2009

np-47772: increase cache ttl for organization fetch to 1 hour

np-47772: increase cache ttl for organization fetch to 1 hour #2009

Workflow file for this run

name: Karate API tests
on: [ push ]
env:
STACK_NAME: cristin-$GITHUB_REF_NAME
BASE_PATH: cristin-$GITHUB_REF_NAME
DOMAIN_NAME: "api.dev.nva.aws.unit.no"
CRISTIN_API_URL: "https://api.cristin-test.uio.no/v2"
COGNITO_USER_POOL_ID: "eu-west-1_nLV9i5X5D"
COGNITO_CLIENT_APP_ID: "5qo1p8hv58o6f4ke2p72h69pjm"
ADMIN_TESTUSER_ID: "karate-admin-user"
ADMIN_TESTUSER_NIN: ${{ secrets.COGNITO_ADMIN_TESTUSER_NIN }}
ADMIN_TESTUSER_PASSWORD: ${{ secrets.COGNITO_ADMIN_TESTUSER_PASSWORD }}
SIMPLE_TESTUSER_ID: "karate-simple-user"
SIMPLE_TESTUSER_PASSWORD: ${{ secrets.COGNITO_SIMPLE_TESTUSER_PASSWORD }}
SIMPLE_TESTUSER_NIN: ${{ secrets.COGNITO_SIMPLE_TESTUSER_NIN }}
BACKEND_CLIENT_ID: "7vt27od1nkei5mepcv3df98c5k"
BACKEND_CLIENT_ID_SECRET: ${{ secrets.COGNITO_BACKEND_CLIENT_ID_SECRET }}
CRISTIN_EMPLOYMENT_TEST_PERSON_IDENTIFIER: "538786"
COGNITO_AUTHENTICATION_DOMAIN: "nva-dev.auth.eu-west-1.amazoncognito.com"
CRISTIN_BOT_FILTER_BYPASS_HEADER_NAME: "Hello"
CRISTIN_BOT_FILTER_BYPASS_HEADER_VALUE: "World"
jobs:
build_and_deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: corretto
- name: Setup AWS SAM CLI
uses: aws-actions/setup-sam@v1
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@master
with:
role-to-assume: arn:aws:iam::884807050265:role/nva-dev-github-actions-role
aws-region: eu-west-1
- name: Build
run: sam build
# Prevent prompts and failure when the stack is unchanged
- name: Deploy
run: sam deploy --resolve-s3 --no-confirm-changeset --no-fail-on-empty-changeset --stack-name ${{env.STACK_NAME}} --parameter-overrides ParameterKey=CustomDomain,ParameterValue=${DOMAIN_NAME} ParameterKey=CustomDomainBasePath,ParameterValue=${{env.BASE_PATH}} ParameterKey=CristinApiUrl,ParameterValue=${CRISTIN_API_URL}
# Delete existing tests users
- name: Delete karate test users
run: BASE_PATH=${{env.BASE_PATH}} ./gradlew deleteTestUsers --info
# Create test users in cognito
- name: Create karate test users
run: BASE_PATH=${{env.BASE_PATH}} ./gradlew createTestUsers --info
- name: Sleep to let user settle
run: sleep 10
# Run karate tests on deployed api
- name: Run karate tests with Gradle
run: BASE_PATH=${{env.BASE_PATH}} ./gradlew karateTest --info
# Delete tests users after tests have run
- name: Delete karate test users
run: BASE_PATH=${{env.BASE_PATH}} ./gradlew deleteTestUsers --info
- name: Get NvaCristinIntermediateStorageBucket name
id: intermediate-bucket-name
run: |
BUCKET_NAME=$(aws cloudformation describe-stacks --stack-name ${{env.STACK_NAME}} --query "Stacks[0].Outputs[?OutputKey=='NvaCristinIntermediateStorageBucketName'].OutputValue" --output text)
echo "NvaCristinIntermediateStorageBucketName=$BUCKET_NAME" >> $GITHUB_ENV
- name: Empty S3 NvaCristinIntermediateStorageBucket
run: |
aws s3 rm s3://$NvaCristinIntermediateStorageBucketName --recursive
# Delete stack after running tests
- name: Delete stack after running tests
run: sam delete --no-prompts --region eu-west-1 --stack-name ${{env.STACK_NAME}}