From eddea3e3dc2a3f5a72292a1e268cd4d054bf96ca Mon Sep 17 00:00:00 2001 From: otherview Date: Wed, 20 Sep 2023 12:35:52 +0100 Subject: [PATCH] testing --- .github/workflows/dev-testnet.env | 1 - .github/workflows/envs/dev-testnet.env | 10 +++ .github/workflows/envs/sepolia-testnet.env | 10 +++ .github/workflows/envs/testnet.env | 11 +++ .../workflows/manual-deploy-testnet-l2.yml | 68 +++++++++---------- 5 files changed, 62 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/dev-testnet.env create mode 100644 .github/workflows/envs/dev-testnet.env create mode 100644 .github/workflows/envs/sepolia-testnet.env create mode 100644 .github/workflows/envs/testnet.env diff --git a/.github/workflows/dev-testnet.env b/.github/workflows/dev-testnet.env deleted file mode 100644 index 05fbcc2ee8..0000000000 --- a/.github/workflows/dev-testnet.env +++ /dev/null @@ -1 +0,0 @@ -RESOURCE_TESTNET_NAME=dev-testnet \ No newline at end of file diff --git a/.github/workflows/envs/dev-testnet.env b/.github/workflows/envs/dev-testnet.env new file mode 100644 index 0000000000..08a480e32d --- /dev/null +++ b/.github/workflows/envs/dev-testnet.env @@ -0,0 +1,10 @@ +L2_ENCLAVE_DOCKER_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/enclave:latest +L2_HOST_DOCKER_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/host:latest +L2_HARDHATDEPLOYER_DOCKER_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/hardhatdeployer:latest +RESOURCE_TAG_NAME=testnetlatest +RESOURCE_STARTING_NAME=T +RESOURCE_TESTNET_NAME=testnet +L1_WS_URL=ws://testnet-eth2network.uksouth.cloudapp.azure.com:9000 +L1_HTTP_URL=http://testnet-eth2network.uksouth.cloudapp.azure.com:8025 +BATCH_INTERVAL=1s +ROLLUP_INTERVAL=10s diff --git a/.github/workflows/envs/sepolia-testnet.env b/.github/workflows/envs/sepolia-testnet.env new file mode 100644 index 0000000000..4fa0b22350 --- /dev/null +++ b/.github/workflows/envs/sepolia-testnet.env @@ -0,0 +1,10 @@ +L2_ENCLAVE_DOCKER_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/sepolia_enclave:latest +L2_HOST_DOCKER_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/sepolia_host:latest +L2_HARDHATDEPLOYER_DOCKER_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/sepolia_hardhatdeployer:latest +RESOURCE_TAG_NAME=sepoliatestnetlatest +RESOURCE_STARTING_NAME=S +RESOURCE_TESTNET_NAME=sepoliatestnet +BATCH_INTERVAL=1s +ROLLUP_INTERVAL=3m +NODE_WALLET_ADDR_0=0x2fe9B92E12a8d94bfb2f19c19024B9554890C0CC +NODE_WALLET_ADDR_1=0xBD0D613bCbDbcC93abE025117564cc4435896A5F diff --git a/.github/workflows/envs/testnet.env b/.github/workflows/envs/testnet.env new file mode 100644 index 0000000000..b33e7ceed8 --- /dev/null +++ b/.github/workflows/envs/testnet.env @@ -0,0 +1,11 @@ +L2_ENCLAVE_DOCKER_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/enclave:latest +L2_HOST_DOCKER_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/host:latest +L2_HARDHATDEPLOYER_DOCKER_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/hardhatdeployer:latest +RESOURCE_TAG_NAME=testnetlatest +RESOURCE_STARTING_NAME=T +RESOURCE_TESTNET_NAME=testnet +L1_WS_URL=ws://testnet-eth2network.uksouth.cloudapp.azure.com:9000 +L1_HTTP_URL=http://testnet-eth2network.uksouth.cloudapp.azure.com:8025 +BATCH_INTERVAL=1s +ROLLUP_INTERVAL=10s +NODE_WALLET_ADDR_0= \ No newline at end of file diff --git a/.github/workflows/manual-deploy-testnet-l2.yml b/.github/workflows/manual-deploy-testnet-l2.yml index 6f39a3efbe..5f9a6cd738 100644 --- a/.github/workflows/manual-deploy-testnet-l2.yml +++ b/.github/workflows/manual-deploy-testnet-l2.yml @@ -44,17 +44,11 @@ jobs: id: dotenv uses: falti/dotenv-action@v1.0.4 with: - path: .github/workflows/${{ github.event.inputs.testnet_type }}.env + path: .github/workflows/envs/${{ github.event.inputs.testnet_type }}.env log-variables: true export-variables: true keys-case: bypass - - name: 'Test_ENV_1' - id: Test_ENV_1 - shell: bash - run: | - echo "Loaded environment variables -> ${{ steps.dotenv.outputs.RESOURCE_TESTNET_NAME }}" - - uses: actions/setup-go@v4 with: go-version: 1.20.4 @@ -73,12 +67,12 @@ jobs: - name: 'Build and push obscuro node images' run: | - DOCKER_BUILDKIT=1 docker build -t ${{vars.L2_ENCLAVE_DOCKER_BUILD_TAG}} -f dockerfiles/enclave.Dockerfile . - docker push ${{vars.L2_ENCLAVE_DOCKER_BUILD_TAG}} - DOCKER_BUILDKIT=1 docker build -t ${{vars.L2_HOST_DOCKER_BUILD_TAG}} -f dockerfiles/host.Dockerfile . - docker push ${{vars.L2_HOST_DOCKER_BUILD_TAG}} - DOCKER_BUILDKIT=1 docker build -t ${{vars.L2_HARDHATDEPLOYER_DOCKER_BUILD_TAG}} -f tools/hardhatdeployer/Dockerfile . - docker push ${{vars.L2_HARDHATDEPLOYER_DOCKER_BUILD_TAG}} + DOCKER_BUILDKIT=1 docker build -t ${{steps.dotenv.outputs.L2_ENCLAVE_DOCKER_BUILD_TAG}} -f dockerfiles/enclave.Dockerfile . + docker push ${{steps.dotenv.outputs.L2_ENCLAVE_DOCKER_BUILD_TAG}} + DOCKER_BUILDKIT=1 docker build -t ${{steps.dotenv.outputs.L2_HOST_DOCKER_BUILD_TAG}} -f dockerfiles/host.Dockerfile . + docker push ${{steps.dotenv.outputs.L2_HOST_DOCKER_BUILD_TAG}} + DOCKER_BUILDKIT=1 docker build -t ${{steps.dotenv.outputs.L2_HARDHATDEPLOYER_DOCKER_BUILD_TAG}} -f tools/hardhatdeployer/Dockerfile . + docker push ${{steps.dotenv.outputs.L2_HARDHATDEPLOYER_DOCKER_BUILD_TAG}} - name: 'Deploy Contracts' id: deployContracts @@ -87,7 +81,7 @@ jobs: go run ./testnet/launcher/l1contractdeployer/cmd \ -l1_http_url=${{ secrets.L1_HTTP_URL }} \ -private_key=${{ secrets.WORKER_PK }} \ - -docker_image=${{vars.L2_HARDHATDEPLOYER_DOCKER_BUILD_TAG}} \ + -docker_image=${{steps.dotenv.outputs.L2_HARDHATDEPLOYER_DOCKER_BUILD_TAG}} \ -contracts_env_file=./testnet/.env source ./testnet/.env echo "Contracts deployed to $MGMTCONTRACTADDR" @@ -110,14 +104,14 @@ jobs: uses: azure/CLI@v1 with: inlineScript: | - $(az resource list --tag ${{vars.RESOURCE_TAG_NAME}}=true --query '[]."id"' -o tsv | xargs -n1 az resource delete --verbose -g Testnet --ids) || true + $(az resource list --tag ${{steps.dotenv.outputs.RESOURCE_TAG_NAME}}=true --query '[]."id"' -o tsv | xargs -n1 az resource delete --verbose -g Testnet --ids) || true # This will clean up any lingering dependencies - might fail if there are no resources to cleanup - name: 'Delete VMs dependencies' uses: azure/CLI@v1 with: inlineScript: | - $(az resource list --tag ${{vars.RESOURCE_TAG_NAME}}=true --query '[]."id"' -o tsv | xargs -n1 az resource delete --verbose -g Testnet --ids) || true + $(az resource list --tag ${{steps.dotenv.outputs.RESOURCE_TAG_NAME}}=true --query '[]."id"' -o tsv | xargs -n1 az resource delete --verbose -g Testnet --ids) || true - name: 'Upload container logs on failure' uses: actions/upload-artifact@v3 @@ -190,11 +184,11 @@ jobs: uses: azure/CLI@v1 with: inlineScript: | - az vm create -g Testnet -n "${{vars.RESOURCE_STARTING_NAME}}-${{ matrix.host_id }}-${{ GITHUB.RUN_NUMBER }}" \ + az vm create -g Testnet -n "${{steps.dotenv.outputs.RESOURCE_STARTING_NAME}}-${{ matrix.host_id }}-${{ GITHUB.RUN_NUMBER }}" \ --admin-username obscurouser --admin-password "${{ secrets.OBSCURO_NODE_VM_PWD }}" \ - --public-ip-address-dns-name "obscuronode-${{ matrix.host_id }}-${{vars.RESOURCE_TESTNET_NAME}}-${{ GITHUB.RUN_NUMBER }}" \ - --tags deploygroup=ObscuroNode-${{vars.RESOURCE_TESTNET_NAME}}-${{ GITHUB.RUN_NUMBER }} ${{vars.RESOURCE_TAG_NAME}}=true \ - --vnet-name ObscuroHost-${{vars.RESOURCE_TESTNET_NAME}}-01VNET --subnet ObscuroHost-${{vars.RESOURCE_TESTNET_NAME}}-01Subnet \ + --public-ip-address-dns-name "obscuronode-${{ matrix.host_id }}-${{steps.dotenv.outputs.RESOURCE_TESTNET_NAME}}-${{ GITHUB.RUN_NUMBER }}" \ + --tags deploygroup=ObscuroNode-${{steps.dotenv.outputs.RESOURCE_TESTNET_NAME}}-${{ GITHUB.RUN_NUMBER }} ${{steps.dotenv.outputs.RESOURCE_TAG_NAME}}=true \ + --vnet-name ObscuroHost-${{steps.dotenv.outputs.RESOURCE_TESTNET_NAME}}-01VNET --subnet ObscuroHost-${{steps.dotenv.outputs.RESOURCE_TESTNET_NAME}}-01Subnet \ --size Standard_DC4s_v2 --image ObscuroConfUbuntu \ --public-ip-sku Basic --authentication-type password @@ -202,7 +196,7 @@ jobs: uses: azure/CLI@v1 with: inlineScript: | - az vm open-port -g Testnet -n "${{vars.RESOURCE_STARTING_NAME}}-${{ matrix.host_id }}-${{ GITHUB.RUN_NUMBER }}" --port 80,81,6060,6061,10000 + az vm open-port -g Testnet -n "${{steps.dotenv.outputs.RESOURCE_STARTING_NAME}}-${{ matrix.host_id }}-${{ GITHUB.RUN_NUMBER }}" --port 80,81,6060,6061,10000 # To overcome issues with critical VM resources being unavailable, we need to wait for the VM to be ready - name: 'Allow time for VM initialization' @@ -213,7 +207,7 @@ jobs: uses: azure/CLI@v1 with: inlineScript: | - az vm run-command invoke -g Testnet -n "${{vars.RESOURCE_STARTING_NAME}}-${{ matrix.host_id }}-${{ GITHUB.RUN_NUMBER }}" \ + az vm run-command invoke -g Testnet -n "${{steps.dotenv.outputs.RESOURCE_STARTING_NAME}}-${{ matrix.host_id }}-${{ GITHUB.RUN_NUMBER }}" \ --command-id RunShellScript \ --scripts 'mkdir -p /home/obscuro \ && git clone --depth 1 -b ${{ env.BRANCH_NAME }} https://github.com/obscuronet/go-obscuro.git /home/obscuro/go-obscuro \ @@ -242,15 +236,15 @@ jobs: -message_bus_contract_addr=${{needs.build.outputs.MSG_BUS_CONTRACT_ADDR}} \ -l1_start=${{needs.build.outputs.L1_START_HASH}} \ -private_key=${{ secrets[matrix.node_pk_lookup] }} \ - -sequencer_id=${{ vars.NODE_WALLET_ADDR_0 }} \ - -host_public_p2p_addr=obscuronode-${{ matrix.host_id }}-${{vars.RESOURCE_TESTNET_NAME}}-${{ GITHUB.RUN_NUMBER }}.uksouth.cloudapp.azure.com:10000 \ + -sequencer_id=${{ steps.dotenv.outputs.NODE_WALLET_ADDR_0 }} \ + -host_public_p2p_addr=obscuronode-${{ matrix.host_id }}-${{steps.dotenv.outputs.RESOURCE_TESTNET_NAME}}-${{ GITHUB.RUN_NUMBER }}.uksouth.cloudapp.azure.com:10000 \ -host_p2p_port=10000 \ - -enclave_docker_image=${{vars.L2_ENCLAVE_DOCKER_BUILD_TAG}} \ - -host_docker_image=${{vars.L2_HOST_DOCKER_BUILD_TAG}} \ + -enclave_docker_image=${{steps.dotenv.outputs.L2_ENCLAVE_DOCKER_BUILD_TAG}} \ + -host_docker_image=${{steps.dotenv.outputs.L2_HOST_DOCKER_BUILD_TAG}} \ -is_debug_namespace_enabled=true \ -log_level=${{ github.event.inputs.log_level }} \ - -batch_interval=${{vars.BATCH_INTERVAL}} \ - -rollup_interval=${{vars.ROLLUP_INTERVAL}} \ + -batch_interval=${{steps.dotenv.outputs.BATCH_INTERVAL}} \ + -rollup_interval=${{steps.dotenv.outputs.ROLLUP_INTERVAL}} \ start' @@ -270,18 +264,18 @@ jobs: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: 'Remove existing backend nodes from the load balancer' - run: ./.github/workflows/runner-scripts/testnet-clear-loadbalancer.sh ${{vars.RESOURCE_TESTNET_NAME}} + run: ./.github/workflows/runner-scripts/testnet-clear-loadbalancer.sh ${{steps.dotenv.outputs.RESOURCE_TESTNET_NAME}} - name: 'Add load balancer address pool to the IP configuration' uses: azure/CLI@v1 with: inlineScript: | az network nic ip-config address-pool add \ - --address-pool Backend-Pool-Obscuro-${{vars.RESOURCE_TESTNET_NAME}} \ - --ip-config-name ipconfig${{vars.RESOURCE_STARTING_NAME}}-1-${{ GITHUB.RUN_NUMBER }} \ - --nic-name ${{vars.RESOURCE_STARTING_NAME}}-1-${{ GITHUB.RUN_NUMBER }}VMNic \ + --address-pool Backend-Pool-Obscuro-${{steps.dotenv.outputs.RESOURCE_TESTNET_NAME}} \ + --ip-config-name ipconfig${{steps.dotenv.outputs.RESOURCE_STARTING_NAME}}-1-${{ GITHUB.RUN_NUMBER }} \ + --nic-name ${{steps.dotenv.outputs.RESOURCE_STARTING_NAME}}-1-${{ GITHUB.RUN_NUMBER }}VMNic \ --resource-group Testnet \ - --lb-name ${{vars.RESOURCE_TESTNET_NAME}}-loadbalancer + --lb-name ${{steps.dotenv.outputs.RESOURCE_TESTNET_NAME}}-loadbalancer check-obscuro-is-healthy: needs: @@ -296,8 +290,8 @@ jobs: - name: "Wait until obscuro node is healthy" shell: bash run: | - ./.github/workflows/runner-scripts/wait-node-healthy.sh --host=obscuronode-0-${{vars.RESOURCE_TESTNET_NAME}}-${{ GITHUB.RUN_NUMBER }}.uksouth.cloudapp.azure.com - ./.github/workflows/runner-scripts/wait-node-healthy.sh --host=obscuronode-1-${{vars.RESOURCE_TESTNET_NAME}}-${{ GITHUB.RUN_NUMBER }}.uksouth.cloudapp.azure.com + ./.github/workflows/runner-scripts/wait-node-healthy.sh --host=obscuronode-0-${{steps.dotenv.outputs.RESOURCE_TESTNET_NAME}}-${{ GITHUB.RUN_NUMBER }}.uksouth.cloudapp.azure.com + ./.github/workflows/runner-scripts/wait-node-healthy.sh --host=obscuronode-1-${{steps.dotenv.outputs.RESOURCE_TESTNET_NAME}}-${{ GITHUB.RUN_NUMBER }}.uksouth.cloudapp.azure.com deploy-l2-contracts: needs: @@ -314,7 +308,7 @@ jobs: shell: bash run: | go run ./testnet/launcher/l2contractdeployer/cmd \ - -l2_host=obscuronode-0-${{vars.RESOURCE_TESTNET_NAME}}-${{ GITHUB.RUN_NUMBER }}.uksouth.cloudapp.azure.com \ + -l2_host=obscuronode-0-${{steps.dotenv.outputs.RESOURCE_TESTNET_NAME}}-${{ GITHUB.RUN_NUMBER }}.uksouth.cloudapp.azure.com \ -l1_http_url=${{ secrets.L1_HTTP_URL }} \ -l2_ws_port=81 \ -private_key=${{ secrets.WORKER_PK }} \ @@ -322,7 +316,7 @@ jobs: -l2_hoc_private_key=6e384a07a01263518a09a5424c7b6bbfc3604ba7d93f47e3a455cbdd7f9f0682 \ -l2_poc_private_key=4bfe14725e685901c062ccd4e220c61cf9c189897b6c78bd18d7f51291b2b8f8 \ -message_bus_contract_addr=${{ needs.build.outputs.MSG_BUS_CONTRACT_ADDR }} \ - -docker_image=${{vars.L2_HARDHATDEPLOYER_DOCKER_BUILD_TAG}} + -docker_image=${{steps.dotenv.outputs.L2_HARDHATDEPLOYER_DOCKER_BUILD_TAG}} - name: 'Save container logs on failure' if: failure()