kube-workflow
Advanced tools
Comparing version 1.2.6 to 1.3.0
@@ -60,11 +60,13 @@ const os = require("os") | ||
await fs.ensureDir(`${KUBEWORKFLOW_PATH}/charts/kube-workflow/charts`) | ||
await Promise.all(charts.map(async (chartName)=>{ | ||
if (chartName === "kube-workflow") { | ||
return | ||
} | ||
const dest = `${KUBEWORKFLOW_PATH}/charts/kube-workflow/charts/${chartName}` | ||
if (!(await fs.pathExists(dest))) { | ||
await fs.symlink(`../../${chartName}`, dest) | ||
} | ||
})) | ||
await Promise.all( | ||
charts.map(async (chartName) => { | ||
if (chartName === "kube-workflow") { | ||
return | ||
} | ||
const dest = `${KUBEWORKFLOW_PATH}/charts/kube-workflow/charts/${chartName}` | ||
if (!(await fs.pathExists(dest))) { | ||
await fs.symlink(`../../${chartName}`, dest) | ||
} | ||
}) | ||
) | ||
@@ -71,0 +73,0 @@ await fs.ensureDir(KWBUILD_PATH) |
@@ -10,6 +10,5 @@ const fs = require("fs-extra") | ||
const downloadingPromises = {} | ||
const requireUse = async (use) => { | ||
const logger = buildCtx.require("logger") | ||
const downloadingPromises = buildCtx.require("downloadingPromises") | ||
const { KWBUILD_PATH: rootDir, WORKSPACE_PATH: userDir } = | ||
@@ -39,49 +38,49 @@ buildCtx.require("env") | ||
async function compile({ values, file }, parentScope = [], parentWith = {}) { | ||
if (file) { | ||
values = yaml.load(await fs.readFile(file, { encoding: "utf-8" })) | ||
} | ||
if (!values) { | ||
return values | ||
} | ||
const runs = values.jobs?.runs || values.runs || [] | ||
const newRuns = [] | ||
for (let i = 0; i < runs.length; i++) { | ||
const run = runs[i] | ||
async function compile( | ||
values = {}, | ||
parentScope = [], | ||
parentWith = {}, | ||
file = null | ||
) { | ||
const newRuns = await Promise.all( | ||
(values.runs || []).map(async (run) => { | ||
if (!run.name) { | ||
run.name = miniHash(file) | ||
} | ||
if (!run.with) { | ||
run.with = {} | ||
} | ||
if (!run.name) { | ||
run.name = miniHash(file) | ||
} | ||
if (!run.with) { | ||
run.with = {} | ||
} | ||
const scope = [...parentScope, run.name] | ||
run.scope = scope | ||
const scopes = [] | ||
const currentScope = [] | ||
for (const sc of scope) { | ||
currentScope.push(sc) | ||
scopes.push(currentScope.join(".")) | ||
} | ||
if (scope.length > 1) { | ||
scopes.push([scope[0], scope[scope.length - 1]].join("..")) | ||
} | ||
run.scopes = scopes | ||
run.parentWith = { ...parentWith, ...run.with } | ||
const scope = [...parentScope, run.name] | ||
run.scope = scope | ||
const scopes = [] | ||
const currentScope = [] | ||
for (const sc of scope) { | ||
currentScope.push(sc) | ||
scopes.push(currentScope.join(".")) | ||
} | ||
if (scope.length > 1) { | ||
scopes.push([scope[0], scope[scope.length - 1]].join("..")) | ||
} | ||
run.scopes = scopes | ||
run.parentWith = { ...parentWith, ...run.with } | ||
if (!run.needs) { | ||
run.needs = [] | ||
} | ||
run.needs = run.needs.map((r) => [scope[0], r].join("..")) | ||
if (!run.needs) { | ||
run.needs = [] | ||
} | ||
run.needs = run.needs.map((r) => [scope[0], r].join("..")) | ||
if (!run.use) { | ||
return [run] | ||
} | ||
if (!run.use) { | ||
newRuns.push(run) | ||
continue | ||
} | ||
const { target } = await requireUse(run.use) | ||
const compiled = await compile({ file: target }, scope, run.parentWith) | ||
if (compiled.runs) { | ||
const flat = compiled.runs.map((r) => ({ | ||
const { target } = await requireUse(run.use) | ||
const runValues = yaml.load( | ||
await fs.readFile(target, { encoding: "utf-8" }) | ||
) | ||
await compile(runValues, scope, run.parentWith, target) | ||
if (!runValues.runs) { | ||
return [] | ||
} | ||
return runValues.runs.map((r) => ({ | ||
action: run.use, | ||
@@ -96,12 +95,19 @@ ...Object.entries(r).reduce((acc, [key, value]) => { | ||
})) | ||
newRuns.push(...flat) | ||
} | ||
} | ||
runs.length = 0 | ||
runs.push(...newRuns) | ||
return values | ||
}) | ||
) | ||
values.runs = newRuns.reduce((acc, run) => { | ||
acc.push(...run) | ||
return acc | ||
}, []) | ||
} | ||
module.exports = async (values) => { | ||
return compile({ values }) | ||
buildCtx.set("downloadingPromises", {}) | ||
await Promise.all( | ||
Object.keys(values).map(async (key) => { | ||
if (key === "jobs" || key.startsWith("jobs-")) { | ||
await compile(values[key]) | ||
} | ||
}) | ||
) | ||
} |
@@ -5,2 +5,54 @@ # Changelog | ||
## [1.3.0](https://github.com/SocialGouv/kube-workflow/compare/v1.2.6...v1.3.0) (2022-03-26) | ||
### Features | ||
* jobs build first draft ([b6c66ec](https://github.com/SocialGouv/kube-workflow/commit/b6c66eccf6ec28026055606e503974ed7d367b8f)) | ||
### Bug Fixes | ||
* compile uses ([f0fbfce](https://github.com/SocialGouv/kube-workflow/commit/f0fbfce6477a1a1d342f5ae3e80a4826c7e09740)) | ||
* disabling automount service account ([14d4a55](https://github.com/SocialGouv/kube-workflow/commit/14d4a55f0f67aff366891e4b27d3c6fcb591f725)) | ||
* disabling automount service account ([7bfede9](https://github.com/SocialGouv/kube-workflow/commit/7bfede98c636a6a4fc0924678a9b45002afded47)) | ||
* jobs build add imagePackage ([221ab3b](https://github.com/SocialGouv/kube-workflow/commit/221ab3bcbbadb2015023b18cd07a07c2237bd8db)) | ||
* jobs build context as dir ([c41e9f9](https://github.com/SocialGouv/kube-workflow/commit/c41e9f9135a1f6b5123b201a00defd7ddfad9d1f)) | ||
* jobs build context buildArgs type ([0f118a3](https://github.com/SocialGouv/kube-workflow/commit/0f118a30ee445fdd09a7bec2985095444583adcc)) | ||
* jobs build test sa ([5a3745e](https://github.com/SocialGouv/kube-workflow/commit/5a3745e8ea118b20f48dfb26e5ccbf7e15b45c0d)) | ||
* jobs build test sa ([1cf8388](https://github.com/SocialGouv/kube-workflow/commit/1cf838884cb03327fbcf5b59e681568955730706)) | ||
* jobs build wip ([6bb200a](https://github.com/SocialGouv/kube-workflow/commit/6bb200afd3cfc4c1b33309db7dde0445bb1a6981)) | ||
* jobs build wip ([914dc87](https://github.com/SocialGouv/kube-workflow/commit/914dc872ca2df478ddbc70aa94eeb3750d79914a)) | ||
* jobs build wip ([6d8b98e](https://github.com/SocialGouv/kube-workflow/commit/6d8b98e5708848c5a7ae2f13596a38e20752133e)) | ||
* jobs build wip ([18dd7b8](https://github.com/SocialGouv/kube-workflow/commit/18dd7b826f57057e47c94659fcd35c6a66dd831f)) | ||
* jobs build wip ([ebcab31](https://github.com/SocialGouv/kube-workflow/commit/ebcab31ae28c7f533247a66e81433fff960c41b1)) | ||
* jobs build wip ([ddbc7cb](https://github.com/SocialGouv/kube-workflow/commit/ddbc7cb767b5dd67234e6b809ca287ef6cd2ef1e)) | ||
* jobs build wip ([4347672](https://github.com/SocialGouv/kube-workflow/commit/43476723f1b43056c9c617a5757122534294cfab)) | ||
* jobs build wip ([c0ce9ee](https://github.com/SocialGouv/kube-workflow/commit/c0ce9ee6f3eeb8cc4c10f6f25b0617aa55cc8f36)) | ||
* jobs build wip ([ec36659](https://github.com/SocialGouv/kube-workflow/commit/ec36659673a16f388ba90f9ff18b0b485b703c74)) | ||
* jobs default image ([ef42dea](https://github.com/SocialGouv/kube-workflow/commit/ef42deac704965d81a59b40bef02761da99482f4)) | ||
* jobs wip ([5b28588](https://github.com/SocialGouv/kube-workflow/commit/5b285883b4a83fa269e6362f74d185ed422345c7)) | ||
* jobs workingDir ([aa6387e](https://github.com/SocialGouv/kube-workflow/commit/aa6387ef03447fc847012fd77aeff6fbc334f72b)) | ||
* kapp ([2e2adf6](https://github.com/SocialGouv/kube-workflow/commit/2e2adf609ff296e1cde1a1ddaab7404172892177)) | ||
* needs to subcharts ([4b3d72a](https://github.com/SocialGouv/kube-workflow/commit/4b3d72aea0cb1ff6c42a641fb6c2c5db2701902b)) | ||
* needs to subcharts ([e180cba](https://github.com/SocialGouv/kube-workflow/commit/e180cba4fd092bde0b1829b6182005e9351b9643)) | ||
* tests ([55df84b](https://github.com/SocialGouv/kube-workflow/commit/55df84b3094393f9159b49e76d2fa49d1ef92690)) | ||
* tests ([e16f195](https://github.com/SocialGouv/kube-workflow/commit/e16f195373f3ba9b68e677cd3b566523b7be8519)) | ||
* tests ([a60467c](https://github.com/SocialGouv/kube-workflow/commit/a60467c40ce5d80381273905d866e7963b6e2226)) | ||
* wip ([9d19be0](https://github.com/SocialGouv/kube-workflow/commit/9d19be060a9ba8f0920371a6c41fb22b742b3c72)) | ||
* wip ([981b8f9](https://github.com/SocialGouv/kube-workflow/commit/981b8f92c3fa92a59929228ea7803c1e8c355dd9)) | ||
* wip ([bab6d90](https://github.com/SocialGouv/kube-workflow/commit/bab6d9049625e3f74d0a80d9b15f6827c8d9b67e)) | ||
* wip ([0538e4b](https://github.com/SocialGouv/kube-workflow/commit/0538e4b66e402fc4b2f46138a6e2f0900325ada3)) | ||
* wip ([d17e60d](https://github.com/SocialGouv/kube-workflow/commit/d17e60d33741d11c48aba4a6392560807ba1fb58)) | ||
* wip ([9e95d22](https://github.com/SocialGouv/kube-workflow/commit/9e95d2215ad70a4b854b7cc6cdbd593707a5d119)) | ||
* wip ([2102359](https://github.com/SocialGouv/kube-workflow/commit/210235964dbc47a55f4e418b6c9528e6dc34ce4c)) | ||
* wip ([3adcca2](https://github.com/SocialGouv/kube-workflow/commit/3adcca20f9ea5bbe09416947521d4234f1bb8680)) | ||
* wip ([7753de7](https://github.com/SocialGouv/kube-workflow/commit/7753de7846997a89484e40c72682e7eddc4cf887)) | ||
* wip ([a29881d](https://github.com/SocialGouv/kube-workflow/commit/a29881dbc920a98661383a23189b6ff95fd0fc45)) | ||
* wip ([10e54e4](https://github.com/SocialGouv/kube-workflow/commit/10e54e451d7dbba0890dab7b98c8ee41b971df8f)) | ||
* wip ([7e34762](https://github.com/SocialGouv/kube-workflow/commit/7e34762f1e389542d9f7b223a397d3da9af52d03)) | ||
* wip ([320a7a5](https://github.com/SocialGouv/kube-workflow/commit/320a7a5fe7905b0e9f31cffe2214fabcbbaad3bc)) | ||
* wip ([67cd8bb](https://github.com/SocialGouv/kube-workflow/commit/67cd8bb171e2397ae6a14660da9c08b07a839c37)) | ||
* wip ([0f9d51c](https://github.com/SocialGouv/kube-workflow/commit/0f9d51c750a8fdabbe504715d33e0c184a162e69)) | ||
### [1.2.6](https://github.com/SocialGouv/kube-workflow/compare/v1.2.5...v1.2.6) (2022-03-23) | ||
@@ -7,0 +59,0 @@ |
{ | ||
"name": "kube-workflow", | ||
"version": "1.2.6", | ||
"version": "1.3.0", | ||
"repository": "git@github.com:SocialGouv/kube-workflow.git", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
704990
148
677