Skip to content

Commit ce87cca

Browse files
Merge pull request #942 from Green-Software-Foundation/emit-warning
Emit warning
2 parents f6b58b7 + 7f7f717 commit ce87cca

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/if-run/config/strings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Note that for the '--output' option you also need to define the output type in y
5757
PREPARING_OUTPUT_DATA: 'Preparing output data',
5858
EXPORTING_TO_YAML_FILE: (savepath: string) =>
5959
`Exporting to yaml file: ${savepath}`,
60+
EMPTY_PIPELINE: `You're using an old style manifest. Please update for phased execution. More information can be found here:
61+
https://if.greensoftware.foundation/major-concepts/manifest-file`,
6062
/** Exhaust messages */
6163
OUTPUT_REQUIRED:
6264
'Output path is required, please make sure output is configured properly.',

src/if-run/lib/compute.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ import {addExplainData} from './explain';
55

66
import {mergeObjects} from '../util/helpers';
77
import {debugLogger} from '../../common/util/debug-logger';
8+
import {logger} from '../../common/util/logger';
89

910
import {STRINGS} from '../config/strings';
1011

1112
import {ComputeParams, Node, PhasedPipeline} from '../types/compute';
1213
import {isExecute} from '../types/interface';
1314

14-
const {MERGING_DEFAULTS_WITH_INPUT_DATA} = STRINGS;
15+
const {MERGING_DEFAULTS_WITH_INPUT_DATA, EMPTY_PIPELINE} = STRINGS;
1516

1617
/**
1718
* Traverses all child nodes based on children grouping.
@@ -77,6 +78,16 @@ const computeNode = async (node: Node, params: ComputeParams): Promise<any> => {
7778
inputStorage = mergeDefaults(inputStorage, defaults);
7879
const pipelineCopy = structuredClone(pipeline) || {};
7980

81+
/** Checks if pipeline is not an array or empty object. */
82+
if (
83+
Array.isArray(pipelineCopy) ||
84+
(typeof pipelineCopy === 'object' &&
85+
pipelineCopy !== null &&
86+
Object.keys(pipelineCopy).length === 0)
87+
) {
88+
logger.warn(EMPTY_PIPELINE);
89+
}
90+
8091
/**
8192
* If iteration is on observe pipeline, then executes observe plugins and sets the inputs value.
8293
*/

0 commit comments

Comments
 (0)