mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 22:36:01 +00:00
yaml replace changed
This commit is contained in:
@@ -42,6 +42,18 @@ function processJsonStep(json, args) {
|
||||
if (conditionMatch(item._if, args)) {
|
||||
res.push(_.omit(item, ['_if']));
|
||||
}
|
||||
} else if (item._replace || item._include) {
|
||||
const replaceWith = item._replace ? args.replace?.[item._replace] : includes[item._include];
|
||||
if (replaceWith) {
|
||||
modified = true;
|
||||
if (_.isArray(replaceWith)) {
|
||||
res.push(...replaceWith);
|
||||
} else {
|
||||
res.push(replaceWith);
|
||||
}
|
||||
} else {
|
||||
res.push(item);
|
||||
}
|
||||
} else {
|
||||
res.push(item);
|
||||
}
|
||||
@@ -49,27 +61,27 @@ function processJsonStep(json, args) {
|
||||
return res;
|
||||
}
|
||||
|
||||
if (value?.run && _.isArray(value.run)) {
|
||||
const newrun = [];
|
||||
for (const item of value.run) {
|
||||
let replaced = false;
|
||||
for (const repl of args.run) {
|
||||
if (item == repl.from) {
|
||||
replaced = true;
|
||||
modified = true;
|
||||
newrun.push(...repl.to);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!replaced) {
|
||||
newrun.push(item);
|
||||
}
|
||||
}
|
||||
return {
|
||||
...value,
|
||||
run: newrun,
|
||||
};
|
||||
}
|
||||
// if (value?.run && _.isArray(value.run)) {
|
||||
// const newrun = [];
|
||||
// for (const item of value.run) {
|
||||
// let replaced = false;
|
||||
// for (const repl of args.run) {
|
||||
// if (item == repl.from) {
|
||||
// replaced = true;
|
||||
// modified = true;
|
||||
// newrun.push(...repl.to);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (!replaced) {
|
||||
// newrun.push(item);
|
||||
// }
|
||||
// }
|
||||
// return {
|
||||
// ...value,
|
||||
// run: newrun,
|
||||
// };
|
||||
// }
|
||||
|
||||
if (_.isPlainObject(value)) {
|
||||
if (_.intersection(args.allNames ?? [], Object.keys(value))?.length > 0) {
|
||||
@@ -81,6 +93,10 @@ function processJsonStep(json, args) {
|
||||
if (value?._include) {
|
||||
return includes[value?._include];
|
||||
}
|
||||
|
||||
if (value?._replace) {
|
||||
return args?.replace[value?._replace];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
_templates:
|
||||
_community:
|
||||
file: build-docker.yaml
|
||||
run:
|
||||
- from: _cd_merged
|
||||
to: []
|
||||
replace:
|
||||
_cd_merged:
|
||||
- cd ..
|
||||
- cd dbgate-merged
|
||||
_premium:
|
||||
file: build-docker-pro.yaml
|
||||
run:
|
||||
- from: _cd_merged
|
||||
to:
|
||||
- cd ..
|
||||
- cd dbgate-merged
|
||||
replace:
|
||||
_cd_merged:
|
||||
- cd ..
|
||||
- cd dbgate-merged
|
||||
|
||||
name:
|
||||
_community: Docker image Community
|
||||
|
||||
Reference in New Issue
Block a user