feat: api versions support (#72)

This commit is contained in:
Adam Uhlíř 2022-02-09 08:26:03 +01:00 committed by GitHub
parent d22a727d2d
commit 9ac5b11421
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33039 additions and 32839 deletions

View File

@ -65,6 +65,7 @@ jobs:
run: npm ci
- name: Build images
id: build
run: |
BUILD_PARAMS=""
if [ $BUILD_IMAGE == 'true' ] ; then
@ -88,4 +89,4 @@ jobs:
token: ${{ secrets.REPO_GHA_PAT }}
repository: ethersphere/bee-js
event-type: update-bee
client-payload: '{"imageVersion": "${{ steps.publish.outputs.bee-version }}"}'
client-payload: '{"imageVersion": "${{ steps.publish.outputs.bee-version }}", "apiVersion": "${{ steps.build.outputs.api-version }}", "debugApiVersion": "${{ steps.build.outputs.debug-api-version }}"}'

65841
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,10 +9,11 @@
"build:env": "./scripts/build-environment.sh",
"publish:env": "./scripts/publish-environment.sh",
"run:env": "./scripts/environment.sh",
"setApiVersions": "node ./src/setApiVersions.js",
"gen:traffic": "node ./scripts/gen-traffic.js"
},
"dependencies": {
"@ethersphere/bee-js": "1.2.1",
"@ethersphere/bee-js": "^3.2.0",
"@openzeppelin/contracts": "^3.1.0",
"truffle": "^5.3.5"
},

View File

@ -118,7 +118,14 @@ if $GEN_TRAFFIC ; then
echo "Generating traffic on Bee node $GEN_TRAFFIC_UPLOAD_NODE"
echo "Run traffic generation until $CHEQUES_COUNT incoming cheques will arrive to node under Debug API $GEN_TRAFFIC_CHECKER_NODE_DEBUG"
npm run gen:traffic -- "$CHEQUES_COUNT" "$GEN_TRAFFIC_CHECKER_NODE_DEBUG;$GEN_TRAFFIC_UPLOAD_NODE;$GEN_TRAFFIC_UPLOAD_NODE_DEBUG"
echo "traffic has been generated, stop nodes before commit..."
echo "traffic has been generated"
# This sets output parameter in Github Actions that
# is then used to trigger Bee-js PR creation
if [ "$CI" == 'true' ]; then
npm run setApiVersions "$GEN_TRAFFIC_CHECKER_NODE_DEBUG"
fi
"$MY_PATH/bee.sh" stop
docker container prune -f
fi

22
src/setApiVersions.js Normal file
View File

@ -0,0 +1,22 @@
const { BeeDebug } = require('@ethersphere/bee-js')
// This is a small utility that connects to given node and retrieve its API versions
// It outputs them to STDOUT in Github Actions format
async function setApiVersions (node) {
console.log('Getting API versions from node ', node)
const debug = new BeeDebug(node)
const versions = await debug.getHealth()
console.log('API version: ', versions.apiVersion)
console.log('Debug API version: ', versions.debugApiVersion)
console.log('::set-output name=api-version::', versions.apiVersion)
console.log('::set-output name=debug-api-version::', versions.debugApiVersion)
}
setApiVersions(process.argv[2]).catch(err => {
console.error('There was an error: ', err)
process.exit(1)
})