From edc16c9192d0ee09b70b51cbbe2a85dfcb0da77d Mon Sep 17 00:00:00 2001 From: Rustie Lin Date: Mon, 9 Sep 2024 22:39:54 -0700 Subject: [PATCH] [DO NOT MERGE] canary forge indexer --- .github/workflows/adhoc-forge.yaml | 39 ++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/.github/workflows/adhoc-forge.yaml b/.github/workflows/adhoc-forge.yaml index 9ebd5f2bfa185a..731724189fee4c 100644 --- a/.github/workflows/adhoc-forge.yaml +++ b/.github/workflows/adhoc-forge.yaml @@ -31,11 +31,6 @@ on: required: false type: string description: The Forge k8s cluster to be used for test - FORGE_ENABLE_HAPROXY: - required: false - default: false - type: boolean - description: enable haproxy for the forge test FORGE_NUM_VALIDATORS: required: false type: string @@ -48,7 +43,12 @@ on: required: false type: boolean description: Retain debug logs for all nodes - + # NOTE: this is a special input that is used to pass extra environment variables to the forge test + # This is required since workflow_dispatch has a limit of 10 inputs. workflow_call has a higher limit so we can parse out the actual envs from this input + FORGE_EXTRA_ENVS: + required: false + type: string + description: Extra environment variables to pass to the forge test. Format is "key1=value1,key2=value2". Use this for FORGE_ENABLE_HAPROXY or FORGE_ENABLE_INDEXER for example permissions: contents: read id-token: write #required for GCP Workload Identity federation which we use to login into Google Artifact Registry @@ -60,6 +60,7 @@ jobs: runs-on: ubuntu-latest steps: - name: collect metadata + shell: bash run: | echo "GIT_SHA: ${{ inputs.GIT_SHA }}" echo "IMAGE_TAG: ${{ inputs.IMAGE_TAG }}" @@ -67,10 +68,23 @@ jobs: echo "FORGE_RUNNER_DURATION_SECS: ${{ inputs.FORGE_RUNNER_DURATION_SECS }}" echo "FORGE_TEST_SUITE: ${{ inputs.FORGE_TEST_SUITE }}" echo "FORGE_CLUSTER_NAME: ${{ inputs.FORGE_CLUSTER_NAME }}" - echo "FORGE_ENABLE_HAPROXY: ${{ inputs.FORGE_ENABLE_HAPROXY }}" + echo "FORGE_EXTRA_ENVS: ${{ inputs.FORGE_EXTRA_ENVS }}" echo "FORGE_NUM_VALIDATORS: ${{ inputs.FORGE_NUM_VALIDATORS }}" echo "FORGE_NUM_VALIDATOR_FULLNODES: ${{ inputs.FORGE_NUM_VALIDATOR_FULLNODES }}" echo "FORGE_RETAIN_DEBUG_LOGS: ${{ inputs.FORGE_RETAIN_DEBUG_LOGS }}" + + # Input from the action + IFS=',' read -ra ENV_PAIRS <<< "${{ inputs.FORGE_EXTRA_ENVS }}" + + # Loop over key-value pairs + for pair in "${ENV_PAIRS[@]}"; do + key=$(echo $pair | cut -d '=' -f 1) + value=$(echo $pair | cut -d '=' -f 2) + + # Set output dynamically + echo "${key}=${value}" >> $GITHUB_OUTPUT + done + outputs: gitSha: ${{ inputs.GIT_SHA }} imageTag: ${{ inputs.IMAGE_TAG }} @@ -78,13 +92,14 @@ jobs: forgeRunnerDurationSecs: ${{ inputs.FORGE_RUNNER_DURATION_SECS || 600 }} forgeTestSuite: ${{ inputs.FORGE_TEST_SUITE }} forgeClusterName: ${{ inputs.FORGE_CLUSTER_NAME }} - forgeEnableHaproxy: ${{ inputs.FORGE_ENABLE_HAPROXY }} + forgeExtraEnvs: ${{ inputs.FORGE_EXTRA_ENVS }} forgeNumValidators: ${{ inputs.FORGE_NUM_VALIDATORS }} forgeNumValidatorFullnodes: ${{ inputs.FORGE_NUM_VALIDATOR_FULLNODES }} adhoc-forge-test: uses: aptos-labs/aptos-core/.github/workflows/workflow-run-forge.yaml@main - needs: [determine-forge-run-metadata] + # XXX: REMOVE ME I'M A CANARY!! :^) + uses: aptos-labs/aptos-core/.github/workflows/workflow-run-forge.yaml@rustielin/forge-indexer needs: [determine-forge-run-metadata] secrets: inherit with: GIT_SHA: ${{ needs.determine-forge-run-metadata.outputs.gitSha }} @@ -93,7 +108,11 @@ jobs: FORGE_TEST_SUITE: ${{ needs.determine-forge-run-metadata.outputs.forgeTestSuite }} FORGE_RUNNER_DURATION_SECS: ${{ fromJSON(needs.determine-forge-run-metadata.outputs.forgeRunnerDurationSecs) }} # fromJSON converts to integer FORGE_CLUSTER_NAME: ${{ needs.determine-forge-run-metadata.outputs.forgeClusterName }} - FORGE_ENABLE_HAPROXY: ${{ needs.determine-forge-run-metadata.outputs.forgeEnableHaproxy }} + FORGE_EXTRA_ENVS: ${{ needs.determine-forge-run-metadata.outputs.forgeExtraEnvs }} FORGE_NUM_VALIDATORS: ${{ needs.determine-forge-run-metadata.outputs.forgeNumValidators }} FORGE_NUM_VALIDATOR_FULLNODES: ${{ needs.determine-forge-run-metadata.outputs.forgeNumValidatorFullnodes }} FORGE_RETAIN_DEBUG_LOGS: ${{ inputs.FORGE_RETAIN_DEBUG_LOGS }} + # These are the inputs that are parsed from the FORGE_EXTRA_ENVS + # They may not be present in the metadata output if they are not passed in the input + FORGE_ENABLE_INDEXER: ${{ needs.determine-forge-run-metadata.outputs.FORGE_ENABLE_INDEXER }} + FORGE_ENABLE_HAPROXY: ${{ needs.determine-forge-run-metadata.outputs.FORGE_ENABLE_HAPROXY }}