-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(test-tooling): migrate AIO image to Fabric v2.5.6, add constants
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 https://github.com/hyperledger/cacti/issues/1899 Signed-off-by: Peter Somogyvari <[email protected]>
- Loading branch information
Showing
4 changed files
with
163 additions
and
2 deletions.
There are no files selected for viewing
125 changes: 125 additions & 0 deletions
125
packages/cactus-test-tooling/src/main/typescript/fabric/fabric-samples-env-constants.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
export interface IFabricOrgEnvInfo extends NodeJS.ProcessEnv { | ||
[key: string]: string | undefined; | ||
readonly CORE_PEER_TLS_ENABLED: string; | ||
readonly CORE_PEER_LOCALMSPID: string; | ||
readonly CORE_PEER_TLS_CERT_FILE: string; | ||
readonly CORE_PEER_TLS_KEY_FILE: string; | ||
readonly CORE_PEER_ADDRESS: string; | ||
readonly CORE_PEER_MSPCONFIGPATH: string; | ||
readonly CORE_PEER_TLS_ROOTCERT_FILE: string; | ||
readonly ORDERER_TLS_ROOTCERT_FILE: string; | ||
} | ||
|
||
export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ENABLED_ORG_1 = "true"; | ||
export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_LOCALMSPID_ORG_1 = | ||
"Org1MSP"; | ||
export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_CERT_FILE_ORG_1 = | ||
"/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt"; | ||
|
||
export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_KEY_FILE_ORG_1 = | ||
"/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key"; | ||
|
||
export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_ADDRESS_ORG_1 = | ||
"peer0.org1.example.com:7051"; | ||
|
||
export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_MSPCONFIGPATH_ORG_1 = | ||
"/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/users/[email protected]/msp"; | ||
|
||
export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ROOTCERT_FILE_ORG_1 = | ||
"/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"; | ||
|
||
export const FABRIC_25_LTS_FABRIC_SAMPLES__ORDERER_TLS_ROOTCERT_FILE_ORG_1 = | ||
"/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem"; | ||
|
||
/** | ||
* Contains the file paths and other configuration parameters (such as flags, | ||
* hostnames etc.) that are a match for what you need to execute peer commands | ||
* from within the "cli" container of the fabric samples test network. | ||
* | ||
* The aforementioned test network ships with 2 organizations by default, this | ||
* is the configuration to make the peer binary talk to the **first** organization. | ||
* | ||
* Important note: The paths are only accurate within the mentioned `cli` container | ||
* as defined in the compose .yaml files describing the test network. Therefore, | ||
* if you have shelled into the Cacti All-in-One Fabric container, these are not | ||
* useful there, instead you need to shell into the nested `cli` container by | ||
* executing something like `docker exec -it cli bash` which will then get you | ||
* to the environment where these paths are representative and useful. | ||
* | ||
* @see https://github.com/hyperledger/fabric-samples | ||
*/ | ||
export const FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1: IFabricOrgEnvInfo = { | ||
CORE_PEER_TLS_ENABLED: | ||
FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ENABLED_ORG_1, | ||
CORE_PEER_LOCALMSPID: | ||
FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_LOCALMSPID_ORG_1, | ||
CORE_PEER_TLS_CERT_FILE: | ||
FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_CERT_FILE_ORG_1, | ||
CORE_PEER_TLS_KEY_FILE: | ||
FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_KEY_FILE_ORG_1, | ||
CORE_PEER_ADDRESS: FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_ADDRESS_ORG_1, | ||
CORE_PEER_MSPCONFIGPATH: | ||
FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_MSPCONFIGPATH_ORG_1, | ||
CORE_PEER_TLS_ROOTCERT_FILE: | ||
FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ROOTCERT_FILE_ORG_1, | ||
ORDERER_TLS_ROOTCERT_FILE: | ||
FABRIC_25_LTS_FABRIC_SAMPLES__ORDERER_TLS_ROOTCERT_FILE_ORG_1, | ||
}; | ||
|
||
export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ENABLED_ORG_2 = "true"; | ||
|
||
export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_LOCALMSPID_ORG_2 = | ||
"Org2MSP"; | ||
|
||
export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_CERT_FILE_ORG_2 = | ||
"/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.crt"; | ||
|
||
export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_KEY_FILE_ORG_2 = | ||
"/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key"; | ||
|
||
export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_ADDRESS_ORG_2 = | ||
"peer0.org2.example.com:9051"; | ||
|
||
export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_MSPCONFIGPATH_ORG_2 = | ||
"/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org2.example.com/users/[email protected]/msp"; | ||
|
||
export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ROOTCERT_FILE_ORG_2 = | ||
"/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"; | ||
|
||
export const FABRIC_25_LTS_FABRIC_SAMPLES__ORDERER_TLS_ROOTCERT_FILE_ORG_2 = | ||
"/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem"; | ||
|
||
/** | ||
* Contains the file paths and other configuration parameters (such as flags, | ||
* hostnames etc.) that are a match for what you need to execute peer commands | ||
* from within the "cli" container of the fabric samples test network. | ||
* | ||
* The aforementioned test network ships with 2 organizations by default, this | ||
* is the configuration to make the peer binary talk to the **second** organization. | ||
* | ||
* Important note: The paths are only accurate within the mentioned `cli` container | ||
* as defined in the compose .yaml files describing the test network. Therefore, | ||
* if you have shelled into the Cacti All-in-One Fabric container, these are not | ||
* useful there, instead you need to shell into the nested `cli` container by | ||
* executing something like `docker exec -it cli bash` which will then get you | ||
* to the environment where these paths are representative and useful. | ||
* | ||
* @see https://github.com/hyperledger/fabric-samples | ||
*/ | ||
export const FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_2: IFabricOrgEnvInfo = { | ||
CORE_PEER_TLS_ENABLED: | ||
FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ENABLED_ORG_2, | ||
CORE_PEER_LOCALMSPID: | ||
FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_LOCALMSPID_ORG_2, | ||
CORE_PEER_TLS_CERT_FILE: | ||
FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_CERT_FILE_ORG_2, | ||
CORE_PEER_TLS_KEY_FILE: | ||
FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_KEY_FILE_ORG_2, | ||
CORE_PEER_ADDRESS: FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_ADDRESS_ORG_2, | ||
CORE_PEER_MSPCONFIGPATH: | ||
FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_MSPCONFIGPATH_ORG_2, | ||
CORE_PEER_TLS_ROOTCERT_FILE: | ||
FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ROOTCERT_FILE_ORG_2, | ||
ORDERER_TLS_ROOTCERT_FILE: | ||
FABRIC_25_LTS_FABRIC_SAMPLES__ORDERER_TLS_ROOTCERT_FILE_ORG_2, | ||
}; |
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
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
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
f59f369
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.
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
0.05
.cmd-api-server_HTTP_GET_getOpenApiSpecV1
623
ops/sec (±1.67%
)613
ops/sec (±1.68%
)0.98
cmd-api-server_gRPC_GetOpenApiSpecV1
397
ops/sec (±1.55%
)377
ops/sec (±1.47%
)0.95
This comment was automatically generated by workflow using github-action-benchmark.
CC: @petermetz