@@ -29830,17 +29830,23 @@ function buildUrl(baseUrl, endpoint, environment) {
2983029830function injectYamlVariables(content, changesetVariables) {
2983129831 const doc = yaml.load(content);
2983229832
29833- // Build new variable entries from the provided changeset variables
29834- const injectedVars = Object.entries(changesetVariables).map(([name, value]) => ({
29835- environment: null,
29836- mask_value: true,
29837- name,
29838- value,
29839- }));
29833+ // Determine mask_value for each injected variable based on existing entries
29834+ const existingVars = Array.isArray(doc.variable) ? doc.variable : [];
29835+ const injectedVars = Object.entries(changesetVariables).map(([name, value]) => {
29836+ // Check if this variable exists in the changeset
29837+ const existingEntries = existingVars.filter(v => v.name === name);
29838+ // If any existing entry has mask_value: true, preserve that; otherwise use false
29839+ const maskValue = existingEntries.some(v => v.mask_value === true) ? true : false;
29840+ return {
29841+ environment: null,
29842+ mask_value: maskValue,
29843+ name,
29844+ value,
29845+ };
29846+ });
2984029847
29841- // Remove existing entries for variables we're overriding
29848+ // Remove all existing entries for variables we're overriding
2984229849 const overrideNames = new Set(Object.keys(changesetVariables));
29843- const existingVars = Array.isArray(doc.variable) ? doc.variable : [];
2984429850 const keptVars = existingVars.filter(v => !overrideNames.has(v.name));
2984529851
2984629852 doc.variable = [...keptVars, ...injectedVars];
@@ -29851,17 +29857,23 @@ function injectYamlVariables(content, changesetVariables) {
2985129857function injectJsonVariables(content, changesetVariables) {
2985229858 const doc = JSON.parse(content);
2985329859
29854- // Build new variable entries from the provided changeset variables
29855- const injectedVars = Object.entries(changesetVariables).map(([name, value]) => ({
29856- environment: null,
29857- mask_value: true,
29858- name,
29859- value,
29860- }));
29860+ // Determine mask_value for each injected variable based on existing entries
29861+ const existingVars = Array.isArray(doc.variable) ? doc.variable : [];
29862+ const injectedVars = Object.entries(changesetVariables).map(([name, value]) => {
29863+ // Check if this variable exists in the changeset
29864+ const existingEntries = existingVars.filter(v => v.name === name);
29865+ // If any existing entry has mask_value: true, preserve that; otherwise use false
29866+ const maskValue = existingEntries.some(v => v.mask_value === true) ? true : false;
29867+ return {
29868+ environment: null,
29869+ mask_value: maskValue,
29870+ name,
29871+ value,
29872+ };
29873+ });
2986129874
29862- // Remove existing entries for variables we're overriding
29875+ // Remove all existing entries for variables we're overriding
2986329876 const overrideNames = new Set(Object.keys(changesetVariables));
29864- const existingVars = Array.isArray(doc.variable) ? doc.variable : [];
2986529877 const keptVars = existingVars.filter(v => !overrideNames.has(v.name));
2986629878
2986729879 doc.variable = [...keptVars, ...injectedVars];
0 commit comments