Skip to content

Commit

Permalink
fix(logging): improved error logging for zcn query (#762)
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlangzi authored Jul 27, 2022
1 parent 710e9f0 commit ce26910
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 24 deletions.
31 changes: 9 additions & 22 deletions .github/workflows/build-&-publish-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:
env:
BLOBBER_REGISTRY: ${{ secrets.BLOBBER_REGISTRY }}
VALIDATOR_REGISTRY: ${{ secrets.VALIDATOR_REGISTRY }}
DOCKER_CLI_EXPERIMENTAL: enabled

jobs:
blobber:
Expand Down Expand Up @@ -53,21 +54,14 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build base
run: |
export DOCKER_IMAGE_BASE="${BLOBBER_REGISTRY}:base"
export DOCKER_BUILD="buildx build --platform linux/amd64,linux/arm64 --push"
./docker.local/bin/build.base.sh
- name: Build blobber
run: |
SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8)
export DOCKER_IMAGE_BASE="${BLOBBER_REGISTRY}:base"
export DOCKER_IMAGE_BLOBBER="-t ${BLOBBER_REGISTRY}:${TAG} -t ${BLOBBER_REGISTRY}:${TAG}-${SHORT_SHA}"
export DOCKER_BUILD="buildx build --platform linux/amd64,linux/arm64 --push"
./docker.local/bin/build.blobber.sh
export DOCKER_IMAGE_BLOBBER="-t ${BLOBBER_REGISTRY}:${TAG} -t ${BLOBBER_REGISTRY}:${TAG}-${SHORT_SHA}"
SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8)
./docker.local/bin/build.base.sh && ./docker.local/bin/build.blobber.sh
validator:
runs-on: [self-hosted, build]
Expand Down Expand Up @@ -104,21 +98,14 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build base
run: |
export DOCKER_IMAGE_BASE="${VALIDATOR_REGISTRY}:base"
export DOCKER_BUILD="buildx build --platform linux/amd64,linux/arm64 --push"
./docker.local/bin/build.base.sh
- name: Build validator
run: |
SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8)
export DOCKER_IMAGE_BASE="${VALIDATOR_REGISTRY}:base"
export DOCKER_IMAGE_VALIDATOR="-t ${VALIDATOR_REGISTRY}:${TAG} -t ${VALIDATOR_REGISTRY}:${TAG}-${SHORT_SHA}"
export DOCKER_BUILD="buildx build --platform linux/amd64,linux/arm64 --push"
./docker.local/bin/build.validator.sh
export DOCKER_IMAGE_VALIDATOR="-t ${VALIDATOR_REGISTRY}:${TAG} -t ${VALIDATOR_REGISTRY}:${TAG}-${SHORT_SHA}"
SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8)
./docker.local/bin/build.base.sh && ./docker.local/bin/build.validator.sh
system-tests:
Expand Down
2 changes: 1 addition & 1 deletion code/go/0chain.net/blobbercore/challenge/challenge.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func syncOpenChallenges(ctx context.Context) {
d := json.NewDecoder(bytesReader)
d.UseNumber()
if err := d.Decode(&blobberChallenges); err != nil {
logging.Logger.Error("[challenge]json: ", zap.Error(err))
logging.Logger.Error("[challenge]json: ", zap.String("resp", string(retBytes)), zap.Error(err))
return
}

Expand Down
3 changes: 2 additions & 1 deletion code/go/0chain.net/blobbercore/zcn/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package zcn
import (
"encoding/json"
"errors"
"fmt"
"sync"

"github.com/0chain/gosdk/zcncore"
Expand Down Expand Up @@ -46,7 +47,7 @@ func (cb *getBlobberCallback) OnInfoAvailable(op int, status int, info string, e
}
b := &zcncore.Blobber{}
if err := json.Unmarshal([]byte(info), b); err != nil {
cb.Error = err
cb.Error = fmt.Errorf("getBlobber:json %s %w", info, err)
return
}

Expand Down

0 comments on commit ce26910

Please sign in to comment.