Skip to content

Commit

Permalink
replace api_key with gcp secret (#15080)
Browse files Browse the repository at this point in the history
* replace api_key with gcp secret

* add new json to trigger test

* auth before checkout

* fix path

* remve imported txns filefrom gitingore
  • Loading branch information
yuunlimm authored Oct 28, 2024
1 parent 7ea4594 commit 0e7ef1c
Show file tree
Hide file tree
Showing 19 changed files with 30 additions and 33 deletions.
34 changes: 25 additions & 9 deletions .github/workflows/indexer-processor-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,31 @@ jobs:
- name: Update Rust toolchain
run: rustup update

- id: auth
uses: "google-github-actions/auth@v2"
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}

- name: Prepare and Replace API Keys in Yaml
id: api_key_tokens
uses: 'google-github-actions/get-secretmanager-secrets@v2'
with:
secrets: |-
testnet_api_key:aptos-ci/TESTNET_INDEXER_API_KEY
mainnet_api_key:aptos-ci/MAINNET_INDEXER_API_KEY
- name: Run CLI to Generate JSON Files
id: api_key_update
run: |
cd ecosystem/indexer-grpc/indexer-transaction-generator
cargo run -- --testing-folder ./example_tests --output-folder ../indexer-test-transactions/new_json_transactions
ls -al ./imported_transactions
echo "Updating API keys in YAML files..."
sed -i "s/TESTNET_API_KEY/${{ steps.api_key_tokens.outputs.testnet_api_key }}/g" ./imported_transactions/imported_transactions.yaml
sed -i "s/MAINNET_API_KEY/${{ steps.api_key_tokens.outputs.mainnet_api_key }}/g" ./imported_transactions/imported_transactions.yaml
cat ./imported_transactions/imported_transactions.yaml # Print the updated file for verification
cargo run -- --testing-folder ./imported_transactions --output-folder ../indexer-test-transactions/new_json_transactions
- name: Install jq
run: sudo apt-get install jq # Ensure jq is installed for JSON processing
Expand All @@ -52,7 +73,8 @@ jobs:
- name: Prepare and Clean JSON Files
run: |
cd ecosystem/indexer-grpc/indexer-test-transactions
ls -al ./new_json_transactions/scripted_transactions
for folder in json_transactions/scripted_transactions new_json_transactions/scripted_transactions; do
for file in $folder/*.json; do
echo "Processing $file..."
Expand All @@ -75,6 +97,7 @@ jobs:
.user.request.sender,
.user.request.expirationTimestampSecs.seconds,
.user.request.signature.ed25519.publicKey,
.user.request.payload.scriptPayload.code.bytecode,
.user.request.signature.ed25519.signature)
| (.info.changes[].writeResource.data |=
if type == "string" then
Expand Down Expand Up @@ -110,13 +133,6 @@ jobs:
exit 0 # Proceed successfully only if no new files or differences are found
fi
- id: auth
if: steps.diff_check.outputs.diff_found == 'true' && steps.diff_check.outputs.new_file_found == 'false'
uses: "google-github-actions/auth@v2"
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}

- name: Log active service account email
if: steps.diff_check.outputs.diff_found == 'true' && steps.diff_check.outputs.new_file_found == 'false'
run: |
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ run_*
test_indexer_grpc_*.yaml
test_indexer_grpc/*
ecosystem/indexer-grpc/indexer-transaction-generator/*.yaml
ecosystem/indexer-grpc/indexer-transaction-generator/**/*.yaml

# ignore compiler artifacts
*.dot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cargo run -p aptos-indexer-transaction-generator -- \

```bash
./aptos-indexer-transaction-generator \
--testing-folder /your/aptos-core/ecosystem/indexer-grpc/indexer-transaction-generator/example_tests \
--testing-folder /your/aptos-core/ecosystem/indexer-grpc/indexer-transaction-generator/imported_transactions \
--output-folder /tmp/ttt
```

Expand Down Expand Up @@ -58,7 +58,7 @@ cargo run -p aptos-indexer-transaction-generator -- \
```


You can check the example [here](example_tests).
You can check the example [here](imported_transactions).


### Account Management
Expand Down
10 changes: 0 additions & 10 deletions ecosystem/indexer-grpc/indexer-transaction-generator/example.yaml

This file was deleted.

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ testnet:
# Transaction Stream endpoint addresss.
transaction_stream_endpoint: https://grpc.testnet.aptoslabs.com:443
# (Optional) The key to use with developers.aptoslabs.com
api_key: YOUR_KEY_HERE
api_key: TESTNET_API_KEY
# A map from versions to dump and their output names.
versions_to_import:
# naming: <version_descriptive_name>
Expand All @@ -17,6 +17,6 @@ testnet:

mainnet:
transaction_stream_endpoint: https://grpc.mainnet.aptoslabs.com:443
api_key: YOUR_KEY_HERE # update with oncall key
api_key: MAINNET_API_KEY
versions_to_import:
308783012: 308783012_fa_transfer
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,9 @@ mainnet:
# example:
# 123: "example_transaction"
}

# testnet:
# transaction_stream_endpoint: https://grpc.testnet.aptoslabs.com:443
# api_key: YOUR_KEY_HERE
# versions_to_import: {
# }
# devnet:
# transaction_stream_endpoint: https://grpc.devnet.aptoslabs.com:443
# api_key: YOUR_KEY_HERE
# versions_to_import: {
# }
# custom:
# transaction_stream_endpoint: https://CUSTOM_ENDPOINT:443
# versions_to_import: {
# }

0 comments on commit 0e7ef1c

Please sign in to comment.