-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Decouple fabric tools image from fabric sample #1186
Conversation
@denyeart , I am got confused a little, could you please help with which core config is missing here? when we try to add org3? |
d621e6b
to
3ee7afe
Compare
@denyeart , please help retry failed test case and review this PR. :-) |
59e73fd
to
fad329d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SamYuan1990 Thank you for submitting the PR.
I have some review comments:
- I noticed the use of symbolic links for scripts and organizations folders, which might be confusing for beginners looking at the code. I believe it would be better to use relative paths instead of symbolic links. Would it be difficult to make this change?
- Many of the modified files contain comments stating like "This script is designed to be run in the cli container," which should also be updated.
- For org3, I think it's preferable to refer to core.yaml in fabric-samples/config, similar to org1 and 2, by setting the FABRIC_CFG_PATH instead of adding a new core file.
- Additionally, the intermediate artifacts related to configtx that were previously generated within cli container, such as *.json, *.tx, and *.pb files, remain in the root of the test-network or addOrg3 directories. It might be better to generate these in a dedicated directory, like channel-artifacts, to keep things organized. Would this approach be feasible?
- The Test Network SBE GitHub test seems to be failing due to a different issue unrelated to this PR, so it might be okay to ignore it for now.
test-network/addOrg3/core.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For org3, I think it's preferable to refer to core.yaml in fabric-samples/config, similar to org1 and 2, by setting the FABRIC_CFG_PATH instead of adding a new core file. Specifically, adjusting FABRIC_CFG_PATH in here to FABRIC_CFG_PATH=$PWD/../../config/
and appending this setting in here could potentially ensure it works as intended without the core.yaml.
@satota2, with my hands on, the most challenging for this PR is the loop of relative paths. which makes https://github.com/hyperledger/fabric-samples/blob/main/test-network/scripts/org3-scripts/joinChannel.sh#L26 org3 related script starts from this absolute directory. the symbolic links... provides the same folder structure, specific for the loop case. as those scripts also reused by org1 and org2, if we just change the scripts for org3, which will break the relative paths for org1 and org2. |
@SamYuan1990 As an alternative, what about using absolute paths in each script instead of relative ones? |
I see, let's try. |
we can't simply using |
396f557
to
0e1e578
Compare
@satota2 , I suppose I found a way to make it by a env named as |
Signed-off-by: Sam Yuan <yy19902439@126.com>
b98857a
to
97bab7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@satota2 , I suppose I found a way to make it by a env named as test_network_home please help review this PR. @denyeart , once this PR been merged, which means we decoupled fabric tools from fabric sample, then we can deprecated fabric tools image.
Thank you for your work. I believe this way of using an environment variable named test_network_home simplifies the process compared to the previous way that involved symbolic links, making it more understandable for the readers. Could you please refine the implementation following this direction?
I also think that using uppercase for the test_network_home environment variable would be preferable since it is a convention for environment variables.
Furthermore, I would appreciate it if you could reconsider the following comments:
- For org3, it seems better to refer to core.yaml in fabric-samples/config, similar to org1 and 2, by setting the FABRIC_CFG_PATH instead of adding a new core file.
- Additionally, the intermediate artifacts related to configtx that were previously generated within the cli container, such as *.json, *.tx, and *.pb files, remain in the root of the test-network or addOrg3 directories. It might be more organized to generate these in a dedicated directory, like channel-artifacts, to keep things tidy. Would this approach be workable?
@@ -34,7 +33,7 @@ fetchChannelConfig 1 ${CHANNEL_NAME} config.json | |||
|
|||
# Modify the configuration to append the new org | |||
set -x | |||
jq -s '.[0] * {"channel_group":{"groups":{"Application":{"groups": {"Org3MSP":.[1]}}}}}' config.json ./organizations/peerOrganizations/org3.example.com/org3.json > modified_config.json | |||
jq -s '.[0] * {"channel_group":{"groups":{"Application":{"groups": {"Org3MSP":.[1]}}}}}' config.json ../organizations/peerOrganizations/org3.example.com/org3.json > modified_config.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jq -s '.[0] * {"channel_group":{"groups":{"Application":{"groups": {"Org3MSP":.[1]}}}}}' config.json ../organizations/peerOrganizations/org3.example.com/org3.json > modified_config.json | |
jq -s '.[0] * {"channel_group":{"groups":{"Application":{"groups": {"Org3MSP":.[1]}}}}}' config.json ${test_network_home}/organizations/peerOrganizations/org3.example.com/org3.json > modified_config.json |
Signed-off-by: Sam Yuan <yy19902439@126.com>
534da7a
to
c4ad7d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SamYuan1990, Cc: @denyeart
Thank you for the update. The code has been refined, and I was able to verify that Org3 can now be added in the local environment as well.
However, it appears that the following improvements I previously suggested have not yet been incorporated. Would it be possible for you to address these areas? We might consider merging this PR as it stands and then either you, I, or someone else could quickly create a new PR to tackle these areas for further code cleanup. How does that sound?
Comments for improvements I previously suggested:
- I think that using uppercase for the test_network_home environment variable would be preferable since it is a convention for environment variables.
- For org3, it seems better to refer to core.yaml in fabric-samples/config, similar to org1 and 2, by setting the FABRIC_CFG_PATH instead of adding a new core file.
- The intermediate artifacts related to configtx that were previously generated within the cli container, such as *.json, *.tx, and *.pb files, remain in the root of the test-network or addOrg3 directories. It might be more organized to generate these in a dedicated directory, like channel-artifacts, to keep things tidy.
hi @satota2 , my goal to have this PR is to proof we can deprecated fabric tools image but not make a perfect change for multiple org solution. Hence the enhancement or totally refactor can be in other PRs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @satota2 , my goal to have this PR is to proof we can deprecated fabric tools image but not make a perfect change for multiple org solution. Hence the enhancement or totally refactor can be in other PRs.
Thank you for your response. We'll mark the tasks up to this point as completed within this PR and do the refactoring and improvements in a new PR. Thanks for all your hard work so far.
Would you be interested in handling the refactoring? Your involvement would be welcome. However, if you prefer not to, that's perfectly fine. Either I or someone else can take it from there.
Hi @satota2 , you can try with refactor and I would like to learn from it. |
Hi @SamYuan1990,
|
Hi @SamYuan1990,
I've merged the PR and have now submitted a new PR (#1193) for the refactoring as discussed. Please take a look when you have a moment. Hi @denyeart |
Decouple fabric tools image from fabric sample.
change list for running on github action:
The current PR seems has many code smells... but it seems works.