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