Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
devthejo committed Sep 17, 2024
1 parent 3d4294b commit e821a5f
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 3 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module.exports = {
"no-process-exit": [0],
"node/no-unsupported-features/es-syntax": [0],
"node/shebang": [0],
"no-ex-assign": [0],
"import/no-commonjs": [0],
"import/no-dynamic-require": [0],
"import/no-extraneous-dependencies": noExtraneousRule,
Expand Down
9 changes: 7 additions & 2 deletions packages/kontinuous/src/build/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ const loadDependencies = require("./load-dependencies")

module.exports = async (_options = {}) => {
const config = ctx.require("config")
const logger = ctx.require("logger")

const { buildPath, buildProjectPath, workspaceKsPath } = config
logger.info("🌀 [LIFECYCLE]: pre-build")
// TODO:

const logger = ctx.require("logger")
const { buildPath, buildProjectPath, workspaceKsPath } = config

if (await fs.pathExists(workspaceKsPath)) {
await fs.copy(workspaceKsPath, buildProjectPath, {
Expand Down Expand Up @@ -77,6 +79,9 @@ module.exports = async (_options = {}) => {

await debugManifests(manifests, values)

logger.info("🌀 [LIFECYCLE]: post-build")
// TODO:

return {
manifestsFile,
manifests: manifestsDump,
Expand Down
13 changes: 12 additions & 1 deletion packages/kontinuous/src/build/validate-manifests.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,16 @@ module.exports = async (manifests) => {
logger.info("🌀 [LIFECYCLE]: validators")
const context = createContext({ type: "validators", ValidationError })
const { buildProjectPath } = config
await pluginFunction(`${buildProjectPath}/validators`)(manifests, {}, context)
try {
await pluginFunction(`${buildProjectPath}/validators`)(
manifests,
{},
context
)
} catch (err) {
if (!(err instanceof ValidationError)) {
err = new ValidationError(err.message)
}
throw err
}
}
38 changes: 38 additions & 0 deletions plugins/contrib/deploy-sidecars/kontinuous-ui.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = async (options, { logger, utils, dryRun, ctx }) => {

Check failure on line 1 in plugins/contrib/deploy-sidecars/kontinuous-ui.js

View workflow job for this annotation

GitHub Actions / Lint

'logger' is defined but never used. Allowed unused args must match /^_/u

Check failure on line 1 in plugins/contrib/deploy-sidecars/kontinuous-ui.js

View workflow job for this annotation

GitHub Actions / Lint

'utils' is defined but never used. Allowed unused args must match /^_/u
if (dryRun) {
return
}

const eventsBucket = ctx.require("eventsBucket")
const abortController = ctx.require("abortController")

const waitingFor = []
eventsBucket.on("resource:created", ({ manifests }) => {

Check failure on line 10 in plugins/contrib/deploy-sidecars/kontinuous-ui.js

View workflow job for this annotation

GitHub Actions / Lint

'manifests' is defined but never used. Allowed unused args must match /^_/u
waitingFor.push(
new Promise(async (resolve, reject) => {
try {
// TODO push events
resolve(e)

Check failure on line 15 in plugins/contrib/deploy-sidecars/kontinuous-ui.js

View workflow job for this annotation

GitHub Actions / Lint

'e' is not defined
} catch (e) {
reject(e)
}
// await
})
)
})

return new Promise(async (res, rej) => {
while (true) {

Check warning on line 25 in plugins/contrib/deploy-sidecars/kontinuous-ui.js

View workflow job for this annotation

GitHub Actions / Lint

Unexpected constant condition
if (abortController.signal.aborted) {
try {
await Promise.all(...waitingFor)
res()
} catch (err) {
rej(err)
}
return
}
await sleep(1)

Check failure on line 35 in plugins/contrib/deploy-sidecars/kontinuous-ui.js

View workflow job for this annotation

GitHub Actions / Lint

'sleep' is not defined
}
})
}

0 comments on commit e821a5f

Please sign in to comment.