From 99a12ecd13689f6a6474702d33b56d34ca964fd1 Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Thu, 16 Jun 2022 13:08:14 -0700 Subject: [PATCH 1/2] Handle multiple colons and space Signed-off-by: Sayali Gaikawad --- lib/compute/env-config.ts | 2 +- test/compute/env-config.test.ts | 2 ++ test/data/env.txt | 8 +++++--- test/data/test_env.yaml | 12 +++++++++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/compute/env-config.ts b/lib/compute/env-config.ts index d9818b55..dde5ec1b 100644 --- a/lib/compute/env-config.ts +++ b/lib/compute/env-config.ts @@ -25,7 +25,7 @@ export class EnvConfig { const envFile: string = readFileSync(envVarsFilePath, 'utf-8'); const c = envFile.split('\n'); c.forEach((item) => { - const e = item.split(':'); + const e = item.split(/:(.*)/s).map((element) => element.trim()); envArray.push(new Env(e[0], e[1])); }); diff --git a/test/compute/env-config.test.ts b/test/compute/env-config.test.ts index 45c39b3b..8d244a8c 100644 --- a/test/compute/env-config.test.ts +++ b/test/compute/env-config.test.ts @@ -29,6 +29,8 @@ describe('Env Config', () => { { key: 's3Bucket', value: 'artifactBucket' }, { key: 'account', value: '1234' }, { key: 'isStaging', value: 'true' }, + { key: 'url', value: 'https://url.com' }, + { key: 'nospace', value: 'dummy' }, ], }, }; diff --git a/test/data/env.txt b/test/data/env.txt index c0a78f59..33c5edda 100644 --- a/test/data/env.txt +++ b/test/data/env.txt @@ -1,3 +1,5 @@ -s3Bucket:artifactBucket -account:1234 -isStaging:true \ No newline at end of file +s3Bucket: artifactBucket +account: 1234 +isStaging: true +url: https://url.com +nospace:dummy \ No newline at end of file diff --git a/test/data/test_env.yaml b/test/data/test_env.yaml index 4b7bb69d..22d345cb 100644 --- a/test/data/test_env.yaml +++ b/test/data/test_env.yaml @@ -8,7 +8,9 @@ jenkins: disableRememberMe: false labelAtoms: - name: built-in - markupFormatter: plainText + markupFormatter: + rawHtml: + disableSyntaxHighlighting: true mode: NORMAL myViewsTabBar: standard numExecutors: 2 @@ -48,6 +50,10 @@ jenkins: value: '1234' - key: isStaging value: 'true' + - key: url + value: https://url.com + - key: nospace + value: dummy globalCredentialsConfiguration: configuration: providerFilter: none @@ -68,6 +74,10 @@ unclassified: logBuildCause: true pattern: >- .*/(?:configSubmit|doDelete|postBuildResult|enable|disable|cancelQueue|stop|toggleLogKeep|doWipeOutWorkspace|createItem|createView|toggleOffline|cancelQuietDown|quietDown|restart|exit|safeExit)/?.* + awsCredentialsProvider: + cache: false + client: + credentialsProvider: default buildDiscarders: configuredBuildDiscarders: - jobBuildDiscarder From feedc760be728c32c6bb60913a674aa70d5a098b Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Thu, 16 Jun 2022 13:11:10 -0700 Subject: [PATCH 2/2] Handle multiple space Signed-off-by: Sayali Gaikawad --- test/compute/env-config.test.ts | 1 + test/data/env.txt | 3 ++- test/data/test_env.yaml | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/compute/env-config.test.ts b/test/compute/env-config.test.ts index 8d244a8c..597ab750 100644 --- a/test/compute/env-config.test.ts +++ b/test/compute/env-config.test.ts @@ -31,6 +31,7 @@ describe('Env Config', () => { { key: 'isStaging', value: 'true' }, { key: 'url', value: 'https://url.com' }, { key: 'nospace', value: 'dummy' }, + { key: 'multiplespace', value: 'spaces' }, ], }, }; diff --git a/test/data/env.txt b/test/data/env.txt index 33c5edda..3c02d45a 100644 --- a/test/data/env.txt +++ b/test/data/env.txt @@ -2,4 +2,5 @@ s3Bucket: artifactBucket account: 1234 isStaging: true url: https://url.com -nospace:dummy \ No newline at end of file +nospace:dummy +multiplespace: spaces \ No newline at end of file diff --git a/test/data/test_env.yaml b/test/data/test_env.yaml index 22d345cb..cf34693f 100644 --- a/test/data/test_env.yaml +++ b/test/data/test_env.yaml @@ -54,6 +54,8 @@ jenkins: value: https://url.com - key: nospace value: dummy + - key: multiplespace + value: spaces globalCredentialsConfiguration: configuration: providerFilter: none