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

Fix missing root dir prefix when loading dynamic config #4056

Merged

Conversation

git-hulk
Copy link
Contributor

The cadence server would fail to load the dynamic config file
when the working dir wasn't the parent dir of dynamic config
file path.

What changed?

Fix missing root dir prefix when loading dynamic config

Why?

The cadence server would fail to load the dynamic config file
when the working dir wasn't the parent dir of dynamic config
file path.

How did you test it?

local test

Potential risks

no

The cadence server would fail to load the dynamic config file
when the working dir wasn't the parent dir of dynamic config
file path.
@git-hulk
Copy link
Contributor Author

@longquanzheng Can you have a look at this PR?

@longquanzheng
Copy link
Collaborator

@longquanzheng Can you have a look at this PR?

Thanks for finding and fixing it.

Copy link
Collaborator

@longquanzheng longquanzheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this will break the case that using absolute path.
Maybe we should check if a path is absolute before transformation

@git-hulk
Copy link
Contributor Author

Actually, this will break the case that using absolute path.
Maybe we should check if a path is absolute before transformation

I didn't check the path since the comment says that should be relative to the root directory

// Filepath should be relative to the root directory
DynamicConfigClient dynamicconfig.FileBasedClientConfig `yaml:"dynamicConfigClient"`

@longquanzheng
Copy link
Collaborator

Actually, this will break the case that using absolute path.
Maybe we should check if a path is absolute before transformation

I didn't check the path since the comment says that should be relative to the root directory

// Filepath should be relative to the root directory
DynamicConfigClient dynamicconfig.FileBasedClientConfig `yaml:"dynamicConfigClient"`

I see. That is misleading, sorry for that. We should remove the comment.

maybe that’s the initial intent but the code doesn’t restrict it. As a result, people are using it with absolute paths now. See https://uber-cadence.slack.com/archives/CNC31V3K7/p1616084908003400?thread_ts=1616084757.003300&channel=CNC31V3K7&message_ts=1616084908.003400

so I think we have to support it anyway. Otherwise I don’t think those people have a workaround

@git-hulk
Copy link
Contributor Author

so I think we have to support it anyway. Otherwise I don’t think those people have a workaround

Okay, I'll fix it and remove the comment later 👍

@longquanzheng
Copy link
Collaborator

so I think we have to support it anyway. Otherwise I don’t think those people have a workaround

Okay, I'll fix it and remove the comment later 👍

Cool. Can you do the same for loading config? I think it’s okay if config is outside root directory. This will probably make it easier/simpler to use homebrew. And also add description to the root CLI parameter: it will not apply to absolute path.

@git-hulk git-hulk force-pushed the fix-relative-path-to-dynamic-config branch from 97ce2e2 to e9cf591 Compare March 19, 2021 02:20
@git-hulk
Copy link
Contributor Author

so I think we have to support it anyway. Otherwise I don’t think those people have a workaround

Okay, I'll fix it and remove the comment later 👍

Cool. Can you do the same for loading config? I think it’s okay if config is outside root directory. This will probably make it easier/simpler to use homebrew. And also add description to the root CLI parameter: it will not apply to absolute path.

Done, you can have a look again

@git-hulk git-hulk force-pushed the fix-relative-path-to-dynamic-config branch from e9cf591 to 63a3aef Compare March 19, 2021 02:30
Copy link
Collaborator

@longquanzheng longquanzheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment about the CLI parameter. The rest LGTM

@git-hulk git-hulk force-pushed the fix-relative-path-to-dynamic-config branch from 63a3aef to 8f84bf2 Compare March 19, 2021 03:24
@longquanzheng longquanzheng merged commit a3708fb into uber:master Mar 19, 2021
yux0 pushed a commit to yux0/cadence that referenced this pull request May 4, 2021
* Fix missing root dir prefix when loading dynamic config

The cadence server would fail to load the dynamic config file
when the working dir wasn't the parent dir of dynamic config
file path.

* Fix don't append the root dir when the dynamic file path was absolute

* run buildkite test

sorry I have to edit something to hack around buildkite

Co-authored-by: Quanzheng Long <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants