diff --git a/deploy-0chain/action.yml b/deploy-0chain/action.yml index 681d7e5d..5daec397 100644 --- a/deploy-0chain/action.yml +++ b/deploy-0chain/action.yml @@ -16,6 +16,10 @@ inputs: description: "blobber DOCKER IMAGE to deploy" default: "" required: false + is_enterprise_blobbers: + description: 'flag to enable enterprise blobbers' + default: 'false' + required: false validator_image: description: "validator DOCKER IMAGE to deploy" default: "" @@ -105,7 +109,7 @@ runs: steps: - name: "Get sprint branch from repo_snapshots_branch" if: ${{ inputs.repo_snapshots_branch != '' }} - uses: 0chain/actions/resolve-repo-snapshot@master + uses: 0chain/actions/resolve-repo-snapshot@feature/add-egosdk-tokenomics-action with: repo_snapshots_branch: ${{ inputs.repo_snapshots_branch }} svc_account_secret: ${{ inputs.svc_account_secret }} @@ -159,8 +163,14 @@ runs: ./check-params.sh "${{inputs.miner_image}}" "${{ env.SNAPSHOT_BRANCH_MINER_TAG }}" "MINER_TAG" ./check-params.sh "${{inputs.sharder_image}}" "${{ env.SNAPSHOT_BRANCH_SHARDER_TAG }}" "SHARDER_TAG" - ./check-params.sh "${{inputs.blobber_image}}" "${{ env.SNAPSHOT_BRANCH_BLOBBER_TAG }}" "BLOBBER_TAG" - ./check-params.sh "${{inputs.validator_image}}" "${{ env.SNAPSHOT_BRANCH_VALIDATOR_TAG }}" "VALIDATOR_TAG" + + if [[ ${{inputs.is_enterprise_blobbers}} == "true" ]]; then + ./check-params.sh "${{inputs.blobber_image}}" "${{ env.SNAPSHOT_BRANCH_EBLOBBER_TAG }}" "BLOBBER_TAG" + ./check-params.sh "${{inputs.validator_image}}" "${{ env.SNAPSHOT_BRANCH_EVALIDATOR_TAG }}" "VALIDATOR_TAG" + else + ./check-params.sh "${{inputs.blobber_image}}" "${{ env.SNAPSHOT_BRANCH_BLOBBER_TAG }}" "BLOBBER_TAG" + ./check-params.sh "${{inputs.validator_image}}" "${{ env.SNAPSHOT_BRANCH_VALIDATOR_TAG }}" "VALIDATOR_TAG" + fi ./check-params.sh "${{inputs.authorizer_image}}" "${{ env.SNAPSHOT_BRANCH_AUTHORIZER_TAG }}" "AUTHORIZER_TAG" ./check-params.sh "${{inputs.zbox_image}}" "${{ env.SNAPSHOT_BRANCH_ZBOX_TAG }}" "ZBOX_TAG" ./check-params.sh "${{inputs.zvault_image}}" "${{ env.SNAPSHOT_BRANCH_ZVAULT_TAG }}" "ZVAULT_TAG" @@ -181,6 +191,7 @@ runs: echo "GRAPHNODE_SC=$(echo ${{ inputs.graphnode_sc }})" >> $GITHUB_ENV echo "GRAPHNODE_NETWORK=$(echo ${{ inputs.graphnode_network }})" >> $GITHUB_ENV echo "GRAPHNODE_ETHEREUM_NODE_URL=$(echo ${{ inputs.graphnode_ethereum_node_url }})" >> $GITHUB_ENV + echo "IS_EBLOBBER=$(echo ${{ inputs.is_enterprise_blobbers }})" >> $GITHUB_ENV if [[ "${RUNNER_NAME:(-1)}" == "t" ]];then echo "RUNNER_NUMBER=st" >> $GITHUB_ENV @@ -410,6 +421,14 @@ runs: ./zwallet add-hardfork -n hermes -r 0 --wallet owner_wallet.json --config ./zbox_config.yaml --configDir . ##############----------------- Installing blobber helm-chart --------------------################### + if [[ "${{ env.IS_EBLOBBER }}" == "true" ]]; then + echo "BLOBBER_DOCKER_REPO=0chaindev/eblobber" >> $GITHUB_ENV + echo "VALIDATOR_DOCKER_REPO=0chaindev/evalidator" >> $GITHUB_ENV + else + echo "BLOBBER_DOCKER_REPO=0chaindev/blobber" >> $GITHUB_ENV + echo "VALIDATOR_DOCKER_REPO=0chaindev/validator" >> $GITHUB_ENV + fi + COUNT=3 #COUNT will be giving 3 try to install the helmchart. RET=1 #You can set RET=0 to skip the blobber helm-chart deployment while [[ $RET -ne 0 && $COUNT -gt 0 ]]; do @@ -425,12 +444,14 @@ runs: --set blobber.config.block_worker=https://${{ env.NAMESPACE }}.devnet-0chain.net/dns \ --set validator.config.block_worker=https://${{ env.NAMESPACE }}.devnet-0chain.net/dns \ --set blobber.config.delegate_wallet=591d6d0d5642bdbc924756ca2647b4b59adce0acd02a487ecc4d1bd4669293a8 \ - --set blobber.config.is_enterprise="false" \ + --set blobber.config.is_enterprise=${{ env.IS_EBLOBBER }} \ --set validator.config.delegate_wallet=591d6d0d5642bdbc924756ca2647b4b59adce0acd02a487ecc4d1bd4669293a8 \ --set blobber.hostName=${{ env.NAMESPACE }} \ --set blobber.host=devnet-0chain.net \ --set blobber.image.tag=${{ env.BLOBBER_TAG }} \ --set validator.image.tag=${{ env.VALIDATOR_TAG }} \ + --set blobber.image.repository=${{ env.BLOBBER_DOCKER_REPO }} \ + --set validator.image.repository=${{ env.VALIDATOR_DOCKER_REPO }} \ --set validator.hostName=${{ env.NAMESPACE }} \ --set validator.host=devnet-0chain.net -n ${{ env.NAMESPACE }} \ 0chain-helm/blobber --kubeconfig ./kube/${{ env.NAMESPACE }}-config @@ -791,8 +812,6 @@ runs: # echo "===========================================================" # echo "ADDING LATEST HARFORK" # echo "===========================================================" - - # echo '{"client_id":"1746b06bb09f55ee01b33b5e2e055d6cc7a900cb57c0a3a5eaabb8a0e7745802","client_key":"7b630ba670dac2f22d43c2399b70eff378689a53ee03ea20957bb7e73df016200fea410ba5102558b0c39617e5afd2c1843b161a1dedec15e1ab40543a78a518","keys":[{"public_key":"7b630ba670dac2f22d43c2399b70eff378689a53ee03ea20957bb7e73df016200fea410ba5102558b0c39617e5afd2c1843b161a1dedec15e1ab40543a78a518","private_key":"c06b6f6945ba02d5a3be86b8779deca63bb636ce7e46804a479c50e53c864915"}],"mnemonics":"cactus panther essence ability copper fox wise actual need cousin boat uncover ride diamond group jacket anchor current float rely tragic omit child payment","version":"1.0","date_created":"2021-08-04 18:53:56.949069945 +0100 BST m=+0.018986002"}' > owner_wallet.json # ./zwallet mn-update-config --keys cost.add_hardfork --values 100 --wallet owner_wallet.json --config ./zbox_config.yaml --configDir . # ./zwallet add-hardfork -n apollo -r 0 --wallet owner_wallet.json --config ./zbox_config.yaml --configDir . diff --git a/get-latest-image-for-branch/action.yaml b/get-latest-image-for-branch/action.yaml index ac9ece90..6fa836f2 100644 --- a/get-latest-image-for-branch/action.yaml +++ b/get-latest-image-for-branch/action.yaml @@ -17,6 +17,10 @@ inputs: description: 'blobber branch to deploy' default: '' required: false + eblobber_evalidator_branch: + description: 'eblobber branch to deploy' + default: '' + required: false authorizer_branch: description: 'authorizer branch to deploy' default: '' @@ -59,6 +63,12 @@ outputs: validator-tag: description: "validator docker image" value: ${{ steps.get-images.outputs.VALIDATOR_TAG }} + eblobber-tag: + description: "eblobber docker image" + value: ${{ steps.get-images.outputs.EBLOBBER_TAG }} + evalidator-tag: + description: "evalidator docker image" + value: ${{ steps.get-images.outputs.EVALUATOR_TAG }} authorizer-tag: description: "authorizer docker image" value: ${{ steps.get-images.outputs.AUTHORIZER_TAG }} @@ -218,6 +228,14 @@ runs: echo "blobber_validator_branch NOT specified, will skip deriving blobber and validator image tag" fi + if [[ -n "${{ inputs.eblobber_evalidator_branch }}" ]]; + then + ./get_tag.sh eblobber ${{ inputs.eblobber_evalidator_branch }} eblobber + ./get_tag.sh eblobber ${{ inputs.eblobber_evalidator_branch }} evalidator + else + echo "eblobber_evalidator_branch NOT specified, will skip deriving eblobber and evalidator image tag" + fi + if [[ -n "${{ inputs.authorizer_branch }}" ]]; then ./get_tag.sh token_bridge_authserver ${{ inputs.authorizer_branch }} authorizer diff --git a/resolve-repo-snapshot/action.yaml b/resolve-repo-snapshot/action.yaml index 234593cd..dcd211d3 100644 --- a/resolve-repo-snapshot/action.yaml +++ b/resolve-repo-snapshot/action.yaml @@ -82,10 +82,11 @@ runs: - name: "Get docker images for sprint branches" id: get-images if: ${{ inputs.resolve_images == 'true' }} - uses: 0chain/actions/get-latest-image-for-branch@master + uses: 0chain/actions/get-latest-image-for-branch@feature/add-egosdk-tokenomics-action with: miner_sharder_branch: ${{ env.SNAPSHOT_BRANCH_0CHAIN }} blobber_validator_branch: ${{ env.SNAPSHOT_BRANCH_BLOBBER }} + eblobber_evalidator_branch: ${{ env.SNAPSHOT_BRANCH_EBLOBBER}} authorizer_branch: ${{ env.SNAPSHOT_BRANCH_TOKEN_BRIDGE_AUTHSERVER }} zbox_branch: ${{ env.SNAPSHOT_BRANCH_0BOX }} zvault_branch: ${{ env.SNAPSHOT_BRANCH_ZVAULT }} @@ -114,6 +115,14 @@ runs: echo "SNAPSHOT_BRANCH_VALIDATOR_TAG=$(echo '${{ steps.get-images.outputs.validator-tag }}')" >> $GITHUB_ENV fi + if [[ -n "${{ steps.get-images.outputs.eblobber-tag }}" ]];then + echo "SNAPSHOT_BRANCH_BLOBBER_TAG=$(echo '${{ steps.get-images.outputs.eblobber-tag }}')" >> $GITHUB_ENV + fi + + if [[ -n "${{ steps.get-images.outputs.evalidator-tag }}" ]];then + echo "SNAPSHOT_BRANCH_VALIDATOR_TAG=$(echo '${{ steps.get-images.outputs.evalidator-tag }}')" >> $GITHUB_ENV + fi + if [[ -n "${{ steps.get-images.outputs.authorizer-tag }}" ]];then echo "SNAPSHOT_BRANCH_AUTHORIZER_TAG=$(echo '${{ steps.get-images.outputs.authorizer-tag }}')" >> $GITHUB_ENV fi diff --git a/run-system-tests-tokenomics/action.yml b/run-system-tests-tokenomics/action.yml index 8b8e17c2..0050172f 100644 --- a/run-system-tests-tokenomics/action.yml +++ b/run-system-tests-tokenomics/action.yml @@ -37,6 +37,10 @@ inputs: custom_go_sdk_version: required: true default: "NONE" + description: 'custom gosdk version. Will upgrade CLI branches with this before running tests' + use_egosdk: + required: false + default: "false" description: "custom gosdk version. Will upgrade CLI branches with this before running tests" tokenomics_test_filter: required: false @@ -91,8 +95,14 @@ runs: ./check-params.sh "${{inputs.zwallet_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_ZWALLETCLI }}" "ZWALLET_BRANCH" ./check-params.sh "${{inputs.system_tests_branch}}" "${{ env.SNAPSHOT_BRANCH_SYSTEM_TEST }}" "SYSTEM_TESTS_BRANCH" ./check-params.sh "${{inputs.s3_migration_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_S3-MIGRATION }}" "S3_MIGRATION_BRANCH" - ./check-params.sh "${{inputs.custom_go_sdk_version}}" "${{ env.SNAPSHOT_BRANCH_GOSDK }}" "GOSDK_VERSION" - + + if [[ "${{inputs.use_egosdk}}" == "true" ]]; then + ./check-params.sh "${{inputs.custom_go_sdk_version}}" "${{ env.SNAPSHOT_BRANCH_EGOSDK }}" "GOSDK_VERSION" + else + ./check-params.sh "${{inputs.custom_go_sdk_version}}" "${{ env.SNAPSHOT_BRANCH_GOSDK }}" "GOSDK_VERSION" + fi + + echo "USE_EGOSDK=$(echo ${{inputs.use_egosdk}})" >> $GITHUB_ENV echo "NETWORK_URL=$(echo ${{ inputs.network }})" >> $GITHUB_ENV echo "GOMODCACHE=/root/actions-runner${RUNNER_NAME:(-1)}/_work/_tool/go/pkg/mod" >> $GITHUB_ENV echo "GOCACHE=/root/actions-runner${RUNNER_NAME:(-1)}/_work/_tool/.cache/go-build" >> $GITHUB_ENV @@ -127,7 +137,13 @@ runs: echo "0wallet CLI branch: [${{ env.ZWALLET_BRANCH }}]" echo "s3 migration CLI branch: [${{ env.S3_MIGRATION_BRANCH }}]" echo "Ethereum node URL: [https://virtual.mainnet.rpc.tenderly.co/${{ inputs.TENDERLY_VIRTUAL_TESTNET_RPC_ID }}]" - echo "Custom gosdk version: [${{ env.GOSDK_VERSION }}]" + + if [[ "${{env.USE_EGOSDK}}" == "false" ]]; then + echo "Custom gosdk version: [${{ env.GOSDK_VERSION }}]" + else + echo "Custom egosdk version: [${{ env.GOSDK_VERSION }}]" + fi + echo "Test file filter: [${{ inputs.test_file_filter }}]" echo "Running Tokenomics tests: [${{ env.RUN_TOKENOMICS_SYSTEM_TESTS }}]" @@ -204,7 +220,12 @@ runs: echo "==============================================================" echo - GOSDK_HEAD=$(curl -s -H "Authorization: token ${{ inputs.svc_account_secret }}" https://api.github.com/repos/0chain/gosdk/git/refs/heads/${{ env.GOSDK_VERSION }} | jq -r '.object.sha') + if [[ "${{env.USE_EGOSDK}}" == "false" ]]; then + GOSDK_HEAD=$(curl -s -H "Authorization: token ${{ inputs.svc_account_secret }}" https://api.github.com/repos/0chain/gosdk/git/refs/heads/${{ env.GOSDK_VERSION }} | jq -r '.object.sha') + else + GOSDK_HEAD=$(curl -s -H "Authorization: token ${{ inputs.svc_account_secret }}" https://api.github.com/repos/0chain/egosdk/git/refs/heads/${{ env.GOSDK_VERSION }} | jq -r '.object.sha') + fi + if [[ "$GOSDK_HEAD" == "null" ]]; then echo "[${{ env.GOSDK_VERSION }}] does not seem to be a valid branch (possibly a commit hash?). Will pass directly to go to resolve" GOSDK_HEAD="${{ env.GOSDK_VERSION }}" @@ -212,7 +233,14 @@ runs: echo '#!/bin/bash echo "Upgrading [$2] to GOSDK [${{ env.GOSDK_VERSION }}($1)]" - go get github.com/0chain/gosdk@$1 || { echo "::error title=Failed to retrieve gosdk::failed to retrieve gosdk [${{ env.GOSDK_VERSION }}]" && exit 1; } + + if [[ "${{env.USE_EGOSDK}}" == "false" ]]; + then + go get github.com/0chain/gosdk@$1 || { echo "::error title=Failed to retrieve gosdk::failed to retrieve gosdk [${{ env.GOSDK_VERSION }}]" && exit 1; } + else + go get github.com/0chain/egosdk@$1 || { echo "::error title=Failed to retrieve egosdk::failed to retrieve egosdk [${{ env.GOSDK_VERSION }}]" && exit 1; } + fi + go mod tidy || { echo "::error title=Failed to upgrade $2 gosdk::failed to upgrade $2 gosdk to [${{ env.GOSDK_VERSION }}]" && exit 1; } ' > ./upgrade-gosdk.sh; chmod 555 ./upgrade-gosdk.sh @@ -285,8 +313,14 @@ runs: echo "======================================================" echo "SETTING WASM TESTS:" echo "======================================================" - git clone -q https://github.com/0chain/gosdk.git - cd gosdk + if [[ "${{env.USE_EGOSDK}}" == "false" ]]; + then + git clone -q https://github.com/0chain/gosdk.git + cd gosdk + else + git clone -q https://github.com/0chain/egosdk.git + cd egosdk + fi if [[ -n "${{ env.GOSDK_VERSION }}" && "${{ env.GOSDK_VERSION }}" != "NONE" ]]; then @@ -295,8 +329,8 @@ runs: cd .. - - name: Run frontend Tests - if: ${{ env.RUN_FRONTEND_TESTS == 'true' && env.RUN_SUBSET_OF_TESTS == 'false' }} + - name: Run frontend Tests with normal gosdk. + if: ${{ env.RUN_FRONTEND_TESTS == 'true' && inputs.use_egosdk == 'false' && env.RUN_SUBSET_OF_TESTS == 'false' }} uses: cypress-io/github-action@v5 with: working-directory: ./gosdk/wasmsdk/cypress @@ -304,6 +338,15 @@ runs: install-command: yarn start:system-tests start: yarn start + - name: Run frontend Tests with egosdk. + if: ${{ env.RUN_FRONTEND_TESTS == 'true' && inputs.use_egosdk == 'true' && env.RUN_SUBSET_OF_TESTS == 'false' }} + uses: cypress-io/github-action@v5 + with: + working-directory: ./egosdk/wasmsdk/cypress + record: false + install-command: yarn start:system-tests + start: yarn start + - name: "Run Tokenomics System Tests" shell: 'script --return --quiet --command "bash {0}"' if: ${{ env.RUN_TOKENOMICS_SYSTEM_TESTS == 'true' && env.RUN_TOKENOMICS_SUBSET_OF_TESTS == 'false' && 'true' == 'false' }}