Skip to content

Commit

Permalink
support for testing against multiple fabric version
Browse files Browse the repository at this point in the history
Signed-off-by: adityajoshi12 <[email protected]>
  • Loading branch information
adityajoshi12 committed Jan 18, 2025
1 parent 512d695 commit 87f7afe
Showing 1 changed file with 35 additions and 15 deletions.
50 changes: 35 additions & 15 deletions .github/workflows/test-kubectl-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
matrix:
go-version: [ 1.23.x ]
os: [ ubuntu-latest ]
fabric-version: [ { version: 2.5, peer: 2.5.10, orderer: 2.5.10, ca: 1.5.13 }, { version: 3.0, peer: 3.0.0, orderer: 3.0.0, ca: 1.5.13 } ]
runs-on: ${{ matrix.os }}
env:
IMAGE: hlf-operator
Expand Down Expand Up @@ -56,8 +57,8 @@ jobs:
kubectl create namespace istio-system
istioctl operator init
kubectl apply -f - <<EOF
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
Expand Down Expand Up @@ -168,14 +169,14 @@ jobs:
- name: Create Peer org
run: |
export PEER_IMAGE=hyperledger/fabric-peer
export PEER_VERSION=2.5.10
export PEER_VERSION=${{ matrix.fabric-version.peer }}
export CA_IMAGE=hyperledger/fabric-ca
export CA_VERSION=1.5.13
export CA_VERSION=${{ matrix.fabric-version.ca }}
kubectl hlf ca create --image=$CA_IMAGE --version=$CA_VERSION --storage-class=standard --capacity=2Gi --name=org1-ca \
--enroll-id=enroll --hosts=org1-ca.localho.st --enroll-pw=enrollpw
kubectl wait --timeout=240s --for=condition=Running fabriccas.hlf.kungfusoftware.es --all
kubectl wait --timeout=240s --for=condition=Running fabriccas.hlf.kungfusoftware.es --all
# register user for the peers
kubectl hlf ca register --name=org1-ca --user=peer --secret=peerpw --type=peer \
Expand All @@ -189,10 +190,10 @@ jobs:
- name: Create Orderer Org
run: |
export ORDERER_IMAGE=hyperledger/fabric-orderer
export ORDERER_VERSION=2.5.10
export ORDERER_VERSION=${{ matrix.fabric-version.orderer }}
export CA_IMAGE=hyperledger/fabric-ca
export CA_VERSION=1.5.13
export CA_VERSION=${{ matrix.fabric-version.ca }}
kubectl hlf ca create --image=$CA_IMAGE --version=$CA_VERSION --storage-class=standard --capacity=2Gi --name=ord-ca \
--enroll-id=enroll --enroll-pw=enrollpw --hosts=ord-ca.localho.st
Expand All @@ -212,7 +213,7 @@ jobs:
--type=admin --enroll-id enroll --enroll-secret=enrollpw --mspid=OrdererMSP
kubectl hlf ca enroll --name=ord-ca --user=admin --secret=adminpw --mspid OrdererMSP \
--ca-name ca --output admin-ordservice.yaml
--ca-name ca --output admin-ordservice.yaml
## add user from admin-ordservice.yaml to ordservice.yaml
kubectl hlf utils adduser --userPath=admin-ordservice.yaml --config=ordservice.yaml --username=admin --mspid=OrdererMSP
Expand All @@ -221,14 +222,14 @@ jobs:
# enroll using the TLS CA
kubectl hlf ca enroll --name=ord-ca --namespace=default --user=admin --secret=adminpw --mspid OrdererMSP \
--ca-name tlsca --output admin-tls-ordservice.yaml
--ca-name tlsca --output admin-tls-ordservice.yaml
kubectl hlf ca enroll --name=ord-ca --namespace=default --user=admin --secret=adminpw --mspid OrdererMSP \
--ca-name ca --output admin-sign-ordservice.yaml
--ca-name ca --output admin-sign-ordservice.yaml
- name: Prepare connection string for Peer
run: |
kubectl hlf ca register --name=org1-ca --user=admin --secret=adminpw --type=admin \
--enroll-id enroll --enroll-secret=enrollpw --mspid Org1MSP
--enroll-id enroll --enroll-secret=enrollpw --mspid Org1MSP
kubectl hlf ca enroll --name=org1-ca --user=admin --secret=adminpw --mspid Org1MSP \
--ca-name ca --output peer-org1.yaml
Expand All @@ -237,7 +238,8 @@ jobs:
## add user key and cert to org1.yaml from admin-ordservice.yaml
kubectl hlf utils adduser --userPath=peer-org1.yaml --config=org1.yaml --username=admin --mspid=Org1MSP
- name: Create a channel
- name: Create a channel(${{ matrix.fabric-version.version }})
if: ${{ matrix.fabric-version.version == '2.5' }}
run: |
kubectl create secret generic wallet --namespace=default \
Expand Down Expand Up @@ -328,10 +330,11 @@ jobs:
EOF
kubectl wait --timeout=240s --for=condition=RUNNING fabricmainchannels.hlf.kungfusoftware.es --all
kubectl wait --timeout=240s --for=condition=RUNNING fabricmainchannels.hlf.kungfusoftware.es --all
- name: Join peers to channel
if: ${{ matrix.fabric-version.version == '2.5' }}
run: |
kubectl get fabricorderernodes ord-node1 -o jsonpath='{.status.tlsCert}' > ./orderer-cert.pem
kubectl hlf channelcrd follower create \
Expand All @@ -347,6 +350,23 @@ jobs:
--secret-key="peer-org1.yaml"
kubectl wait --timeout=240s --for=condition=RUNNING fabricfollowerchannels.hlf.kungfusoftware.es --all
- name: create a channel(${{ matrix.fabric-version.version }})
if: ${{ matrix.fabric-version.version == '3.0' }}
run: |
kubectl hlf channel generate \
--output=testchannel.block --name=testchannel \
--organizations Org1MSP --ordererOrganizations OrdererMSP \
--consensus BFT
- name: Join orderers to channel(${{ matrix.fabric-version.version }})
if: ${{ matrix.fabric-version.version == '3.0' }}
run: |
kubectl hlf ordnode join --namespace=default --block=testchannel.block \
--name=ord-node1 --identity=admin-tls-ordservice.yaml
- name: Join peers to channel(${{ matrix.fabric-version.version }})
if: ${{ matrix.fabric-version.version == '3.0' }}
run: |
kubectl hlf channel join --name=testchannel \
--config=org1.yaml --user=admin -p=org1-peer0.default
- name: Get channel
run: |
sleep 3
Expand Down Expand Up @@ -404,7 +424,7 @@ jobs:
run: |
sleep 10
echo "waiting for deployment to be ready"
kubectl wait --timeout=240s --for=condition=Available deployment asset --namespace=default
kubectl wait --timeout=240s --for=condition=Available deployment asset --namespace=default
kubectl hlf chaincode invoke --config=org1.yaml \
--user=admin --peer=org1-peer0.default \
--chaincode=asset --channel=demo \
Expand All @@ -429,7 +449,7 @@ jobs:
kubectl get fabricfollowerchannels.hlf.kungfusoftware.es -A -o=custom-columns='NAME:metadata.name,NAMESPACE:metadata.namespace,STATE:status.status,MESSAGE:status.message'
kubectl get configmap coredns -n kube-system -o yaml
echo "Logs for hlf-operator deployment:"
kubectl logs -l app.kubernetes.io/name=hlf-operator -c manager --tail 2500
kubectl logs -l app.kubernetes.io/name=hlf-operator -c manager --tail 2500
kubectl get fabricmainchannels -o yaml
kubectl get fabricfollowerchannels -o yaml
Expand Down

0 comments on commit 87f7afe

Please sign in to comment.