diff --git a/.github/actions/fsat-setup/action.yaml b/.github/actions/fsat-setup/action.yaml index 0ea48959..f5477a79 100644 --- a/.github/actions/fsat-setup/action.yaml +++ b/.github/actions/fsat-setup/action.yaml @@ -10,6 +10,12 @@ inputs: k9s-version: description: k9s Version default: v0.25.3 + fabric-version: + description: Version of Hyperledger Fabric + default: 2.5.0-alpha3 + ca-version: + description: Version of Hyperledger Fabric CA + default: 1.5.6-beta3 runs: using: "composite" @@ -42,5 +48,6 @@ runs: shell: bash working-directory: full-stack-asset-transfer-guide run: | - curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh | bash -s -- binary + curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh \ + | bash -s -- binary --fabric-version ${{ inputs.fabric-version }} --ca-version ${{ inputs.ca-version }} echo ${PWD}/bin >> $GITHUB_PATH diff --git a/.github/workflows/test-fsat.yaml b/.github/workflows/test-fsat.yaml index 09d58ec4..60ccef46 100644 --- a/.github/workflows/test-fsat.yaml +++ b/.github/workflows/test-fsat.yaml @@ -7,8 +7,6 @@ on: branches: - "main" - "release-2.5" - paths: - - "full-stack-asset-transfer-guide/**" jobs: ansible: diff --git a/asset-transfer-sbe/chaincode-java/build.gradle b/asset-transfer-sbe/chaincode-java/build.gradle index 44f29319..899d403f 100644 --- a/asset-transfer-sbe/chaincode-java/build.gradle +++ b/asset-transfer-sbe/chaincode-java/build.gradle @@ -14,13 +14,13 @@ version '1.0-SNAPSHOT' dependencies { - implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.+' + implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.4.1' implementation 'org.json:json:+' implementation 'com.google.protobuf:protobuf-java:3.+' - implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-protos:2.+' + implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-protos:2.4.1' implementation 'com.owlike:genson:1.5' - testImplementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.+' + testImplementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.4.1' testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' testImplementation 'org.assertj:assertj-core:3.11.1' testImplementation 'org.mockito:mockito-core:2.+' diff --git a/asset-transfer-sbe/chaincode-typescript/package.json b/asset-transfer-sbe/chaincode-typescript/package.json index 7250279f..7f458aae 100644 --- a/asset-transfer-sbe/chaincode-typescript/package.json +++ b/asset-transfer-sbe/chaincode-typescript/package.json @@ -21,8 +21,9 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { - "fabric-contract-api": "^2.5.0", - "fabric-shim": "^2.5.0" + "@grpc/grpc-js": "1.8.1", + "fabric-contract-api": "~2.5.2", + "fabric-shim": "~2.5.2" }, "devDependencies": { "@types/chai": "^4.2.11", diff --git a/full-stack-asset-transfer-guide/.github/workflows/asset-tx-typescript-contract-image.yaml b/full-stack-asset-transfer-guide/.github/workflows/asset-tx-typescript-contract-image.yaml deleted file mode 100644 index c65bb790..00000000 --- a/full-stack-asset-transfer-guide/.github/workflows/asset-tx-typescript-contract-image.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: Asset Tx Contract Image CI - -on: - push: - branches: - - 'main' - tags: - - 'v*' - paths: - - 'contracts/asset-transfer-typescript/**' - pull_request: - branches: - - 'main' - paths: - - 'contracts/asset-transfer-typescript/**' - -jobs: - docker_build: - name: Docker build - uses: ./.github/workflows/docker-build.yaml - with: - imagename: full-stack-asset-transfer-guide/contracts/asset-transfer-typescript - path: contracts/asset-transfer-typescript - chaincode-label: asset-transfer-typescript diff --git a/full-stack-asset-transfer-guide/.github/workflows/docker-build.yaml b/full-stack-asset-transfer-guide/.github/workflows/docker-build.yaml deleted file mode 100644 index 894aedc2..00000000 --- a/full-stack-asset-transfer-guide/.github/workflows/docker-build.yaml +++ /dev/null @@ -1,78 +0,0 @@ -name: Docker CI - -on: - workflow_call: - inputs: - imagename: - description: 'A Docker image name passed from the caller workflow' - required: true - type: string - path: - description: 'A path containing a Dockerfile passed from the caller workflow' - required: true - type: string - chaincode-label: - description: 'An optional chaincode package label passed from the caller workflow. If present, will prepare a chaincode package.' - required: false - type: string - -jobs: - build: - runs-on: ubuntu-latest - outputs: - image_digest: ${{ steps.publish_image.outputs.image_digest }} - - steps: - - uses: actions/checkout@v3 - - name: Build Docker image - run: | - docker build ${DOCKER_BUILD_PATH} --file ${DOCKER_BUILD_PATH}/Dockerfile --label "org.opencontainers.image.revision=${GITHUB_SHA}" --tag ${IMAGE_NAME} - docker tag ${IMAGE_NAME} ghcr.io/hyperledgendary/${IMAGE_NAME}:${GITHUB_SHA} - if [ "${GITHUB_REF:0:10}" = "refs/tags/" ]; then - docker tag ${IMAGE_NAME} ghcr.io/hyperledgendary/${IMAGE_NAME}:${GITHUB_REF_NAME} - docker tag ${IMAGE_NAME} ghcr.io/hyperledgendary/${IMAGE_NAME}:latest - fi - env: - DOCKER_BUILD_PATH: ${{ inputs.path }} - IMAGE_NAME: ${{ inputs.imagename }} - - name: Publish Docker image - id: publish_image - if: github.event_name != 'pull_request' - run: | - echo ${DOCKER_PW} | docker login ghcr.io -u ${DOCKER_USER} --password-stdin - docker push ghcr.io/hyperledgendary/${IMAGE_NAME}:${GITHUB_SHA} - if [ "${GITHUB_REF:0:10}" = "refs/tags/" ]; then - docker push ghcr.io/hyperledgendary/${IMAGE_NAME}:${GITHUB_REF_NAME} - docker push ghcr.io/hyperledgendary/${IMAGE_NAME}:latest - fi - echo ::set-output name=image_digest::$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/hyperledgendary/${IMAGE_NAME}:${GITHUB_SHA} | cut -d'@' -f2) - env: - IMAGE_NAME: ${{ inputs.imagename }} - DOCKER_USER: ${{ github.actor }} - DOCKER_PW: ${{ secrets.GITHUB_TOKEN }} - - package: - if: inputs.chaincode-label != '' && needs.build.outputs.image_digest != '' - needs: build - runs-on: ubuntu-latest - - steps: - - name: Create package - uses: hyperledgendary/package-k8s-chaincode-action@ba10aea43e3d4f7991116527faf96e3c2b07abc7 - with: - chaincode-label: ${{ inputs.chaincode-label }} - chaincode-image: ghcr.io/hyperledgendary/${{ inputs.imagename }} - chaincode-digest: ${{ needs.build.outputs.image_digest }} - - - name: Rename package - if: startsWith(github.ref, 'refs/tags/v') - run: mv ${{ inputs.chaincode-label }}.tgz ${{ inputs.chaincode-label }}-${CHAINCODE_VERSION}.tgz - env: - IMAGE_NAME: ${{ inputs.imagename }} - CHAINCODE_VERSION: ${{ github.ref_name }} - - - name: Release package - if: startsWith(github.ref, 'refs/tags/v') - uses: softprops/action-gh-release@v1 - with: - files: ${{ inputs.chaincode-label }}-${{ github.ref_name }}.tgz \ No newline at end of file diff --git a/full-stack-asset-transfer-guide/.github/workflows/test-ansible.yaml b/full-stack-asset-transfer-guide/.github/workflows/test-ansible.yaml deleted file mode 100644 index e82f8739..00000000 --- a/full-stack-asset-transfer-guide/.github/workflows/test-ansible.yaml +++ /dev/null @@ -1,49 +0,0 @@ -name: test-ansible - -on: - pull_request: - branches: - - main - -jobs: - test-ansible: - runs-on: ubuntu-latest - - steps: - - name: checkout - uses: actions/checkout@v3 - - - name: k9s - env: - K9S_VERSION: v0.25.3 - run: | - curl --fail --silent --show-error -L https://github.com/derailed/k9s/releases/download/${K9S_VERSION}/k9s_Linux_x86_64.tar.gz -o /tmp/k9s_Linux_x86_64.tar.gz - tar -zxf /tmp/k9s_Linux_x86_64.tar.gz -C /usr/local/bin k9s - sudo chown root /usr/local/bin/k9s - sudo chmod 755 /usr/local/bin/k9s - - - name: just - env: - JUST_VERSION: 1.2.0 - run: | - curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --tag ${JUST_VERSION} --to /usr/local/bin - - - name: weft - run: | - npm install -g @hyperledger-labs/weft - - - name: fabric - run: | - curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh | bash -s -- binary - - - name: check prereqs - run: | - export WORKSHOP_PATH="${PWD}" - export PATH="${WORKSHOP_PATH}/bin:${PATH}" - export FABRIC_CFG_PATH="${WORKSHOP_PATH}/config" - - ./check.sh - - - name: just test-ansible - run: | - just test-ansible \ No newline at end of file diff --git a/full-stack-asset-transfer-guide/.github/workflows/test-chaincode.yaml b/full-stack-asset-transfer-guide/.github/workflows/test-chaincode.yaml deleted file mode 100644 index 459b0711..00000000 --- a/full-stack-asset-transfer-guide/.github/workflows/test-chaincode.yaml +++ /dev/null @@ -1,49 +0,0 @@ -name: test-chaincode - -on: - pull_request: - branches: - - main - -jobs: - test-chaincode: - runs-on: ubuntu-latest - - steps: - - name: checkout - uses: actions/checkout@v3 - - - name: k9s - env: - K9S_VERSION: v0.25.3 - run: | - curl --fail --silent --show-error -L https://github.com/derailed/k9s/releases/download/${K9S_VERSION}/k9s_Linux_x86_64.tar.gz -o /tmp/k9s_Linux_x86_64.tar.gz - tar -zxf /tmp/k9s_Linux_x86_64.tar.gz -C /usr/local/bin k9s - sudo chown root /usr/local/bin/k9s - sudo chmod 755 /usr/local/bin/k9s - - - name: just - env: - JUST_VERSION: 1.2.0 - run: | - curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --tag ${JUST_VERSION} --to /usr/local/bin - - - name: weft - run: | - npm install -g @hyperledger-labs/weft - - - name: fabric - run: | - curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh | bash -s -- binary - - - name: check prereqs - run: | - export WORKSHOP_PATH="${PWD}" - export PATH="${WORKSHOP_PATH}/bin:${PATH}" - export FABRIC_CFG_PATH="${WORKSHOP_PATH}/config" - - ./check.sh - - - name: just test-chaincode - run: | - just test-chaincode \ No newline at end of file diff --git a/full-stack-asset-transfer-guide/.github/workflows/test-cloud.yaml b/full-stack-asset-transfer-guide/.github/workflows/test-cloud.yaml deleted file mode 100644 index ce9a2c9d..00000000 --- a/full-stack-asset-transfer-guide/.github/workflows/test-cloud.yaml +++ /dev/null @@ -1,49 +0,0 @@ -name: test-cloud - -on: - pull_request: - branches: - - main - -jobs: - test-cloud: - runs-on: ubuntu-latest - - steps: - - name: checkout - uses: actions/checkout@v3 - - - name: k9s - env: - K9S_VERSION: v0.25.3 - run: | - curl --fail --silent --show-error -L https://github.com/derailed/k9s/releases/download/${K9S_VERSION}/k9s_Linux_x86_64.tar.gz -o /tmp/k9s_Linux_x86_64.tar.gz - tar -zxf /tmp/k9s_Linux_x86_64.tar.gz -C /usr/local/bin k9s - sudo chown root /usr/local/bin/k9s - sudo chmod 755 /usr/local/bin/k9s - - - name: just - env: - JUST_VERSION: 1.2.0 - run: | - curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --tag ${JUST_VERSION} --to /usr/local/bin - - - name: weft - run: | - npm install -g @hyperledger-labs/weft - - - name: fabric - run: | - curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh | bash -s -- binary - - - name: check prereqs - run: | - export WORKSHOP_PATH="${PWD}" - export PATH="${WORKSHOP_PATH}/bin:${PATH}" - export FABRIC_CFG_PATH="${WORKSHOP_PATH}/config" - - ./check.sh - - - name: just test-cloud - run: | - just test-cloud \ No newline at end of file diff --git a/full-stack-asset-transfer-guide/.github/workflows/test-console.yaml b/full-stack-asset-transfer-guide/.github/workflows/test-console.yaml deleted file mode 100644 index c3969a99..00000000 --- a/full-stack-asset-transfer-guide/.github/workflows/test-console.yaml +++ /dev/null @@ -1,49 +0,0 @@ -name: test-console - -on: - pull_request: - branches: - - main - -jobs: - test-console: - runs-on: ubuntu-latest - - steps: - - name: checkout - uses: actions/checkout@v3 - - - name: k9s - env: - K9S_VERSION: v0.25.3 - run: | - curl --fail --silent --show-error -L https://github.com/derailed/k9s/releases/download/${K9S_VERSION}/k9s_Linux_x86_64.tar.gz -o /tmp/k9s_Linux_x86_64.tar.gz - tar -zxf /tmp/k9s_Linux_x86_64.tar.gz -C /usr/local/bin k9s - sudo chown root /usr/local/bin/k9s - sudo chmod 755 /usr/local/bin/k9s - - - name: just - env: - JUST_VERSION: 1.2.0 - run: | - curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --tag ${JUST_VERSION} --to /usr/local/bin - - - name: weft - run: | - npm install -g @hyperledger-labs/weft - - - name: fabric - run: | - curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh | bash -s -- binary - - - name: check prereqs - run: | - export WORKSHOP_PATH="${PWD}" - export PATH="${WORKSHOP_PATH}/bin:${PATH}" - export FABRIC_CFG_PATH="${WORKSHOP_PATH}/config" - - ./check.sh - - - name: just test-console - run: | - just test-console \ No newline at end of file diff --git a/full-stack-asset-transfer-guide/applications/trader-typescript/src/contract.ts b/full-stack-asset-transfer-guide/applications/trader-typescript/src/contract.ts index e14ffd57..2e210c68 100644 --- a/full-stack-asset-transfer-guide/applications/trader-typescript/src/contract.ts +++ b/full-stack-asset-transfer-guide/applications/trader-typescript/src/contract.ts @@ -76,8 +76,10 @@ export class AssetTransfer { } async transferAsset(id: string, newOwner: string, newOwnerOrg: string): Promise { - // TODO: Implement me! - // Submit a 'TransferAsset' transaction, which requires [id, newOwner, newOwnerOrg] arguments. + console.log(`transferring asset '${id}' to ${newOwner}, ${newOwnerOrg}`); + // TODO: implement the transferAsset() function. + // TODO: submit a 'TransferAsset' transaction, requiring [id, newOwner, newOwnerOrg] arguments. + return Promise.reject(new Error('TODO: implement the contract.ts transferAsset() function.')); } } diff --git a/full-stack-asset-transfer-guide/contracts/asset-transfer-typescript/package.json b/full-stack-asset-transfer-guide/contracts/asset-transfer-typescript/package.json index 1b6f63ff..ebf36efa 100644 --- a/full-stack-asset-transfer-guide/contracts/asset-transfer-typescript/package.json +++ b/full-stack-asset-transfer-guide/contracts/asset-transfer-typescript/package.json @@ -26,8 +26,8 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { - "fabric-contract-api": "^2.4.0", - "fabric-shim": "^2.4.0", + "fabric-contract-api": "~2.5.2", + "fabric-shim": "~2.5.2", "json-stringify-deterministic": "^1.0.7", "sort-keys-recursive": "^2.1.7" }, diff --git a/full-stack-asset-transfer-guide/infrastructure/sample-network/network b/full-stack-asset-transfer-guide/infrastructure/sample-network/network index bab91ed6..0e1f9373 100755 --- a/full-stack-asset-transfer-guide/infrastructure/sample-network/network +++ b/full-stack-asset-transfer-guide/infrastructure/sample-network/network @@ -78,13 +78,13 @@ context CA_IMAGE_LABEL ${FABRIC_CA_VERSION} #context PEER_IMAGE ${FABRIC_CONTAINER_REGISTRY}/fabric-peer #context PEER_IMAGE_LABEL ${FABRIC_VERSION} context PEER_IMAGE ghcr.io/hyperledger-labs/k8s-fabric-peer -context PEER_IMAGE_LABEL v0.7.2 # FROM fabric-peer 2.4 +context PEER_IMAGE_LABEL v0.8.0 context ORDERER_IMAGE ${FABRIC_CONTAINER_REGISTRY}/fabric-orderer context ORDERER_IMAGE_LABEL ${FABRIC_VERSION} context TOOLS_IMAGE ${FABRIC_CONTAINER_REGISTRY}/fabric-tools context TOOLS_IMAGE_LABEL ${FABRIC_VERSION} context OPERATOR_IMAGE ghcr.io/hyperledger-labs/fabric-operator -context OPERATOR_IMAGE_LABEL latest-amd64 +context OPERATOR_IMAGE_LABEL 1.0.4 context INIT_IMAGE registry.access.redhat.com/ubi8/ubi-minimal context INIT_IMAGE_LABEL latest context GRPCWEB_IMAGE ghcr.io/hyperledger-labs/grpc-web diff --git a/full-stack-asset-transfer-guide/tests/20-cloud-e2e.sh b/full-stack-asset-transfer-guide/tests/20-cloud-e2e.sh index a747ea69..f6f3d384 100755 --- a/full-stack-asset-transfer-guide/tests/20-cloud-e2e.sh +++ b/full-stack-asset-transfer-guide/tests/20-cloud-e2e.sh @@ -32,8 +32,6 @@ trap exitHook SIGINT SIGTERM EXIT # 00-setup ############################################################################### -curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh | bash -s -- binary - export WORKSHOP_PATH="${PWD}" export PATH="${WORKSHOP_PATH}/bin:${PATH}" export FABRIC_CFG_PATH="${WORKSHOP_PATH}/config" @@ -188,8 +186,8 @@ function build_cc() { CHAINCODE_IMAGE=$CONTAINER_REGISTRY/$CHAINCODE_NAME # Build the chaincode image - # TODO: configure buildx builders on the CI runners to ensure target arch and os are automatically set. - docker build --build-arg TARGETARCH=amd64 -t $CHAINCODE_IMAGE contracts/$CHAINCODE_NAME-typescript + ARCH=$(uname -m | sed 's/x86_64/amd64/g' | sed 's/aarch64/arm64/g') + docker build --build-arg TARGETARCH=${ARCH} -t $CHAINCODE_IMAGE contracts/$CHAINCODE_NAME-typescript # Push the image to the insecure container registry docker push $CHAINCODE_IMAGE