-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(benchmark): Separate cloud env provisioning from running ben…
…chmarks (#10657)
- Loading branch information
Showing
7 changed files
with
113 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,9 @@ env: | |
ARM_SUBSCRIPTION_ID: ${{ secrets.BENCHMARK_ARM_SUBSCRIPTION_ID }} | ||
ARM_TENANT_ID: ${{ secrets.BENCHMARK_ARM_TENANT_ID }} | ||
K6_API_TOKEN: ${{ secrets.K6_API_TOKEN }} | ||
N8N_TAG: ${{ inputs.n8n_tag || 'nightly' }} | ||
N8N_BENCHMARK_TAG: ${{ inputs.benchmark_tag || 'latest' }} | ||
DEBUG: ${{ inputs.debug == 'true' && '--debug' || '' }} | ||
|
||
permissions: | ||
id-token: write | ||
|
@@ -62,12 +65,23 @@ jobs: | |
run: pnpm destroy-cloud-env | ||
working-directory: packages/@n8n/benchmark | ||
|
||
- name: Run the benchmark with debug logging | ||
if: github.event.inputs.debug == 'true' | ||
run: pnpm benchmark-in-cloud --n8nTag ${{ inputs.n8n_tag || 'nightly' }} --benchmarkTag ${{ inputs.benchmark_tag || 'latest' }} --debug | ||
- name: Provision the environment | ||
run: pnpm provision-cloud-env ${{ env.DEBUG }} | ||
working-directory: packages/@n8n/benchmark | ||
|
||
- name: Run the benchmark | ||
if: github.event.inputs.debug != 'true' | ||
run: pnpm benchmark-in-cloud --n8nTag ${{ inputs.n8n_tag || 'nightly' }} --benchmarkTag ${{ inputs.benchmark_tag || 'latest' }} | ||
run: pnpm benchmark-in-cloud --n8nTag ${{ env.N8N_TAG }} --benchmarkTag ${{ env.N8N_BENCHMARK_TAG }} ${{ env.DEBUG }} | ||
working-directory: packages/@n8n/benchmark | ||
|
||
# We need to login again because the access token expires | ||
- name: Azure login | ||
uses: azure/[email protected] | ||
with: | ||
client-id: ${{ env.ARM_CLIENT_ID }} | ||
tenant-id: ${{ env.ARM_TENANT_ID }} | ||
subscription-id: ${{ env.ARM_SUBSCRIPTION_ID }} | ||
|
||
- name: Destroy the environment | ||
if: always() | ||
run: pnpm destroy-cloud-env ${{ env.DEBUG }} | ||
working-directory: packages/@n8n/benchmark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env zx | ||
/** | ||
* Provisions the cloud benchmark environment | ||
* | ||
* NOTE: Must be run in the root of the package. | ||
*/ | ||
// @ts-check | ||
import { which, minimist } from 'zx'; | ||
import { TerraformClient } from './clients/terraformClient.mjs'; | ||
|
||
const args = minimist(process.argv.slice(3), { | ||
boolean: ['debug'], | ||
}); | ||
|
||
const isVerbose = !!args.debug; | ||
|
||
export async function provision() { | ||
await ensureDependencies(); | ||
|
||
const terraformClient = new TerraformClient({ | ||
isVerbose, | ||
}); | ||
|
||
await terraformClient.provisionEnvironment(); | ||
} | ||
|
||
async function ensureDependencies() { | ||
await which('terraform'); | ||
} | ||
|
||
provision().catch((error) => { | ||
console.error('An error occurred while provisioning cloud env:'); | ||
console.error(error); | ||
|
||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters