Run FSAT tests with 2.5 images, binaries, and trigger on all builds for regression coverage (#919)

Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
This commit is contained in:
jkneubuh 2023-01-27 09:49:52 -05:00 committed by GitHub
parent 5bc925a3d8
commit c986c8d227
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 24 additions and 316 deletions

View file

@ -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

View file

@ -7,8 +7,6 @@ on:
branches:
- "main"
- "release-2.5"
paths:
- "full-stack-asset-transfer-guide/**"
jobs:
ansible:

View file

@ -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.+'

View file

@ -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",

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -76,8 +76,10 @@ export class AssetTransfer {
}
async transferAsset(id: string, newOwner: string, newOwnerOrg: string): Promise<void> {
// 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.'));
}
}

View file

@ -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"
},

View file

@ -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

View file

@ -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