Skip to content

Multi-key PL E2E Tests on rc for build 3540 #1696

Multi-key PL E2E Tests on rc for build 3540

Multi-key PL E2E Tests on rc for build 3540 #1696

name: Private Lift Test
run-name: ${{ inputs.test_name }} on ${{ inputs.tag }} for build ${{ inputs.build_id }}
on:
workflow_call:
inputs:
study_id:
description: Lift study id
required: true
type: string
objective_id:
description: Lift objective id
required: false
type: string
input_path:
description: S3 path to synthetic data
required: false
default: https://fbpcs-github-e2e.s3.us-west-2.amazonaws.com/lift/inputs/partner_e2e_input.csv
type: string
expected_result_path:
description: S3 path to expected results from synthetic run
required: false
default: https://fbpcs-github-e2e.s3.us-west-2.amazonaws.com/lift/results/partner_expected_result.json
type: string
tag:
description: Version tag to use the PL/PA Binaries
required: false
default: rc
type: string
coordinator_tag:
description: The image tag for the coordinator image that we should use.
required: false
default: rc
type: string
build_id:
description: The build id
required: false
default: "test build"
type: string
test_name:
description: The name of the type of tests that are being run
default: 'PL E2E Tests'
type: string
test_config:
description: The yaml file name that will be passed in the --config parameter to the E2E runner
default: 'config_one_command_runner_test.yml'
type: string
required: true
tracker_hash:
description: '[Internal usage] Used for tracking workflow job status within Meta infra'
required: false
type: string
workflow_dispatch:
inputs:
study_id:
description: Lift study id
required: true
default: '32102205110410'
objective_id:
description: Lift objective id
required: false
input_path:
description: S3 path to synthetic data
required: true
default: https://fbpcs-github-e2e.s3.us-west-2.amazonaws.com/lift/inputs/partner_e2e_input.csv
expected_result_path:
description: S3 path to expected results from synthetic run
required: true
default: https://fbpcs-github-e2e.s3.us-west-2.amazonaws.com/lift/results/partner_expected_result.json
tag:
description: Version tag to use
required: true
default: rc
build_id:
description: The build id
required: false
default: "test build"
coordinator_tag:
description: The image tag for the coordinator image that we should use.
required: false
default: rc
type: string
test_name:
description: The name of the type of tests that are being run
default: 'PL E2E Tests'
type: 'choice'
options:
- PL E2E Tests
- Multi-key PL E2E Tests
- UDP Tests
test_config:
description: The yaml file name that will be passed in the --config parameter to the E2E runner
default: 'config_one_command_runner_test.yml'
type: string
required: false
tracker_hash:
description: '[Internal usage] Used for tracking workflow job status within Meta infra'
required: false
type: string
env:
FBPCS_CONTAINER_REPO_URL: public.ecr.aws/t7b1w5a4
FBPCS_IMAGE_NAME: pc-coordinator-prod
FBPCS_GRAPH_API_TOKEN: ${{ secrets.FBPCS_GRAPH_API_TOKEN }}
CONSOLE_OUTPUT_FILE: /tmp/output.txt
CONFIG_YAML: ./fbpcs/tests/github/${{ inputs.test_config }}
AWS_REGION_TO_USE: ${{ inputs.test_name == 'UDP Tests' && 'us-west-1' || 'us-west-2' }}
jobs:
### Private Lift E2E tests
pl_test:
name: Private Lift E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 90
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- name: Print Tracker Hash
run: echo ${{ inputs.tracker_hash }}
- name: Get AWS Session name
id: aws_session_name
run: |
echo session_name=$(echo ${{ inputs.test_name }}-${{ inputs.build_id }} | tr " " "-") >> $GITHUB_OUTPUT
- name: Get AWS Region To Use
id: aws_region
run: |
echo aws_region=$(echo ${{ inputs.test_name == 'UDP Tests' && 'us-west-1' || 'us-west-2' }}) >> $GITHUB_OUTPUT
- name: Set AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ inputs.test_name == 'UDP Tests' && secrets.AWS_E2E_UDP_TEST_ROLE_TO_ASSUME || secrets.AWS_E2E_TEST_ROLE_TO_ASSUME }}
aws-region: ${{ steps.aws_region.outputs.aws_region }}
role-duration-seconds: 5400
role-session-name: ${{ steps.aws_session_name.outputs.session_name }}
- name: One command runner
id: runner
continue-on-error: true
run: |
./fbpcs/scripts/run_fbpcs.sh run_study \
${{ inputs.study_id }} \
--objective_ids=${{ inputs.objective_id }} \
--input_paths=${{ inputs.input_path }} \
--config="$CONFIG_YAML" \
-- \
--version=${{ inputs.tag }} \
--image_version=${{ inputs.coordinator_tag }} \
--docker_env=AWS_ACCESS_KEY_ID \
--docker_env=AWS_SECRET_ACCESS_KEY \
--docker_env=AWS_SESSION_TOKEN \
--docker_env=AWS_DEFAULT_REGION > ${{env.CONSOLE_OUTPUT_FILE}} 2>&1
- name: Print runner console output
if: ${{ always() }}
continue-on-error: true
run: |
cat ${{env.CONSOLE_OUTPUT_FILE}}
- name: Abort when runner failed
if: steps.runner.outcome != 'success'
run: |
echo "Please check the runner console output in the above step." ; \
exit 1
- name: Validate Results
# instances are named after ent ids, so we are going to look for filenames that consist of only numbers and then run validation on them
# the fbpcs_instances directory is where instances are written to (feature of run_fbpcs.sh)
# the config.yml specifies that /fbpcs_instances is the instance repo, which is the source of the "/{}"
run: |
find fbpcs_instances -regex 'fbpcs_instances/[0-9]+' | xargs -I {} ./fbpcs/scripts/run_fbpcs.sh \
validate \
"/{}" \
--config=./fbpcs/tests/github/config_one_command_runner_test.yml \
--expected_result_path=${{ inputs.expected_result_path }} \
-- \
--version=${{ inputs.tag }} \
--image_version=${{ inputs.coordinator_tag }} \
--docker_env=AWS_ACCESS_KEY_ID \
--docker_env=AWS_SECRET_ACCESS_KEY \
--docker_env=AWS_SESSION_TOKEN \
--docker_env=AWS_DEFAULT_REGION
- name: Validate runner logs
# First command extracts the pc-cli log lines starting with "... ! Command line: ..." into a file.
run: |
sed -n '/^.* ! Command line: .*/,$p' < ${{env.CONSOLE_OUTPUT_FILE}} > ${{env.CONSOLE_OUTPUT_FILE}}.extracted
docker run -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_DEFAULT_REGION --rm \
-v "${{env.CONSOLE_OUTPUT_FILE}}.extracted:${{env.CONSOLE_OUTPUT_FILE}}" ${{env.FBPCS_CONTAINER_REPO_URL}}/${{env.FBPCS_IMAGE_NAME}}:${{inputs.tag}} \
python -m fbpcs.infra.logging_service.log_analyzer.log_analyzer ${{env.CONSOLE_OUTPUT_FILE}} --validate_one_runner_logs