Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BashV3] reverse feature flags default #18323

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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