Skip to content

Commit

Permalink
Merge pull request #133 from ydb-platform/fix-fs-to-json
Browse files Browse the repository at this point in the history
replace call fs-to-json to typescript templates
  • Loading branch information
asmyasnikov authored Oct 3, 2024
2 parents 1ad33bd + 36affde commit a13e349
Show file tree
Hide file tree
Showing 8 changed files with 479 additions and 24 deletions.
39 changes: 39 additions & 0 deletions dist/main/exec-child.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/main/index.js

Large diffs are not rendered by default.

406 changes: 406 additions & 0 deletions dist/main/licenses.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "TypeScript action for performing SLO tests for YDB in k8s cluster",
"main": "lib/main.js",
"scripts": {
"build": "npx fs-to-json --input \"k8s/ci/*.yaml\" --output src/manifests.json && tsc",
"build": "tsc",
"format": "prettier --write '**/*.ts'",
"format-check": "prettier --check '**/*.ts'",
"lint": "eslint src/**/*.ts",
Expand Down
28 changes: 13 additions & 15 deletions src/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@ import * as core from '@actions/core'
import { logGroup } from './utils/groupDecorator'
import { call, callKubernetes, callKubernetesPath, init_kubectlPath } from './callExecutables'

// npx fs-to-json --input "k8s/ci/*.yaml" --output src/manifests.json
import manifests from './manifests.json'
import {
databaseManifestTemplate ,
storageManifestTemplate ,
valuesForYDBOperator ,
prometheusPushGateway ,
grafanaRenderer ,
prometheus ,
serviceMonitor ,
grafana ,
kindConfig
} from './manifests'
import { withTimeout } from './utils/withTimeout'
import { describe } from 'node:test'
import { writeFile } from 'fs/promises'

const fs = require('fs')

let databaseManifest = manifests['k8s/ci/database.yaml'].content
let storageManifest = manifests['k8s/ci/storage.yaml'].content
let valuesForYDBOperator = manifests['k8s/ci/valuesForYDBOperator.yaml'].content
let prometheusPushGateway = manifests['k8s/ci/prometheus-pushgateway.yaml'].content
let grafanaRenderer = manifests['k8s/ci/grafana-renderer.yaml'].content
let prometheus = manifests['k8s/ci/prometheus.yaml'].content
let serviceMonitor = manifests['k8s/ci/serviceMonitor.yaml'].content
let grafana = manifests['k8s/ci/grafana.yaml'].content
let kindConfig = manifests['k8s/ci/kind-config.yaml'].content

/**
* Create cluster with selected version
Expand All @@ -32,8 +30,8 @@ export async function createCluster(
checkPeriod: number = 10
) {
return logGroup('Create cluster', async () => {
databaseManifest = databaseManifest.replace('${{VERSION}}', version)
storageManifest = storageManifest.replace('${{VERSION}}', version)
const databaseManifest = databaseManifestTemplate.replace('${{VERSION}}', version)
const storageManifest = storageManifestTemplate.replace('${{VERSION}}', version)

core.debug('database manifest:\n\n' + databaseManifest)
core.debug('storage manifest:\n\n' + storageManifest)
Expand Down
1 change: 0 additions & 1 deletion src/manifests.json

This file was deleted.

16 changes: 16 additions & 0 deletions src/manifests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const fs2json = require('fs-to-json').fs2json

function manifests(path: string) {
return fs2json({input: path})
}

export const databaseManifestTemplate = manifests('k8s/ci/database.yaml')
export const storageManifestTemplate = manifests('k8s/ci/storage.yaml')
export const valuesForYDBOperator = manifests('k8s/ci/valuesForYDBOperator.yaml')
export const prometheusPushGateway = manifests('k8s/ci/prometheus-pushgateway.yaml')
export const grafanaRenderer = manifests('k8s/ci/grafana-renderer.yaml')
export const prometheus = manifests('k8s/ci/prometheus.yaml')
export const serviceMonitor = manifests('k8s/ci/serviceMonitor.yaml')
export const grafana = manifests('k8s/ci/grafana.yaml')
export const kindConfig = manifests('k8s/ci/kind-config.yaml')
export const workloadManifestTemplate = manifests('k8s/ci/workload.yaml')
5 changes: 1 addition & 4 deletions src/workload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ import {
} from './callExecutables'
import { logGroup } from './utils/groupDecorator'

// npx fs-to-json --input "k8s/ci/*.yaml" --output src/manifests.json
import manifests from './manifests.json'
import {workloadManifestTemplate} from './manifests'
import { withTimeout } from './utils/withTimeout'

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

const fs = require('fs')

export function disable_buildkit() {
Expand Down

0 comments on commit a13e349

Please sign in to comment.