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

feat(fabric-connector): contract deployment endpoint #616

Closed
petermetz opened this issue Mar 1, 2021 · 0 comments · Fixed by #619
Closed

feat(fabric-connector): contract deployment endpoint #616

petermetz opened this issue Mar 1, 2021 · 0 comments · Fixed by #619
Assignees
Labels

Comments

@petermetz
Copy link
Member

Description

Implement the long awaited chaincode contract deployment endpoint that we had a few working drafts of before but ultimately had to keep out until now due to failing tests and not enough time to properly cover the corner cases.

Earlier draft(s) of the deploy endpoint for reference and posterity:

petermetz@6944f86

38e9780

 private async doDeploy(req: Request): Promise<any> {
    const fnTag = "DeployContractGoBinEndpointV1#doDeploy()";

    this.log.debug(`ENTER doDeploy()`);
    try {
      const { sshConfig, connectionProfile, adminSigningIdentity } = this.opts;
      if (!Array.isArray(req.files)) {
        throw new TypeError(`${fnTag} expected req.files to be an array`);
      }
      const goSourceFile = req.files.find((f) =>
        f.originalname.endsWith(".go")
      );
      if (!goSourceFile) {
        throw new Error(`${fnTag} .go source file not among uploaded files`);
      }
      const goPath = "/root/go/";
      const ccName = path.basename(goSourceFile.originalname, ".go");
      const remoteDirPath = path.join(goPath, "src/", ccName);

      temp.track();
      const tmpDirPath = temp.mkdirSync("deploy-contract-go-bin-endpoint-v1");

      const ssh = new NodeSSH();
      await ssh.connect(sshConfig);
      this.log.debug(`SSH connection OK`);

      if (Array.isArray(req.files)) {
        for (const aFile of req.files) {
          const localFilePath = path.join(tmpDirPath, aFile.originalname);
          fs.writeFileSync(localFilePath, aFile.buffer, "binary");

          const remoteFilePath = path.join(remoteDirPath, aFile.originalname);

          this.log.debug(`SCP from/to %o => %o`, localFilePath, remoteFilePath);
          await ssh.putFile(localFilePath, remoteFilePath);
          this.log.debug(`SCP OK %o`, remoteFilePath);
        }
      } else {
        throw new TypeError(`${fnTag} expected req.files to be an array`);
      }

      const env = {
        CORE_PEER_ADDRESS: "localhost:7051",
        CORE_PEER_LOCALMSPID: "Org1MSP",
        CORE_VM_DOCKER_ATTACHSTDOUT: "true",
        FABRIC_LOGGING_SPEC: "DEBUG",
        CORE_PEER_MSPCONFIGPATH:
          "/etc/hyperledger/fabric/peer/users/Admin@org1.cactus.stream/msp",

        // CORE_PEER_ADDRESS: this.opts.corePeerAddress || "localhost:7051",
        CORE_CHAINCODE_ID_NAME: this.opts.coreChaincodeIdName || "mycc:0",
      };
      const sshCmdOptions: SSHExecCommandOptions = {
        execOptions: {
          pty: true,
        },
        cwd: remoteDirPath,
      };

      const cmdEnv = Object.entries(env)
        .map(([key, value]) => `${key}=${value}`)
        .join(" ");

      const ccVersion = "1.0.0";
      const ccBinPath = ccName;
      const cmdArgs = `--name ${ccName} --version ${ccVersion} -p ${ccBinPath}`;
      const installCmd = `${cmdEnv} peer chaincode install ${cmdArgs}`;

      this.log.debug(`Install CMD: %o`, installCmd);
      const installCmdRes = await ssh.execCommand(installCmd, sshCmdOptions);
      this.log.debug(`Install CMD Response: %o`, installCmdRes);
      let success = true;
      success = success && installCmdRes.code === null;

      const ordererEndpoint = "localhost:7050";
      const instantiateCmd = `${cmdEnv} peer chaincode instantiate --name ${ccName} --version ${ccVersion} --ctor '{"Args":["john","99"]}' --channelID mychannel --logging-level=DEBUG --lang golang --orderer=${ordererEndpoint}`;
      this.log.debug(`Instantiate CMD: %o`, instantiateCmd);
      const instantiateCmdRes = await ssh.execCommand(
        instantiateCmd,
        sshCmdOptions
      );
      this.log.debug(`Instantiate CMD Response: %o`, instantiateCmdRes);
      success = success && instantiateCmdRes.code === null;

      // fs.unlinkSync(localFilePath);
      fs.rmdirSync(tmpDirPath, { recursive: true });

      this.log.debug(`EXIT doDeploy()`);
      return { success, installCmdRes, instantiateCmdRes };
    } finally {
      temp.cleanup();
    }
  }

Acceptance Criteria

  1. Test verifying contract deployment does so without making assumptions about the fabric network (previous test is dependent on the fabric-samples tooling, scripts that do the contract deployment so it wasn't actually a real test at all in terms of deploying chain code.

cc: @takeutak @sfuji822 @hartm @jonathan-m-hamilton @AzaharaC @jordigiam @kikoncuo

@petermetz petermetz self-assigned this Mar 1, 2021
@petermetz petermetz added API_Server enhancement New feature or request Fabric labels Mar 1, 2021
petermetz added a commit to petermetz/cacti that referenced this issue Mar 2, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 2, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 2, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 2, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 5, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 5, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
AzaharaC pushed a commit to kikoncuo/cactus that referenced this issue Mar 5, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 8, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 8, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 8, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 8, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 9, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616
petermetz added a commit to petermetz/cacti that referenced this issue Mar 9, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 10, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Mar 10, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit that referenced this issue Mar 11, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes #616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
AzaharaC pushed a commit to kikoncuo/cactus that referenced this issue Mar 12, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
jordigiam pushed a commit to kikoncuo/cactus that referenced this issue Apr 8, 2021
Primary change
=============

Finally adds real support for chain code deployment with
custom made contracts not just the ones that the fabric
samples container comes pre-built with.

Additional notes, changes
========================

1. Makes assumptions about the ledger being containerized the
same way the fabric-samples repo does it, e.g. there must
be a container called "cli" which is set up to execute the peer
binary and to be able to perform go builds with a version of
go that has go modules support (1.11+ IIRC)
2. Does not yet support Fabric 2.x (at least it was not tested)
3. Magic strings in the connector that still need to be eliminted.
4. Go mod file upload is not supported, for now one must use the
pinned dependencies array to lock dependencies to specific versions.
5. The deployment endpoint supports deploying to multiple orgs
with a single request but this only makes sense for example code
since in a production environment it is not expected that different
organizations will share the same server/container to run their
infrastructure.
6. Output structure is not yet finalized. Priority was for now to
at least allow failure detection. Diagnostics is a bit harder to
achieve but should come in a follow-up improvement nevertheless.
7. Forced to use ugly timeout to make sure test is passing.
8. Pending refactor of the chaincode compiler which will no
longer build on the file-system locally (after the refactor
is done). For now the test is being skipped.

End to end test demonstrating how it all works can be seen at:
packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/deploy-contract-go-bin-endpoint-v1/deploy-contract/deploy-cc-from-golang-source.test.ts

Fixes hyperledger#616

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant