Skip to content

Commit

Permalink
[BashV3] reverse feature flags default (#18323)
Browse files Browse the repository at this point in the history
* Reverse FFs befault values

* Bump task version to 3.223

* 3.222.1

* fix tests
  • Loading branch information
KonstantinTyukalov authored May 19, 2023
1 parent b4efd00 commit b83760b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Tasks/BashV3/Tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('Bash Suite', function () {

it('Runs a checked in script correctly', (done: Mocha.Done) => {
delete process.env['AZP_BASHV3_OLD_SOURCE_BEHAVIOR'];
process.env['AZP_TASK_FF_BASHV3_ENABLE_SECURE_ARGS'] = 'false'
let tp: string = path.join(__dirname, 'L0External.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

Expand All @@ -55,6 +56,7 @@ describe('Bash Suite', function () {

it('Runs a checked in script correctly when using the old behavior', (done: Mocha.Done) => {
process.env['AZP_BASHV3_OLD_SOURCE_BEHAVIOR'] = "true";
process.env['AZP_TASK_FF_BASHV3_ENABLE_SECURE_ARGS'] = 'false'
let tp: string = path.join(__dirname, 'L0External.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

Expand All @@ -76,6 +78,7 @@ describe('Bash Suite', function () {

it('Adds arguments to the script', (done: Mocha.Done) => {
delete process.env['AZP_BASHV3_OLD_SOURCE_BEHAVIOR'];
process.env['AZP_TASK_FF_BASHV3_ENABLE_SECURE_ARGS'] = 'false'
let tp: string = path.join(__dirname, 'L0Args.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

Expand Down
12 changes: 8 additions & 4 deletions Tasks/BashV3/bash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { processBashEnvVariables } from './bashEnvProcessor';
var uuidV4 = require('uuid/v4');

const featureFlags = {
enableTelemetry: getFeatureFlagValue('AZP_TASK_FF_BASHV3_ENABLE_INPUT_ARGS_TELEMETRY'),
enableSecureArgs: getFeatureFlagValue('AZP_TASK_FF_BASHV3_ENABLE_SECURE_ARGS')
enableTelemetry: getFeatureFlagValue('AZP_TASK_FF_BASHV3_ENABLE_INPUT_ARGS_TELEMETRY', true),
enableSecureArgs: getFeatureFlagValue('AZP_TASK_FF_BASHV3_ENABLE_SECURE_ARGS', true)
}

async function translateDirectoryPath(bashPath: string, directoryPath: string): Promise<string> {
Expand Down Expand Up @@ -232,10 +232,14 @@ async function run() {
}
}

function getFeatureFlagValue(featureFlagName: string): boolean {
function getFeatureFlagValue(featureFlagName: string, defaultValue: boolean = false): boolean {
const ffValue = process.env[featureFlagName]

return ffValue ? ffValue.toLowerCase() === "true" : false
if (!ffValue) {
return defaultValue
}

return ffValue.toLowerCase() === "true"
}

run();
2 changes: 1 addition & 1 deletion Tasks/BashV3/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 3,
"Minor": 222,
"Patch": 0
"Patch": 1
},
"releaseNotes": "Script task consistency. Added support for multiple lines and added support for Windows.",
"minimumAgentVersion": "2.115.0",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/BashV3/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 3,
"Minor": 222,
"Patch": 0
"Patch": 1
},
"releaseNotes": "ms-resource:loc.releaseNotes",
"minimumAgentVersion": "2.115.0",
Expand Down

0 comments on commit b83760b

Please sign in to comment.