Skip to content

Commit

Permalink
1.1.0: switch to node20
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyasnikov committed Mar 9, 2024
1 parent 339f9f0 commit 88eaa73
Show file tree
Hide file tree
Showing 9 changed files with 353 additions and 136 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set Node.js 16.x
- name: Set Node.js 20.x
uses: actions/[email protected]
with:
node-version: 16.x
node-version: 20.x

- name: Install dependencies
run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,6 @@ inputs:
description: 'SLO workload #5 docker build arguments'
required: false
runs:
using: 'node16'
using: 'node20'
main: 'dist/main/index.js'
post: 'dist/post/index.js'
2 changes: 1 addition & 1 deletion dist/main/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion k8s/ci/storage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@ spec:
- erasure_species: mirror-3-dc
pdisk_category: 1
storage_pool_kind: ssd
profile_id: 0
profile_id: 0
431 changes: 320 additions & 111 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "slo-tests",
"version": "1.0.0",
"version": "1.1.0",
"private": true,
"description": "TypeScript action for performing SLO tests for YDB in k8s cluster",
"main": "lib/main.js",
"scripts": {
"build": "tsc",
"build": "npx fs-to-json --input \"k8s/ci/*.yaml\" --output src/manifests.json && tsc",
"format": "prettier --write '**/*.ts'",
"format-check": "prettier --check '**/*.ts'",
"lint": "eslint src/**/*.ts",
Expand All @@ -27,7 +27,8 @@
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/github": "^5.1.1",
"@octokit/rest": "^19.0.11"
"@octokit/rest": "^19.0.11",
"fs-to-json": "^0.2.0"
},
"devDependencies": {
"@types/node": "^18.16.3",
Expand All @@ -42,4 +43,4 @@
"ts-jest": "^29.1.0",
"typescript": "^5.0.4"
}
}
}
16 changes: 13 additions & 3 deletions src/callExecutables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ export function prepareAWS(awsCredentialsB64: string, awsConfigB64: string) {
export function call(command: string, secret = false) {
const id = ++callId
!secret && core.info(`Call #${id} command: '${command}'`)
const spawnResult = execSync(command, {encoding: 'utf8', maxBuffer: Infinity, stdio: 'pipe'})
const spawnResult = execSync(command, {
encoding: 'utf8',
maxBuffer: Infinity,
stdio: 'pipe'
})
core.debug(`Call #${id} result ${spawnResult}`)
return spawnResult
}
Expand Down Expand Up @@ -113,14 +117,20 @@ export function callAsync(
} else {
if (secret)
core.info(`Call #${id} async with secrets failed - on close`)
else core.info(`Call #${id} async failed - on close:\nError: ${err}\nOutput: ${out}`)
else
core.info(
`Call #${id} async failed - on close:\nError: ${err}\nOutput: ${out}`
)

reject(new Error(err))
}
})
proc.on('error', err => {
if (secret) core.info(`Call #${id} async with secrets failed - on error`)
else core.info(`Call #${id} async failed - on error:\nError: ${err}\nOutput: ${out}`)
else
core.info(
`Call #${id} async failed - on error:\nError: ${err}\nOutput: ${out}`
)

reject(err)
})
Expand Down
2 changes: 1 addition & 1 deletion src/manifests.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"k8s/ci/workload.yaml":{"isBinary":false,"fileName":"k8s/ci/workload.yaml","originalFileName":"k8s/ci/workload.yaml","content":"apiVersion: batch/v1\nkind: Job\nmetadata:\n name: ${{LANGUAGE_ID}}-wl-${{COMMAND}}\nspec:\n ttlSecondsAfterFinished: 120\n backoffLimit: 0\n template:\n metadata:\n name: ${{LANGUAGE_ID}}-wl-${{COMMAND}}\n spec:\n containers:\n - name: ${{LANGUAGE_ID}}-wl-${{COMMAND}}\n image: ${{DOCKER_IMAGE}}:latest\n args:\n - '${{COMMAND}}'\n - ${{ARGS}}\n restartPolicy: Never\n"},"k8s/ci/database.yaml":{"isBinary":false,"fileName":"k8s/ci/database.yaml","originalFileName":"k8s/ci/database.yaml","content":"apiVersion: ydb.tech/v1alpha1\nkind: Database\nmetadata:\n name: database-sample\nspec:\n monitoring:\n enabled: true\n interval: 3s\n additionalLabels:\n ydb-cluster: slo-storage\n ydb-cluster-monitor: slo-storage\n affinity:\n podAntiAffinity:\n requiredDuringSchedulingIgnoredDuringExecution:\n - labelSelector:\n matchExpressions:\n - key: ydb-cluster\n operator: In\n values:\n - slo-storage\n topologyKey: 'kubernetes.io/hostname'\n image:\n name: cr.yandex/crptqonuodf51kdj7a7d/ydb:${{VERSION}}\n nodes: 6\n resources:\n containerResources:\n limits:\n cpu: 1\n storageUnits:\n - count: 1\n unitKind: ssd\n storageClusterRef:\n name: storage-sample\n"},"k8s/ci/storage.yaml":{"isBinary":false,"fileName":"k8s/ci/storage.yaml","originalFileName":"k8s/ci/storage.yaml","content":"apiVersion: ydb.tech/v1alpha1\nkind: Storage\nmetadata:\n name: storage-sample\nspec:\n monitoring:\n enabled: true\n interval: 3s\n additionalLabels:\n ydb-cluster: slo-storage\n ydb-cluster-monitor: slo-storage\n affinity:\n podAntiAffinity:\n requiredDuringSchedulingIgnoredDuringExecution:\n - labelSelector:\n matchExpressions:\n - key: ydb-cluster\n operator: In\n values:\n - slo-storage\n topologyKey: 'kubernetes.io/hostname'\n dataStore:\n - volumeMode: Block\n storageClassName: yc-network-ssd-nonreplicated\n accessModes:\n - ReadWriteOnce\n resources:\n requests:\n storage: 93Gi\n image:\n name: cr.yandex/crptqonuodf51kdj7a7d/ydb:${{VERSION}}\n nodes: 9\n erasure: mirror-3-dc\n configuration: |-\n static_erasure: mirror-3-dc\n host_configs:\n - drive:\n - path: /dev/kikimr_ssd_00\n type: SSD\n host_config_id: 1\n grpc_config:\n port: 2135\n domains_config:\n domain:\n - name: root\n storage_pool_types:\n - kind: ssd\n pool_config:\n box_id: 1\n erasure_species: mirror-3-dc\n kind: ssd\n pdisk_filter:\n - property:\n - type: SSD\n vdisk_kind: Default\n state_storage:\n - ring:\n node: [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]\n nto_select: 5\n ssid: 1\n actor_system_config:\n batch_executor: 2\n io_executor: 3\n executor:\n - name: System\n spin_threshold: 0\n threads: 2\n type: BASIC\n - name: User\n spin_threshold: 0\n threads: 3\n type: BASIC\n - name: Batch\n spin_threshold: 0\n threads: 2\n type: BASIC\n - name: IO\n threads: 1\n time_per_mailbox_micro_secs: 100\n type: IO\n - name: IC\n spin_threshold: 10\n threads: 1\n time_per_mailbox_micro_secs: 100\n type: BASIC\n scheduler:\n progress_threshold: 10000\n resolution: 256\n spin_threshold: 0\n service_executor:\n - executor_id: 4\n service_name: Interconnect\n blob_storage_config:\n service_set:\n availability_domains: 1\n groups:\n - erasure_species: mirror-3-dc\n group_id: 0\n group_generation: 1\n rings:\n - fail_domains:\n - vdisk_locations:\n - node_id: 1\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - vdisk_locations:\n - node_id: 2\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - vdisk_locations:\n - node_id: 3\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - fail_domains:\n - vdisk_locations:\n - node_id: 4\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - vdisk_locations:\n - node_id: 5\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - vdisk_locations:\n - node_id: 6\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - fail_domains:\n - vdisk_locations:\n - node_id: 7\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - vdisk_locations:\n - node_id: 8\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - vdisk_locations:\n - node_id: 9\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n channel_profile_config:\n profile:\n - channel:\n - erasure_species: mirror-3-dc\n pdisk_category: 1\n storage_pool_kind: ssd\n - erasure_species: mirror-3-dc\n pdisk_category: 1\n storage_pool_kind: ssd\n - erasure_species: mirror-3-dc\n pdisk_category: 1\n storage_pool_kind: ssd\n profile_id: 0\n"}}
{"k8s/ci/storage.yaml":{"isBinary":false,"fileName":"k8s/ci/storage.yaml","originalFileName":"k8s/ci/storage.yaml","content":"apiVersion: ydb.tech/v1alpha1\nkind: Storage\nmetadata:\n name: storage-sample\nspec:\n monitoring:\n enabled: true\n interval: 3s\n additionalLabels:\n ydb-cluster: slo-storage\n ydb-cluster-monitor: slo-storage\n affinity:\n podAntiAffinity:\n requiredDuringSchedulingIgnoredDuringExecution:\n - labelSelector:\n matchExpressions:\n - key: ydb-cluster\n operator: In\n values:\n - slo-storage\n topologyKey: 'kubernetes.io/hostname'\n dataStore:\n - volumeMode: Block\n storageClassName: yc-network-ssd-nonreplicated\n accessModes:\n - ReadWriteOnce\n resources:\n requests:\n storage: 93Gi\n image:\n name: cr.yandex/crptqonuodf51kdj7a7d/ydb:${{VERSION}}\n nodes: 9\n erasure: mirror-3-dc\n configuration: |-\n static_erasure: mirror-3-dc\n host_configs:\n - drive:\n - path: /dev/kikimr_ssd_00\n type: SSD\n host_config_id: 1\n grpc_config:\n port: 2135\n domains_config:\n domain:\n - name: root\n storage_pool_types:\n - kind: ssd\n pool_config:\n box_id: 1\n erasure_species: mirror-3-dc\n kind: ssd\n pdisk_filter:\n - property:\n - type: SSD\n vdisk_kind: Default\n state_storage:\n - ring:\n node: [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]\n nto_select: 5\n ssid: 1\n actor_system_config:\n batch_executor: 2\n io_executor: 3\n executor:\n - name: System\n spin_threshold: 0\n threads: 2\n type: BASIC\n - name: User\n spin_threshold: 0\n threads: 3\n type: BASIC\n - name: Batch\n spin_threshold: 0\n threads: 2\n type: BASIC\n - name: IO\n threads: 1\n time_per_mailbox_micro_secs: 100\n type: IO\n - name: IC\n spin_threshold: 10\n threads: 1\n time_per_mailbox_micro_secs: 100\n type: BASIC\n scheduler:\n progress_threshold: 10000\n resolution: 256\n spin_threshold: 0\n service_executor:\n - executor_id: 4\n service_name: Interconnect\n blob_storage_config:\n service_set:\n availability_domains: 1\n groups:\n - erasure_species: mirror-3-dc\n group_id: 0\n group_generation: 1\n rings:\n - fail_domains:\n - vdisk_locations:\n - node_id: 1\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - vdisk_locations:\n - node_id: 2\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - vdisk_locations:\n - node_id: 3\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - fail_domains:\n - vdisk_locations:\n - node_id: 4\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - vdisk_locations:\n - node_id: 5\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - vdisk_locations:\n - node_id: 6\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - fail_domains:\n - vdisk_locations:\n - node_id: 7\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - vdisk_locations:\n - node_id: 8\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n - vdisk_locations:\n - node_id: 9\n pdisk_category: SSD\n path: /dev/kikimr_ssd_00\n channel_profile_config:\n profile:\n - channel:\n - erasure_species: mirror-3-dc\n pdisk_category: 1\n storage_pool_kind: ssd\n - erasure_species: mirror-3-dc\n pdisk_category: 1\n storage_pool_kind: ssd\n - erasure_species: mirror-3-dc\n pdisk_category: 1\n storage_pool_kind: ssd\n profile_id: 0"},"k8s/ci/workload.yaml":{"isBinary":false,"fileName":"k8s/ci/workload.yaml","originalFileName":"k8s/ci/workload.yaml","content":"apiVersion: batch/v1\nkind: Job\nmetadata:\n name: ${{LANGUAGE_ID}}-wl-${{COMMAND}}\nspec:\n ttlSecondsAfterFinished: 120\n backoffLimit: 0\n template:\n metadata:\n name: ${{LANGUAGE_ID}}-wl-${{COMMAND}}\n spec:\n containers:\n - name: ${{LANGUAGE_ID}}-wl-${{COMMAND}}\n image: ${{DOCKER_IMAGE}}:latest\n args:\n - '${{COMMAND}}'\n - ${{ARGS}}\n restartPolicy: Never\n"},"k8s/ci/database.yaml":{"isBinary":false,"fileName":"k8s/ci/database.yaml","originalFileName":"k8s/ci/database.yaml","content":"apiVersion: ydb.tech/v1alpha1\nkind: Database\nmetadata:\n name: database-sample\nspec:\n monitoring:\n enabled: true\n interval: 3s\n additionalLabels:\n ydb-cluster: slo-storage\n ydb-cluster-monitor: slo-storage\n affinity:\n podAntiAffinity:\n requiredDuringSchedulingIgnoredDuringExecution:\n - labelSelector:\n matchExpressions:\n - key: ydb-cluster\n operator: In\n values:\n - slo-storage\n topologyKey: 'kubernetes.io/hostname'\n image:\n name: cr.yandex/crptqonuodf51kdj7a7d/ydb:${{VERSION}}\n nodes: 6\n resources:\n containerResources:\n limits:\n cpu: 1\n storageUnits:\n - count: 1\n unitKind: ssd\n storageClusterRef:\n name: storage-sample\n"}}
21 changes: 9 additions & 12 deletions src/workload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {withTimeout} from './utils/withTimeout'

const workloadManifestTemplate = manifests['k8s/ci/workload.yaml'].content

const fs = require('fs');
const fs = require('fs')

export function dockerLogin(repo: string, user: string, password: string) {
return logGroup('Docker login', async () => {
Expand Down Expand Up @@ -124,7 +124,7 @@ export function runWorkload(
await saveLogs(options.id, command)
throw new Error(msg)
}
return (status.complete || status.succeeded);
return status.complete || status.succeeded
}
)
const endTime = new Date()
Expand All @@ -134,10 +134,7 @@ export function runWorkload(
})
}

async function saveLogs(
id: string,
command: string
) {
async function saveLogs(id: string, command: string) {
let logs = await callKubernetesAsync(`logs job/${id}-wl-${command}`)

// TODO: print logs
Expand All @@ -146,13 +143,13 @@ async function saveLogs(
// core.endGroup()

try {
let dir = "./logs"
if (!fs.existsSync(dir)){
await fs.promises.mkdir(dir);
let dir = './logs'
if (!fs.existsSync(dir)) {
await fs.promises.mkdir(dir)
}

await fs.promises.writeFile(`${dir}/${id}-${command}.log`, logs);
await fs.promises.writeFile(`${dir}/${id}-${command}.log`, logs)
} catch (e) {
core.info(`error write file for ${id}-${command}: ${(e as Error).message}`)
core.info(`error write file for ${id}-${command}: ${(e as Error).message}`)
}
}
}

0 comments on commit 88eaa73

Please sign in to comment.