Fix Config File Path Issue#1681
Merged
abhishekkumams merged 22 commits intomainfrom Sep 7, 2023
Merged
Conversation
Aniruddh25
reviewed
Sep 5, 2023
Aniruddh25
reviewed
Sep 5, 2023
Aniruddh25
reviewed
Sep 5, 2023
Aniruddh25
reviewed
Sep 5, 2023
Aniruddh25
reviewed
Sep 5, 2023
Contributor
|
In the past, we've had issues with local Docker containers finding the desired config file. The root cause of those issues was an incorrect file/folder mapping to the Docker container. could that be the case with this issue too?
|
aaronburtle
reviewed
Sep 7, 2023
Contributor
aaronburtle
left a comment
There was a problem hiding this comment.
Looks good, just waiting on some clarification for what we mean by full path, and the comment that sean raised about returning empty.
aaronburtle
approved these changes
Sep 7, 2023
seantleonard
reviewed
Sep 7, 2023
seantleonard
reviewed
Sep 7, 2023
seantleonard
reviewed
Sep 7, 2023
seantleonard
reviewed
Sep 7, 2023
seantleonard
reviewed
Sep 7, 2023
seantleonard
reviewed
Sep 7, 2023
seantleonard
reviewed
Sep 7, 2023
seantleonard
reviewed
Sep 7, 2023
Aniruddh25
reviewed
Sep 7, 2023
Co-authored-by: Aniruddh Munde <[email protected]>
Aniruddh25
reviewed
Sep 7, 2023
Aniruddh25
approved these changes
Sep 7, 2023
Aniruddh25
added a commit
that referenced
this pull request
Sep 7, 2023
## Why make this change? - Closes #1674 ConfigFile was not found when running in the Azure Container Apps. ## What is this change? - Because of the way we used to fetch the cofigFileName, the path was lost, due to which using config file present in a different directory was giving `file not found` error. - So we updated the method to fetch the configFileNamewihoutExtension to keep the original path. - To run Azure Container Apps `--ConfigFileName` is provided with the full path name to the mounted config file. NOTE: * This issue might be caught in Az Container apps but this is not specifically related to Containers, because the current file name generation process was itself incorrect in 0.8.* release. * When we try to get the `fileNameWithoutExtension` in the method `GetFileNameForEnvironment`, we used to lose directory information, for example: if baseConfigFile is`dab/configs/dab-config.json`, then `configFileNameWithoutExtension` was coming as `dab-config`, which is incorrect. * This issue started happening from 0.8.* because in the earlier release (0.7.6), if config file name is provided by user, we directly used it without searching for overrides and environments, unlike 0.8.*. And the precedence check used to happen for cases where config file is not provided by user. * Now, since 0.8.*, we started using the method `GetFileNameWithoutExtension`, which is incorrect causing File not found issue whenever the config file is not in current directory. * The method `DoesFileExistInCurrentDirectory()` checks if the file exists by combining the current directory with the fileName. Now if file is existing in some other directory inside current directory, then for proper searching the file should contain complete info about the directory. So, if current dicrectory is `C:/dab`, and file is in `C:/dab/configs/dab-config.json`, then the file name should either be full path or `/configs/dab-configs.json` for it to be searched. ## Additional Change 1. Fixing name of variables and function name to correctly reflect their behavior. 2. Fixing issue with not honoring the user provided config file, (caused after 0.8 release). (Putting in this PR, because this PR aims at fixing how we are using the config files and not just a bug fix.) ## How was this tested? - [X] Running In Azure Container Apps BEFORE:  AFTER:  - [X] Local Testing BEFORE:  AFTER:  - [X] Unit Tests --------- Co-authored-by: Aniruddh Munde <[email protected]>
Aniruddh25
added a commit
that referenced
this pull request
Sep 7, 2023
- Cherry Picks #1681 --------- Co-authored-by: abhishekkumams <[email protected]>
rohkhann
pushed a commit
that referenced
this pull request
Sep 11, 2023
## Why make this change? - Closes #1674 ConfigFile was not found when running in the Azure Container Apps. ## What is this change? - Because of the way we used to fetch the cofigFileName, the path was lost, due to which using config file present in a different directory was giving `file not found` error. - So we updated the method to fetch the configFileNamewihoutExtension to keep the original path. - To run Azure Container Apps `--ConfigFileName` is provided with the full path name to the mounted config file. NOTE: * This issue might be caught in Az Container apps but this is not specifically related to Containers, because the current file name generation process was itself incorrect in 0.8.* release. * When we try to get the `fileNameWithoutExtension` in the method `GetFileNameForEnvironment`, we used to lose directory information, for example: if baseConfigFile is`dab/configs/dab-config.json`, then `configFileNameWithoutExtension` was coming as `dab-config`, which is incorrect. * This issue started happening from 0.8.* because in the earlier release (0.7.6), if config file name is provided by user, we directly used it without searching for overrides and environments, unlike 0.8.*. And the precedence check used to happen for cases where config file is not provided by user. * Now, since 0.8.*, we started using the method `GetFileNameWithoutExtension`, which is incorrect causing File not found issue whenever the config file is not in current directory. * The method `DoesFileExistInCurrentDirectory()` checks if the file exists by combining the current directory with the fileName. Now if file is existing in some other directory inside current directory, then for proper searching the file should contain complete info about the directory. So, if current dicrectory is `C:/dab`, and file is in `C:/dab/configs/dab-config.json`, then the file name should either be full path or `/configs/dab-configs.json` for it to be searched. ## Additional Change 1. Fixing name of variables and function name to correctly reflect their behavior. 2. Fixing issue with not honoring the user provided config file, (caused after 0.8 release). (Putting in this PR, because this PR aims at fixing how we are using the config files and not just a bug fix.) ## How was this tested? - [X] Running In Azure Container Apps BEFORE:  AFTER:  - [X] Local Testing BEFORE:  AFTER:  - [X] Unit Tests --------- Co-authored-by: Aniruddh Munde <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why make this change?
What is this change?
file not founderror.--ConfigFileNameis provided with the full path name to the mounted config file.NOTE:
fileNameWithoutExtensionin the methodGetFileNameForEnvironment, we used to lose directory information, for example: if baseConfigFile isdab/configs/dab-config.json, thenconfigFileNameWithoutExtensionwas coming asdab-config, which is incorrect.GetFileNameWithoutExtension, which is incorrect causing File not found issue whenever the config file is not in current directory.DoesFileExistInCurrentDirectory()checks if the file exists by combining the current directory with the fileName. Now if file is existing in some other directory inside current directory, then for proper searching the file should contain complete info about the directory. So, if current dicrectory isC:/dab, and file is inC:/dab/configs/dab-config.json, then the file name should either be full path or/configs/dab-configs.jsonfor it to be searched.Additional Change
How was this tested?
BEFORE:
AFTER:

BEFORE:
AFTER:
