Skip to content

Commit

Permalink
Merge pull request #373 from dzikowski/kubernetes-set-versions
Browse files Browse the repository at this point in the history
Kubernetes: Set CA, orderer and peer versions from Fablo config
  • Loading branch information
dzikowski authored Jul 11, 2023
2 parents 534e0fb + 1ec64e2 commit a8ece15
Show file tree
Hide file tree
Showing 37 changed files with 8,347 additions and 5,350 deletions.
26 changes: 4 additions & 22 deletions .github/workflows/test-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:

- name: Check out repository code
uses: actions/checkout@v2

Expand Down Expand Up @@ -77,6 +77,9 @@ jobs:
if [ -f "~/.zshrc" ]; then
echo 'export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc
fi
helm repo add kfs "https://kfsoftware.github.io/hlf-helm-charts" --force-update
helm install hlf-operator --version=1.8.0 kfs/hlf-operator
- name: Build Fablo
run: |
Expand Down Expand Up @@ -165,24 +168,3 @@ jobs:
path: |
e2e-network/docker/test-04-snapshot.sh.logs/*
e2e-network/docker/test-04-snapshot.sh.tmpdir/fablo-target/**/*
node-chaincodes-unit-tests:
needs: test-main
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Test chaincode for Fabric 1.4.x
run: |
cd samples/chaincodes/chaincode-kv-node-1.4 && \
npm install && \
npm run build && \
npm run test
- name: Test chaincode for Fabric 2.x
run: |
cd samples/chaincodes/chaincode-kv-node && \
npm install && \
npm run build && \
npm run test
6 changes: 6 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# SC1090: Can't follow non-constant source. Use a directive to specify location.
disable=SC1090

# SC1091: Not following
disable=SC1091

# SC2034: Unused
disable=SC2034

# SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
disable=SC2164

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ The other available parameters for entries in `orgs` array are:
### property `peer.db`:
- may be `LevelDb` (default) or `CouchDb`.
###property `orderers`:
### property `orderers`:
- is optional as some organizations may have orderer defined, but some don't.
- At least one orderer group is required to run Fabric network (requirement is validated before run).
- If you want to spread orderers in group between many organizations use same `groupName` in every group definition.
Expand Down
7 changes: 6 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ formatGeneratedFiles() {
yeoman_target_dir="/network/workspace"
yeoman_command=${1:-Fablo:setup-network}

executeYeomanCommand "$yeoman_command"
# This part of output will be replaces with empty line. It breaks parsing of yeoman generator output.
# See also: https://github.com/yeoman/generator/issues/1294
annoying_yeoman_info="No change to package.json was detected. No package manager install will be executed."

# Execute the command
executeYeomanCommand "$yeoman_command" 2>&1 | sed "s/$annoying_yeoman_info//g"

if echo "$yeoman_command" | grep "setup-network"; then
formatGeneratedFiles
Expand Down
5 changes: 2 additions & 3 deletions e2e-network/k8s/test-01-simple-k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT
# start the network
networkUp

peer0=$(kubectl get pods | grep peer0 | tr -s ' ' | cut -d ':' -f 1 | cut -d ' ' -f 1 | head -n 1)
peer1=$(kubectl get pods | grep peer1 | tr -s ' ' | cut -d ':' -f 1 | cut -d ' ' -f 1 | head -n 1)
peer0="$(kubectl get pods | grep peer0 | tr -s ' ' | cut -d ':' -f 1 | cut -d ' ' -f 1 | head -n 1) peer"
peer1="$(kubectl get pods | grep peer1 | tr -s ' ' | cut -d ':' -f 1 | cut -d ' ' -f 1 | head -n 1) peer"
ca=$(kubectl get pods | grep org1-ca | tr -s ' ' | cut -d ':' -f 1 | cut -d ' ' -f 1)
orderer=$(kubectl get pods | grep orderer-node | tr -s ' ' | cut -d ':' -f 1 | cut -d ' ' -f 1)

Expand Down Expand Up @@ -73,6 +73,5 @@ expectInvoke "admin" "peer1.default" "my-channel1" "chaincode1" \
"get" "[\"name\"]" "" '{"error":"NOT_FOUND"}'

# Put some data again

expectInvoke "admin" "peer1.default" "my-channel1" "chaincode1" \
"put" "[\"name\"]" "James Bond" "{\"success\":\"OK\"}"
4 changes: 3 additions & 1 deletion e2e-network/k8s/wait-for-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ fi
for i in $(seq 1 "$max_attempts"); do
echo "➜ verifying if container $container logs contain ($i)... ${darkGray}'$expected_message'${end}"

if kubectl logs "$container" 2>&1 | grep -q "$expected_message"; then
# in some cases you need to pass two arguments at once
# shellcheck disable=SC2086
if kubectl logs $container 2>&1 | grep -q "$expected_message"; then
echo "✅ ok: Container $container is ready!"
exit 0
else
Expand Down
Loading

0 comments on commit a8ece15

Please sign in to comment.