Skip to content

Commit 2ed5978

Browse files
committed
support for testing against multiple fabric version
Signed-off-by: adityajoshi12 <[email protected]>
1 parent 512d695 commit 2ed5978

File tree

1 file changed

+35
-15
lines changed

1 file changed

+35
-15
lines changed

.github/workflows/test-kubectl-plugin.yml

+35-15
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
matrix:
1111
go-version: [ 1.23.x ]
1212
os: [ ubuntu-latest ]
13+
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 } ]
1314
runs-on: ${{ matrix.os }}
1415
env:
1516
IMAGE: hlf-operator
@@ -56,8 +57,8 @@ jobs:
5657
kubectl create namespace istio-system
5758
5859
istioctl operator init
59-
60-
60+
61+
6162
kubectl apply -f - <<EOF
6263
apiVersion: install.istio.io/v1alpha1
6364
kind: IstioOperator
@@ -168,14 +169,14 @@ jobs:
168169
- name: Create Peer org
169170
run: |
170171
export PEER_IMAGE=hyperledger/fabric-peer
171-
export PEER_VERSION=2.5.10
172+
export PEER_VERSION=${{ matrix.fabric-version.peer }}
172173
173174
export CA_IMAGE=hyperledger/fabric-ca
174-
export CA_VERSION=1.5.13
175+
export CA_VERSION=${{ matrix.fabric-version.ca }}
175176
176177
kubectl hlf ca create --image=$CA_IMAGE --version=$CA_VERSION --storage-class=standard --capacity=2Gi --name=org1-ca \
177178
--enroll-id=enroll --hosts=org1-ca.localho.st --enroll-pw=enrollpw
178-
kubectl wait --timeout=240s --for=condition=Running fabriccas.hlf.kungfusoftware.es --all
179+
kubectl wait --timeout=240s --for=condition=Running fabriccas.hlf.kungfusoftware.es --all
179180
180181
# register user for the peers
181182
kubectl hlf ca register --name=org1-ca --user=peer --secret=peerpw --type=peer \
@@ -189,10 +190,10 @@ jobs:
189190
- name: Create Orderer Org
190191
run: |
191192
export ORDERER_IMAGE=hyperledger/fabric-orderer
192-
export ORDERER_VERSION=2.5.10
193+
export ORDERER_VERSION=${{ matrix.fabric-version.orderer }}
193194
194195
export CA_IMAGE=hyperledger/fabric-ca
195-
export CA_VERSION=1.5.13
196+
export CA_VERSION=${{ matrix.fabric-version.ca }}
196197
197198
kubectl hlf ca create --image=$CA_IMAGE --version=$CA_VERSION --storage-class=standard --capacity=2Gi --name=ord-ca \
198199
--enroll-id=enroll --enroll-pw=enrollpw --hosts=ord-ca.localho.st
@@ -212,7 +213,7 @@ jobs:
212213
--type=admin --enroll-id enroll --enroll-secret=enrollpw --mspid=OrdererMSP
213214
214215
kubectl hlf ca enroll --name=ord-ca --user=admin --secret=adminpw --mspid OrdererMSP \
215-
--ca-name ca --output admin-ordservice.yaml
216+
--ca-name ca --output admin-ordservice.yaml
216217
## add user from admin-ordservice.yaml to ordservice.yaml
217218
kubectl hlf utils adduser --userPath=admin-ordservice.yaml --config=ordservice.yaml --username=admin --mspid=OrdererMSP
218219
@@ -221,14 +222,14 @@ jobs:
221222
222223
# enroll using the TLS CA
223224
kubectl hlf ca enroll --name=ord-ca --namespace=default --user=admin --secret=adminpw --mspid OrdererMSP \
224-
--ca-name tlsca --output admin-tls-ordservice.yaml
225+
--ca-name tlsca --output admin-tls-ordservice.yaml
225226
kubectl hlf ca enroll --name=ord-ca --namespace=default --user=admin --secret=adminpw --mspid OrdererMSP \
226-
--ca-name ca --output admin-sign-ordservice.yaml
227+
--ca-name ca --output admin-sign-ordservice.yaml
227228
228229
- name: Prepare connection string for Peer
229230
run: |
230231
kubectl hlf ca register --name=org1-ca --user=admin --secret=adminpw --type=admin \
231-
--enroll-id enroll --enroll-secret=enrollpw --mspid Org1MSP
232+
--enroll-id enroll --enroll-secret=enrollpw --mspid Org1MSP
232233
233234
kubectl hlf ca enroll --name=org1-ca --user=admin --secret=adminpw --mspid Org1MSP \
234235
--ca-name ca --output peer-org1.yaml
@@ -237,7 +238,8 @@ jobs:
237238
238239
## add user key and cert to org1.yaml from admin-ordservice.yaml
239240
kubectl hlf utils adduser --userPath=peer-org1.yaml --config=org1.yaml --username=admin --mspid=Org1MSP
240-
- name: Create a channel
241+
- name: Create a channel(${{ matrix.fabric-version.version }})
242+
if: ${{ matrix.fabric-version.version == '2.5' }}
241243
run: |
242244
243245
kubectl create secret generic wallet --namespace=default \
@@ -328,10 +330,11 @@ jobs:
328330
329331
EOF
330332
331-
kubectl wait --timeout=240s --for=condition=RUNNING fabricmainchannels.hlf.kungfusoftware.es --all
333+
kubectl wait --timeout=240s --for=condition=RUNNING fabricmainchannels.hlf.kungfusoftware.es --all
332334
333335
334336
- name: Join peers to channel
337+
if: ${{ matrix.fabric-version.version == '2.5' }}
335338
run: |
336339
kubectl get fabricorderernodes ord-node1 -o jsonpath='{.status.tlsCert}' > ./orderer-cert.pem
337340
kubectl hlf channelcrd follower create \
@@ -347,6 +350,23 @@ jobs:
347350
--secret-key="peer-org1.yaml"
348351
349352
kubectl wait --timeout=240s --for=condition=RUNNING fabricfollowerchannels.hlf.kungfusoftware.es --all
353+
- name: create a channel(${{ matrix.fabric-version.version }})
354+
if: ${{ matrix.fabric-version.version == '3.0' }}
355+
run: |
356+
kubectl hlf channel generate \
357+
--output=testchannel.block --name=testchannel \
358+
--organizations Org1MSP --ordererOrganizations OrdererMSP \
359+
--consensus BFT
360+
- name: Join orderers to channel(${{ matrix.fabric-version.version }})
361+
if: ${{ matrix.fabric-version.version == '3.0' }}
362+
run: |
363+
kubectl hlf ordnode join --block=testchannel.block \
364+
--name=ord-node1 --identity=admin-tls-ordservice.yaml
365+
- name: Join peers to channel(${{ matrix.fabric-version.version }})
366+
if: ${{ matrix.fabric-version.version == '3.0' }}
367+
run: |
368+
kubectl hlf channel join --name=testchannel \
369+
--config=org1.yaml --user=admin -p=org1-peer0.default
350370
- name: Get channel
351371
run: |
352372
sleep 3
@@ -404,7 +424,7 @@ jobs:
404424
run: |
405425
sleep 10
406426
echo "waiting for deployment to be ready"
407-
kubectl wait --timeout=240s --for=condition=Available deployment asset --namespace=default
427+
kubectl wait --timeout=240s --for=condition=Available deployment asset --namespace=default
408428
kubectl hlf chaincode invoke --config=org1.yaml \
409429
--user=admin --peer=org1-peer0.default \
410430
--chaincode=asset --channel=demo \
@@ -429,7 +449,7 @@ jobs:
429449
kubectl get fabricfollowerchannels.hlf.kungfusoftware.es -A -o=custom-columns='NAME:metadata.name,NAMESPACE:metadata.namespace,STATE:status.status,MESSAGE:status.message'
430450
kubectl get configmap coredns -n kube-system -o yaml
431451
echo "Logs for hlf-operator deployment:"
432-
kubectl logs -l app.kubernetes.io/name=hlf-operator -c manager --tail 2500
452+
kubectl logs -l app.kubernetes.io/name=hlf-operator -c manager --tail 2500
433453
kubectl get fabricmainchannels -o yaml
434454
kubectl get fabricfollowerchannels -o yaml
435455

0 commit comments

Comments
 (0)