diff --git a/.github/workflows/deploy-prod-staging.yml b/.github/workflows/deploy-prod-staging.yml index 41b888a..badaf0a 100644 --- a/.github/workflows/deploy-prod-staging.yml +++ b/.github/workflows/deploy-prod-staging.yml @@ -1,4 +1,4 @@ -name: SearchAPI Integration Deployment and Testing Suite +name: SearchAPI Prod-Staging Integration Deployment and Testing Suite permissions: contents: read on: diff --git a/.github/workflows/deploy-test-staging.yml b/.github/workflows/deploy-test-staging.yml new file mode 100644 index 0000000..912b4d8 --- /dev/null +++ b/.github/workflows/deploy-test-staging.yml @@ -0,0 +1,115 @@ +name: SearchAPI Test-Staging Integration Deployment and Testing Suite +permissions: + contents: read +on: + push: + branches: + - dev + +jobs: + # Deploy Staging + deploy-edc-test-staging: + runs-on: ubuntu-latest + environment: edc-test + permissions: + id-token: write + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: build + uses: ./.github/workflows/search-api-composite + with: + aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }} + vpc-id: ${{ secrets.VPC_ID }} + subnet-ids: ${{ secrets.SUBNET_IDS }} + security-group: ${{ secrets.SECURITY_GROUP }} + staging: true + + run-edc-test-staging-integration-tests: + needs: [deploy-edc-test-staging] + runs-on: ubuntu-latest + environment: edc-test + permissions: + id-token: write + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Configure AWS OIDC credentials + uses: aws-actions/configure-aws-credentials@v3 + with: + role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/SearchAPIActionsOIDCRole + aws-region: us-west-2 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Install dependencies + shell: bash + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + python -m pip install -r tests/requirements.txt + python -m pip install . + + - name: run tests + shell: bash + run: | + pytest tests/integration/test_stack.py \ + --reruns 3 --reruns-delay 10 + + deploy-test-staging: + runs-on: ubuntu-latest + environment: test + permissions: + id-token: write + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: build + uses: ./.github/workflows/search-api-composite + with: + aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }} + staging: true + + run-test-staging-integration-tests: + needs: [deploy-test-staging] + runs-on: ubuntu-latest + environment: test + permissions: + id-token: write + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Configure AWS OIDC credentials + uses: aws-actions/configure-aws-credentials@v3 + with: + role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/SearchAPIActionsOIDCRole + aws-region: us-west-2 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Install dependencies + shell: bash + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + python -m pip install -r tests/requirements.txt + python -m pip install . + + - name: run tests + shell: bash + run: | + pytest tests/integration/test_stack.py \ + --reruns 3 --reruns-delay 10 diff --git a/.github/workflows/run-pytest.yml b/.github/workflows/run-pytest.yml index 62a161e..953fab7 100644 --- a/.github/workflows/run-pytest.yml +++ b/.github/workflows/run-pytest.yml @@ -51,112 +51,3 @@ jobs: flags: unittests name: asf_admin searchAPI-v3 pytest verbose: true - - # Deploy Staging - deploy-edc-test-staging: - needs: [run-tests] - runs-on: ubuntu-latest - environment: edc-test - permissions: - id-token: write - contents: read - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: build - uses: ./.github/workflows/search-api-composite - with: - aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }} - vpc-id: ${{ secrets.VPC_ID }} - subnet-ids: ${{ secrets.SUBNET_IDS }} - security-group: ${{ secrets.SECURITY_GROUP }} - staging: true - - run-tests-edc-staging: - needs: [deploy-edc-test-staging] - runs-on: ubuntu-latest - environment: edc-test - permissions: - id-token: write - contents: read - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Configure AWS OIDC credentials - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/SearchAPIActionsOIDCRole - aws-region: us-west-2 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - - name: Install dependencies - shell: bash - run: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - python -m pip install -r tests/requirements.txt - python -m pip install . - - - name: run tests - shell: bash - run: | - pytest tests/integration/test_stack.py \ - --reruns 3 --reruns-delay 10 - - deploy-test-staging: - needs: [run-tests] - runs-on: ubuntu-latest - environment: test - permissions: - id-token: write - contents: read - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: build - uses: ./.github/workflows/search-api-composite - with: - aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }} - staging: true - - run-tests-staging: - needs: [deploy-test-staging] - runs-on: ubuntu-latest - environment: test - permissions: - id-token: write - contents: read - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Configure AWS OIDC credentials - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/SearchAPIActionsOIDCRole - aws-region: us-west-2 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - - name: Install dependencies - shell: bash - run: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - python -m pip install -r tests/requirements.txt - python -m pip install . - - - name: run tests - shell: bash - run: | - pytest tests/integration/test_stack.py \ - --reruns 3 --reruns-delay 10 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9af499f..98a95c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,16 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). --> ------ +## [1.0.1](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.0...v1.0.1) + +### Added +- Add dedicated dev branch for test-staging deployment + - Intended Dev->Release workflow + - dev -> test -> prod-staging -> prod + +### Changed +- pin `asf-search` to v8.2.3, All basic Vertex dataset searches working + ## [1.0.0](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v0.1.0...v1.0.0) ### Added diff --git a/cdk/cdk/cdk_stack.py b/cdk/cdk/cdk_stack.py index c0581cc..9694fbd 100644 --- a/cdk/cdk/cdk_stack.py +++ b/cdk/cdk/cdk_stack.py @@ -64,7 +64,6 @@ def __init__(self, scope: Construct, construct_id: str, staging: bool = False, * **lambda_vpc_kwargs, ) - staging api_id = f'SearchAPI-V3{"-Staging" if staging else ""}-RestAPI' api = apigateway.LambdaRestApi( self, @@ -74,6 +73,31 @@ def __init__(self, scope: Construct, construct_id: str, staging: bool = False, * default_cors_preflight_options=apigateway.CorsOptions( allow_origins=apigateway.Cors.ALL_ORIGINS, allow_methods=apigateway.Cors.ALL_METHODS ), + # deploy_options=apigateway.StageOptions( + # access_log_destination=apigateway.LogGroupLogDestination( + # logs.LogGroup( + # self, + # f'{api_id}-LogGroup', + # retention=logs.RetentionDays.THREE_MONTHS, + # ) + # ), # type: ignore + # access_log_format=apigateway.AccessLogFormat.custom( + # json.dumps( + # { + # 'sourceIp': '$context.identity.sourceIp', + # 'httpMethod': '$context.httpMethod', + # 'path': '$context.path', + # 'status': '$context.status', + # 'responseLength': '$context.responseLength', + # 'responseLatency': '$context.responseLatency', + # 'requestTime': '$context.requestTime', + # 'protocol': '$context.protocol', + # 'userAgent': '$context.identity.userAgent', + # 'requestId': '$context.requestId', + # } + # ) + # ), + # ), **apigateway_kwargs, # endpoint_configuration=apigateway.EndpointConfiguration( # # https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.EndpointConfiguration.html diff --git a/requirements.txt b/requirements.txt index 9c8c796..8aacbdc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,7 +22,7 @@ ujson==5.7.0 uvicorn==0.21.1 watchfiles==0.19.0 -asf_search==8.1.4 +asf_search==8.2.3 python-json-logger==2.0.7 pyshp diff --git a/src/SearchAPI/application/logger.py b/src/SearchAPI/application/logger.py index 94d885f..ba5f7d7 100644 --- a/src/SearchAPI/application/logger.py +++ b/src/SearchAPI/application/logger.py @@ -108,4 +108,4 @@ def get_logger(name: str, level: int=logging.DEBUG) -> logging.Logger: return logger -api_logger = get_logger(__name__, logging.DEBUG) +api_logger = get_logger(__name__, logging.INFO)