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

[Bug-fix]: Handle multiple colons and space #142

Merged
merged 2 commits into from
Jun 16, 2022
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
2 changes: 1 addition & 1 deletion lib/compute/env-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
});

Expand Down
3 changes: 3 additions & 0 deletions test/compute/env-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ 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' },
{ key: 'multiplespace', value: 'spaces' },
],
},
};
Expand Down
9 changes: 6 additions & 3 deletions test/data/env.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
s3Bucket:artifactBucket
account:1234
isStaging:true
s3Bucket: artifactBucket
account: 1234
isStaging: true
url: https://url.com
nospace:dummy
multiplespace: spaces
14 changes: 13 additions & 1 deletion test/data/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ jenkins:
disableRememberMe: false
labelAtoms:
- name: built-in
markupFormatter: plainText
markupFormatter:
rawHtml:
disableSyntaxHighlighting: true
mode: NORMAL
myViewsTabBar: standard
numExecutors: 2
Expand Down Expand Up @@ -48,6 +50,12 @@ jenkins:
value: '1234'
- key: isStaging
value: 'true'
- key: url
value: https://url.com
- key: nospace
value: dummy
- key: multiplespace
value: spaces
globalCredentialsConfiguration:
configuration:
providerFilter: none
Expand All @@ -68,6 +76,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
Expand Down