-
Notifications
You must be signed in to change notification settings - Fork 295
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
test(test-tooling): migrate AIO image to Fabric v2.5.6, add constants #3054
Merged
petermetz
merged 1 commit into
hyperledger-cacti:main
from
petermetz:test-tooling-fabric-v256-lts-support
Mar 7, 2024
Merged
test(test-tooling): migrate AIO image to Fabric v2.5.6, add constants #3054
petermetz
merged 1 commit into
hyperledger-cacti:main
from
petermetz:test-tooling-fabric-v256-lts-support
Mar 7, 2024
Conversation
This file contains 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
petermetz
added a commit
to petermetz/cacti
that referenced
this pull request
Mar 4, 2024
The deployContractGoSourceV1() method now assumes that the underlying test ledger is Fabric 2.5 (current LTS). This will allow us to upgrade the contracts that are being used by the Supply chain app to Fabric 2.x from Fabric 1.x which will then implicitly fix a large number of other issues at the same time. This change is part of laying the foundation for that follow-up work. Primary changes: ----------------- 1. Added a new, standalone utility function to deploy go source contracts with the name of `deployContractGoSourceImplFabricV256()`. 2. The code of this function was derived from the original Fabric v1 compatible deployContractGoSourceV1 method of the Fabric connector. 3. 2 organizations are supported for deployment via the endpoint. 4. The endpoint is only used by the supply chain app example at the moment and there is no test coverage of it due to dependencies that will be resolved in a follow-up pull request that is coming soon. Secondary changes: 1. Also extracted the SSH execution function from the fabric connector into a standalone function that can be used without having to have a Fabric connector instance created first. 2. Also extracted/abstracted some logic into a utility function for similar reasons that is used to replace logging configuration environment variables in shell commands that we use to perform contract deployment onto the Fabric test ledgers. Depends on hyperledger-cacti#3054 Signed-off-by: Peter Somogyvari <[email protected]>
5 tasks
izuru0
approved these changes
Mar 5, 2024
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.
LGTM
petermetz
added a commit
to petermetz/cacti
that referenced
this pull request
Mar 5, 2024
The deployContractGoSourceV1() method now assumes that the underlying test ledger is Fabric 2.5 (current LTS). This will allow us to upgrade the contracts that are being used by the Supply chain app to Fabric 2.x from Fabric 1.x which will then implicitly fix a large number of other issues at the same time. This change is part of laying the foundation for that follow-up work. Primary changes: ----------------- 1. Added a new, standalone utility function to deploy go source contracts with the name of `deployContractGoSourceImplFabricV256()`. 2. The code of this function was derived from the original Fabric v1 compatible deployContractGoSourceV1 method of the Fabric connector. 3. 2 organizations are supported for deployment via the endpoint. 4. The endpoint is only used by the supply chain app example at the moment and there is no test coverage of it due to dependencies that will be resolved in a follow-up pull request that is coming soon. Secondary changes: 1. Also extracted the SSH execution function from the fabric connector into a standalone function that can be used without having to have a Fabric connector instance created first. 2. Also extracted/abstracted some logic into a utility function for similar reasons that is used to replace logging configuration environment variables in shell commands that we use to perform contract deployment onto the Fabric test ledgers. Depends on hyperledger-cacti#3054 Signed-off-by: Peter Somogyvari <[email protected]>
petermetz
added a commit
to petermetz/cacti
that referenced
this pull request
Mar 5, 2024
The supply chain app's build and execution scripts should finally be working after this and also be much more stable than before due to the flakiness of the Fabric V1 test ledger not being an issue anymore. 1.The new contract is compiled with go v1.20 and therefore has to have the contract method names capitalized insted of camelCase, otherwise the methods are not possible to be exported and the contract deployment fails even if everything else is correct. 2. The supply chain app now uses the newest edition of the Fabric v2 AIO test ledger container image which uses Fabric v2.5.6 (current LTS at the time of this writing). 3. The shipment contract's source code has been migrated to Fabric v2 meaning that instead of a stub object we get a context object for each method's first parameter and then the stub can be acquired from that context object. 4. The method arguments no longer need to be passed around as an array of strings and instead the contract method's input arguments are first-class go method parameters. 5. Re-enabled a test case that was being skipped until now due to flakiness: ...`src/test/typescript/integration/supply-chain-backend-api-calls.test.ts` Depends on hyperledger-cacti#3058 Depends on hyperledger-cacti#3054 Fixes hyperledger-cacti#2945 Fixes hyperledger-cacti#2969 Fixes hyperledger-cacti#1899 Fixes hyperledger-cacti#1521 Fixes hyperledger-cacti#1518 Signed-off-by: Peter Somogyvari <[email protected]>
outSH
reviewed
Mar 5, 2024
packages/cactus-test-tooling/src/main/typescript/fabric/fabric-samples-env-constants.ts
Show resolved
Hide resolved
1. The Fabric v2 image has been migrated to the current LTS release which has increased stability and of course adheres to general best practices more thoroughly since now we are in sync with the Fabric maintainers in terms of LTS. 2. The newer versions of the fabric-samples test-net containers have some of the configuration files under different paths and this had to be reverse engineered by manually inspecting the containers at runtime and searching for the same files in different directories. To make this easier in the future for people who are using the AIO image, we've added a collection of constants to the test-tooling package that stores the paths hardcoded that are exported via verbose variable names that pin these to the specific Fabric version they are related to so that in the future if these paths change again, we can accommodate the change in a way that is not too confusing by exporting more variables with slightly different names and values. 3. The image built from the updated `Dockerfile_v2` is accessible on GHCR as: `ghcr.io/hyperledger/cactus-fabric2-all-in-one:2024-03-03--issue-2945-fabric-v2-5-6` which has the v2.5.6 versioned container images pre-cached (embedded) so that network transfer does not need to occur and rate limiting doesn't produce CI flakes (DockerHub has rate limits for image downloading that we regularly hit when we don't embed the Fabric container images this way...). 4. Why can't we just pull the values for these constants directly from the container at runtime? 4.1. The list of constants and their names/values change based on the Fabric version that's being used by the AIO image. 4.2. The only ones that could be pulled are the ones that belong to the first organization because this is the one that the CLI container uses. 4.3. Configuration files that store the constants' values for the second organization are also located in different directories depending on the Fabric version being used. 4.4. The fabric-samples repo have been known to make breaking changes to older releases which would then make it even harder to debug if we had logic for identifying the constants that suddenly broke (this specific incident has happened in the past unfortunately) 4.5. In short, there is definitely a case for applying the DRY principle here, but in this particular case it appears to be not worth it due to the increased complexity that the convoluted additional logic would bring. Related but does not fix hyperledger-cacti#1899 Signed-off-by: Peter Somogyvari <[email protected]>
2113302
to
f6eb342
Compare
petermetz
added a commit
to petermetz/cacti
that referenced
this pull request
Mar 5, 2024
The deployContractGoSourceV1() method now assumes that the underlying test ledger is Fabric 2.5 (current LTS). This will allow us to upgrade the contracts that are being used by the Supply chain app to Fabric 2.x from Fabric 1.x which will then implicitly fix a large number of other issues at the same time. This change is part of laying the foundation for that follow-up work. Primary changes: ----------------- 1. Added a new, standalone utility function to deploy go source contracts with the name of `deployContractGoSourceImplFabricV256()`. 2. The code of this function was derived from the original Fabric v1 compatible deployContractGoSourceV1 method of the Fabric connector. 3. 2 organizations are supported for deployment via the endpoint. 4. The endpoint is only used by the supply chain app example at the moment and there is no test coverage of it due to dependencies that will be resolved in a follow-up pull request that is coming soon. Secondary changes: 1. Also extracted the SSH execution function from the fabric connector into a standalone function that can be used without having to have a Fabric connector instance created first. 2. Also extracted/abstracted some logic into a utility function for similar reasons that is used to replace logging configuration environment variables in shell commands that we use to perform contract deployment onto the Fabric test ledgers. Depends on hyperledger-cacti#3054 Signed-off-by: Peter Somogyvari <[email protected]>
petermetz
added a commit
to petermetz/cacti
that referenced
this pull request
Mar 5, 2024
The supply chain app's build and execution scripts should finally be working after this and also be much more stable than before due to the flakiness of the Fabric V1 test ledger not being an issue anymore. 1.The new contract is compiled with go v1.20 and therefore has to have the contract method names capitalized insted of camelCase, otherwise the methods are not possible to be exported and the contract deployment fails even if everything else is correct. 2. The supply chain app now uses the newest edition of the Fabric v2 AIO test ledger container image which uses Fabric v2.5.6 (current LTS at the time of this writing). 3. The shipment contract's source code has been migrated to Fabric v2 meaning that instead of a stub object we get a context object for each method's first parameter and then the stub can be acquired from that context object. 4. The method arguments no longer need to be passed around as an array of strings and instead the contract method's input arguments are first-class go method parameters. 5. Re-enabled a test case that was being skipped until now due to flakiness: ...`src/test/typescript/integration/supply-chain-backend-api-calls.test.ts` Depends on hyperledger-cacti#3058 Depends on hyperledger-cacti#3054 Fixes hyperledger-cacti#2945 Fixes hyperledger-cacti#2969 Fixes hyperledger-cacti#1899 Fixes hyperledger-cacti#1521 Fixes hyperledger-cacti#1518 Signed-off-by: Peter Somogyvari <[email protected]>
jagpreetsinghsasan
approved these changes
Mar 7, 2024
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.
LGTM
petermetz
added a commit
to petermetz/cacti
that referenced
this pull request
Mar 7, 2024
The deployContractGoSourceV1() method now assumes that the underlying test ledger is Fabric 2.5 (current LTS). This will allow us to upgrade the contracts that are being used by the Supply chain app to Fabric 2.x from Fabric 1.x which will then implicitly fix a large number of other issues at the same time. This change is part of laying the foundation for that follow-up work. Primary changes: ----------------- 1. Added a new, standalone utility function to deploy go source contracts with the name of `deployContractGoSourceImplFabricV256()`. 2. The code of this function was derived from the original Fabric v1 compatible deployContractGoSourceV1 method of the Fabric connector. 3. 2 organizations are supported for deployment via the endpoint. 4. The endpoint is only used by the supply chain app example at the moment and there is no test coverage of it due to dependencies that will be resolved in a follow-up pull request that is coming soon. Secondary changes: 1. Also extracted the SSH execution function from the fabric connector into a standalone function that can be used without having to have a Fabric connector instance created first. 2. Also extracted/abstracted some logic into a utility function for similar reasons that is used to replace logging configuration environment variables in shell commands that we use to perform contract deployment onto the Fabric test ledgers. Depends on hyperledger-cacti#3054 Signed-off-by: Peter Somogyvari <[email protected]>
petermetz
added a commit
that referenced
this pull request
Mar 7, 2024
The deployContractGoSourceV1() method now assumes that the underlying test ledger is Fabric 2.5 (current LTS). This will allow us to upgrade the contracts that are being used by the Supply chain app to Fabric 2.x from Fabric 1.x which will then implicitly fix a large number of other issues at the same time. This change is part of laying the foundation for that follow-up work. Primary changes: ----------------- 1. Added a new, standalone utility function to deploy go source contracts with the name of `deployContractGoSourceImplFabricV256()`. 2. The code of this function was derived from the original Fabric v1 compatible deployContractGoSourceV1 method of the Fabric connector. 3. 2 organizations are supported for deployment via the endpoint. 4. The endpoint is only used by the supply chain app example at the moment and there is no test coverage of it due to dependencies that will be resolved in a follow-up pull request that is coming soon. Secondary changes: 1. Also extracted the SSH execution function from the fabric connector into a standalone function that can be used without having to have a Fabric connector instance created first. 2. Also extracted/abstracted some logic into a utility function for similar reasons that is used to replace logging configuration environment variables in shell commands that we use to perform contract deployment onto the Fabric test ledgers. Depends on #3054 Signed-off-by: Peter Somogyvari <[email protected]>
petermetz
added a commit
to petermetz/cacti
that referenced
this pull request
Mar 7, 2024
The supply chain app's build and execution scripts should finally be working after this and also be much more stable than before due to the flakiness of the Fabric V1 test ledger not being an issue anymore. 1.The new contract is compiled with go v1.20 and therefore has to have the contract method names capitalized insted of camelCase, otherwise the methods are not possible to be exported and the contract deployment fails even if everything else is correct. 2. The supply chain app now uses the newest edition of the Fabric v2 AIO test ledger container image which uses Fabric v2.5.6 (current LTS at the time of this writing). 3. The shipment contract's source code has been migrated to Fabric v2 meaning that instead of a stub object we get a context object for each method's first parameter and then the stub can be acquired from that context object. 4. The method arguments no longer need to be passed around as an array of strings and instead the contract method's input arguments are first-class go method parameters. 5. Re-enabled a test case that was being skipped until now due to flakiness: ...`src/test/typescript/integration/supply-chain-backend-api-calls.test.ts` Depends on hyperledger-cacti#3058 Depends on hyperledger-cacti#3054 Fixes hyperledger-cacti#2945 Fixes hyperledger-cacti#2969 Fixes hyperledger-cacti#1899 Fixes hyperledger-cacti#1521 Fixes hyperledger-cacti#1518 Signed-off-by: Peter Somogyvari <[email protected]>
petermetz
added a commit
to petermetz/cacti
that referenced
this pull request
Mar 8, 2024
The supply chain app's build and execution scripts should finally be working after this and also be much more stable than before due to the flakiness of the Fabric V1 test ledger not being an issue anymore. The container image is now published as: `ghcr.io/hyperledger/cactus-example-supply-chain-app:2024-03-08--pr-3059-1` 1.The new contract is compiled with go v1.20 and therefore has to have the contract method names capitalized insted of camelCase, otherwise the methods are not possible to be exported and the contract deployment fails even if everything else is correct. 2. The supply chain app now uses the newest edition of the Fabric v2 AIO test ledger container image which uses Fabric v2.5.6 (current LTS at the time of this writing). 3. The shipment contract's source code has been migrated to Fabric v2 meaning that instead of a stub object we get a context object for each method's first parameter and then the stub can be acquired from that context object. 4. The method arguments no longer need to be passed around as an array of strings and instead the contract method's input arguments are first-class go method parameters. 5. Re-enabled a test case that was being skipped until now due to flakiness: ...`src/test/typescript/integration/supply-chain-backend-api-calls.test.ts` The supply chain app container image was built with this command: ```sh DOCKER_BUILDKIT=1 docker build \ --build-arg="NPM_PKG_VERSION=2.0.0-2945-supply-chain-app-build-failed.241+b2c306ea0" \ -f ./examples/cactus-example-supply-chain-backend/Dockerfile \ . \ -t scaeb ``` The NPM_PKG_VERSION build arg is important because the image defaults to "latest" which at the moment is packages that do not contain the fixes made by this commit, so re-building the image without that extra arg will not work until we issue the next official non-canary release. Depends on hyperledger-cacti#3058 Depends on hyperledger-cacti#3054 Fixes hyperledger-cacti#2945 Fixes hyperledger-cacti#2969 Fixes hyperledger-cacti#1899 Fixes hyperledger-cacti#1521 Fixes hyperledger-cacti#1518 Signed-off-by: Peter Somogyvari <[email protected]>
petermetz
added a commit
that referenced
this pull request
Mar 9, 2024
The supply chain app's build and execution scripts should finally be working after this and also be much more stable than before due to the flakiness of the Fabric V1 test ledger not being an issue anymore. The container image is now published as: `ghcr.io/hyperledger/cactus-example-supply-chain-app:2024-03-08--pr-3059-1` 1.The new contract is compiled with go v1.20 and therefore has to have the contract method names capitalized insted of camelCase, otherwise the methods are not possible to be exported and the contract deployment fails even if everything else is correct. 2. The supply chain app now uses the newest edition of the Fabric v2 AIO test ledger container image which uses Fabric v2.5.6 (current LTS at the time of this writing). 3. The shipment contract's source code has been migrated to Fabric v2 meaning that instead of a stub object we get a context object for each method's first parameter and then the stub can be acquired from that context object. 4. The method arguments no longer need to be passed around as an array of strings and instead the contract method's input arguments are first-class go method parameters. 5. Re-enabled a test case that was being skipped until now due to flakiness: ...`src/test/typescript/integration/supply-chain-backend-api-calls.test.ts` The supply chain app container image was built with this command: ```sh DOCKER_BUILDKIT=1 docker build \ --build-arg="NPM_PKG_VERSION=2.0.0-2945-supply-chain-app-build-failed.241+b2c306ea0" \ -f ./examples/cactus-example-supply-chain-backend/Dockerfile \ . \ -t scaeb ``` The NPM_PKG_VERSION build arg is important because the image defaults to "latest" which at the moment is packages that do not contain the fixes made by this commit, so re-building the image without that extra arg will not work until we issue the next official non-canary release. Depends on #3058 Depends on #3054 Fixes #2945 Fixes #2969 Fixes #1899 Fixes #1521 Fixes #1518 Signed-off-by: Peter Somogyvari <[email protected]>
petermetz
added a commit
to petermetz/cacti
that referenced
this pull request
Mar 10, 2024
The deployContractGoSourceV1() method now assumes that the underlying test ledger is Fabric 2.5 (current LTS). This will allow us to upgrade the contracts that are being used by the Supply chain app to Fabric 2.x from Fabric 1.x which will then implicitly fix a large number of other issues at the same time. This change is part of laying the foundation for that follow-up work. Primary changes: ----------------- 1. Added a new, standalone utility function to deploy go source contracts with the name of `deployContractGoSourceImplFabricV256()`. 2. The code of this function was derived from the original Fabric v1 compatible deployContractGoSourceV1 method of the Fabric connector. 3. 2 organizations are supported for deployment via the endpoint. 4. The endpoint is only used by the supply chain app example at the moment and there is no test coverage of it due to dependencies that will be resolved in a follow-up pull request that is coming soon. Secondary changes: 1. Also extracted the SSH execution function from the fabric connector into a standalone function that can be used without having to have a Fabric connector instance created first. 2. Also extracted/abstracted some logic into a utility function for similar reasons that is used to replace logging configuration environment variables in shell commands that we use to perform contract deployment onto the Fabric test ledgers. Depends on hyperledger-cacti#3054 Signed-off-by: Peter Somogyvari <[email protected]>
petermetz
added a commit
to petermetz/cacti
that referenced
this pull request
Mar 10, 2024
The supply chain app's build and execution scripts should finally be working after this and also be much more stable than before due to the flakiness of the Fabric V1 test ledger not being an issue anymore. The container image is now published as: `ghcr.io/hyperledger/cactus-example-supply-chain-app:2024-03-08--pr-3059-1` 1.The new contract is compiled with go v1.20 and therefore has to have the contract method names capitalized insted of camelCase, otherwise the methods are not possible to be exported and the contract deployment fails even if everything else is correct. 2. The supply chain app now uses the newest edition of the Fabric v2 AIO test ledger container image which uses Fabric v2.5.6 (current LTS at the time of this writing). 3. The shipment contract's source code has been migrated to Fabric v2 meaning that instead of a stub object we get a context object for each method's first parameter and then the stub can be acquired from that context object. 4. The method arguments no longer need to be passed around as an array of strings and instead the contract method's input arguments are first-class go method parameters. 5. Re-enabled a test case that was being skipped until now due to flakiness: ...`src/test/typescript/integration/supply-chain-backend-api-calls.test.ts` The supply chain app container image was built with this command: ```sh DOCKER_BUILDKIT=1 docker build \ --build-arg="NPM_PKG_VERSION=2.0.0-2945-supply-chain-app-build-failed.241+b2c306ea0" \ -f ./examples/cactus-example-supply-chain-backend/Dockerfile \ . \ -t scaeb ``` The NPM_PKG_VERSION build arg is important because the image defaults to "latest" which at the moment is packages that do not contain the fixes made by this commit, so re-building the image without that extra arg will not work until we issue the next official non-canary release. Depends on hyperledger-cacti#3058 Depends on hyperledger-cacti#3054 Fixes hyperledger-cacti#2945 Fixes hyperledger-cacti#2969 Fixes hyperledger-cacti#1899 Fixes hyperledger-cacti#1521 Fixes hyperledger-cacti#1518 Signed-off-by: Peter Somogyvari <[email protected]>
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.
which has increased stability and of course adheres to general best
practices more thoroughly since now we are in sync with the Fabric
maintainers in terms of LTS.
some of the configuration files under different paths and this had to be
reverse engineered by manually inspecting the containers at runtime and
searching for the same files in different directories. To make this
easier in the future for people who are using the AIO image, we've added
a collection of constants to the test-tooling package that stores the
paths hardcoded that are exported via verbose variable names that pin these
to the specific Fabric version they are related to so that in the future
if these paths change again, we can accommodate the change in a way that
is not too confusing by exporting more variables with slightly different
names and values.
Dockerfile_v2
is accessible on GHCRas:
ghcr.io/hyperledger/cactus-fabric2-all-in-one:2024-03-03--issue-2945-fabric-v2-5-6
which has the v2.5.6 versioned container images pre-cached (embedded) so that
network transfer does not need to occur and rate limiting doesn't produce
CI flakes (DockerHub has rate limits for image downloading that we regularly
hit when we don't embed the Fabric container images this way...).
container at runtime?
4.1. The list of constants and their names/values change based on the
Fabric version that's being used by the AIO image.
4.2. The only ones that could be pulled are the ones that belong to the
first organization because this is the one that the CLI container uses.
4.3. Configuration files that store the constants' values for the second
organization are also located in different directories depending on the
Fabric version being used.
4.4. The fabric-samples repo have been known to make breaking changes
to older releases which would then make it even harder to debug if we
had logic for identifying the constants that suddenly broke (this specific
incident has happened in the past unfortunately)
4.5. In short, there is definitely a case for applying the DRY principle
here, but in this particular case it appears to be not worth it due to
the increased complexity that the convoluted additional logic would bring.
Related but does not fix #1899
Signed-off-by: Peter Somogyvari [email protected]
Pull Request Requirements
upstream/main
branch and squashed into single commit to help maintainers review it more efficient and to avoid spaghetti git commit graphs that obfuscate which commit did exactly what change, when and, why.-s
flag when usinggit commit
command. You may refer to this link for more information.Character Limit
A Must Read for Beginners
For rebasing and squashing, here's a must read guide for beginners.