diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 79671ef5..19ba9763 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -182,6 +182,7 @@ jobs: deployment: runs-on: ubuntu-latest needs: + - build-e2e-images - build-molecule-runner strategy: fail-fast: false @@ -197,11 +198,11 @@ jobs: run: docker login ${DOCKER_REGISTRY} -u ${{ github.actor }} -p ${{ github.token }} - run: deployment-e2e/molecule.sh ${{ matrix.task }} ultimate: + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags') || contains(github.event.head_commit.message, 'ultimate') runs-on: ubuntu-latest needs: - initialize - build-e2e-images - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags') strategy: fail-fast: false matrix: @@ -209,12 +210,16 @@ jobs: include: - task: erc-to-erc ui-e2e-grep: 'ERC TO ERC' + ui-config: 'e2e-commons/components-envs/ui-erc20.env' - task: erc-to-native ui-e2e-grep: 'ERC TO NATIVE' + ui-config: 'e2e-commons/components-envs/ui-erc20-native.env' - task: native-to-erc ui-e2e-grep: 'NATIVE TO ERC' + ui-config: 'e2e-commons/components-envs/ui.env' - task: amb-stake-erc-to-erc ui-e2e-grep: 'AMB-STAKE-ERC-TO-ERC' + ui-config: 'e2e-commons/components-envs/ui-amb-stake-erc20-erc20.env' steps: - uses: actions/checkout@v2 with: @@ -240,7 +245,20 @@ jobs: - name: Deploy contracts run: ${{ steps.cache-repo.outputs.cache-hit }} && e2e-commons/up.sh deploy blocks - name: Pull e2e oracle image - run: docker-compose -f ./e2e-commons/docker-compose.yml pull oracle + run: | + docker-compose -f ./e2e-commons/docker-compose.yml pull oracle + docker tag ${DOCKER_IMAGE_BASE}/tokenbridge-e2e-oracle:${ORACLE_TAG} poanetwork/tokenbridge-oracle:latest + - if: ${{ matrix.ui-e2e-grep }} + name: Pull e2e ui image + run: | + docker-compose -f ./e2e-commons/docker-compose.yml pull ui + docker build \ + --build-arg DOCKER_IMAGE_BASE=${DOCKER_IMAGE_BASE} \ + --build-arg UI_TAG=${UI_TAG} \ + --build-arg DOT_ENV_PATH=${{ matrix.ui-config }} \ + -f ./e2e-commons/Dockerfile.ui \ + -t ui_ui:latest \ + . - name: Deploy oracle and ui run: deployment-e2e/molecule.sh ultimate-${{ matrix.task }} - name: Reset docker socket permissions diff --git a/deployment-e2e/molecule/ultimate-amb-stake-erc-to-erc/molecule.yml b/deployment-e2e/molecule/ultimate-amb-stake-erc-to-erc/molecule.yml index 3992216f..b6c1b326 100644 --- a/deployment-e2e/molecule/ultimate-amb-stake-erc-to-erc/molecule.yml +++ b/deployment-e2e/molecule/ultimate-amb-stake-erc-to-erc/molecule.yml @@ -32,8 +32,6 @@ provisioner: inventory: host_vars: oracle-amb-host: - COMMON_HOME_RPC_URL: "http://parity1:8545" - COMMON_FOREIGN_RPC_URL: "http://parity2:8545" ORACLE_VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b" ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" ui-amb-stake-erc-to-erc-host: diff --git a/deployment-e2e/molecule/ultimate-amb/molecule.yml b/deployment-e2e/molecule/ultimate-amb/molecule.yml index d0330420..c523faf8 100644 --- a/deployment-e2e/molecule/ultimate-amb/molecule.yml +++ b/deployment-e2e/molecule/ultimate-amb/molecule.yml @@ -21,8 +21,6 @@ provisioner: inventory: host_vars: oracle-amb-host: - COMMON_HOME_RPC_URL: "http://parity1:8545" - COMMON_FOREIGN_RPC_URL: "http://parity2:8545" ORACLE_VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b" ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" verifier: diff --git a/deployment-e2e/molecule/ultimate-commons/converge.yml b/deployment-e2e/molecule/ultimate-commons/converge.yml index 23630e5b..56014279 100644 --- a/deployment-e2e/molecule/ultimate-commons/converge.yml +++ b/deployment-e2e/molecule/ultimate-commons/converge.yml @@ -1,5 +1,3 @@ --- -- import_playbook: ../../../deployment/site.yml -# The docker-compose files have to be modified, in order to join the docker containers over network with the parity containers - import_playbook: ./oracle-docker-compose.yml -- import_playbook: ./ui-docker-compose.yml +- import_playbook: ../../../deployment/site.yml diff --git a/deployment-e2e/molecule/ultimate-commons/oracle-add-docker-external-network.yml b/deployment-e2e/molecule/ultimate-commons/oracle-add-docker-external-network.yml deleted file mode 100644 index 77cb562f..00000000 --- a/deployment-e2e/molecule/ultimate-commons/oracle-add-docker-external-network.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: Slurp docker compose file - slurp: - src: "/home/poadocker/bridge/oracle/{{ file }}.yml" - register: docker_compose_slurp -- name: Parse docker compose file - set_fact: - docker_compose_parsed: "{{ docker_compose_slurp['content'] | b64decode | from_yaml }}" - -- name: Add the external network used to connect to Parity nodes - set_fact: - docker_compose_parsed: "{{ docker_compose_parsed |combine({'networks': {'ultimate': {'external': 'true'}}}, recursive=True) }}" - -- name: Add all Oracle containers to the network - set_fact: - docker_compose_parsed: "{{ docker_compose_parsed | combine({'services': {item: {'networks': docker_compose_parsed.services[item].networks | union(['ultimate'])}}}, recursive=True) }}" - with_items: "{{ docker_compose_parsed.services }}" - -- name: Expose Redis port to allow connecting from redis-cli - set_fact: - docker_compose_parsed: "{{ docker_compose_parsed | combine({'services': {'redis': {'ports': ['6379:6379']}}}, recursive=True) }}" - -- name: Write updated docker file - copy: - content: "{{ docker_compose_parsed | to_yaml }}" - dest: "/home/poadocker/bridge/oracle/{{ file }}.yml" diff --git a/deployment-e2e/molecule/ultimate-commons/oracle-docker-compose.yml b/deployment-e2e/molecule/ultimate-commons/oracle-docker-compose.yml index e36b57db..510b6d66 100644 --- a/deployment-e2e/molecule/ultimate-commons/oracle-docker-compose.yml +++ b/deployment-e2e/molecule/ultimate-commons/oracle-docker-compose.yml @@ -1,33 +1,22 @@ --- -- name: Overwrite Oracle the docker-compose +- name: Prepare Oracle for ultimate tests hosts: oracle become: true tasks: - - name: stop the service - shell: service poabridge stop - - - name: ReTag current oracle image - shell: docker tag $(docker images --format '{{ '{{' }}.Repository{{ '}}' }}:{{ '{{' }}.Tag{{ '}}' }}' | grep -m 1 tokenbridge-e2e-oracle) oracle:ultimate-testing + - name: Connect parity to oracle networks + shell: "docker network create {{ item }} && docker network connect {{ item }} parity1 && docker network connect {{ item }} parity2" + with_items: + - oracle_net_db_bridge_request + - oracle_net_db_bridge_collected + - oracle_net_db_bridge_affirmation + - oracle_net_db_bridge_transfer + - oracle_net_db_bridge_senderhome + - oracle_net_db_bridge_senderforeign + - oracle_net_rabbit_bridge_request + - oracle_net_rabbit_bridge_collected + - oracle_net_rabbit_bridge_affirmation + - oracle_net_rabbit_bridge_transfer + - oracle_net_rabbit_bridge_senderhome + - oracle_net_rabbit_bridge_senderforeign delegate_to: 127.0.0.1 become: false - - - name: Replace oracle image - replace: - path: "/home/poadocker/bridge/oracle/{{ item }}.yml" - regexp: 'poanetwork/tokenbridge-oracle:latest' - replace: "oracle:ultimate-testing" - with_items: - - docker-compose - - docker-compose-transfer - - docker-compose-erc-native - - - include_tasks: oracle-add-docker-external-network.yml - with_items: - - docker-compose - - docker-compose-transfer - - docker-compose-erc-native - loop_control: - loop_var: file - - - name: start the service - shell: service poabridge start diff --git a/deployment-e2e/molecule/ultimate-commons/ui-docker-compose.yml b/deployment-e2e/molecule/ultimate-commons/ui-docker-compose.yml deleted file mode 100644 index 452c958d..00000000 --- a/deployment-e2e/molecule/ultimate-commons/ui-docker-compose.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- name: Overwrite UI the docker-compose - hosts: ui - become: true - tasks: - - name: stop the service - shell: service tokenbridge-ui stop - - - name: Slurp docker compose file - slurp: - src: "/home/poadocker/bridge/ui/docker-compose.yml" - register: docker_compose_slurp - - name: Parse docker compose file - set_fact: - docker_compose_parsed: "{{ docker_compose_slurp['content'] | b64decode | from_yaml }}" - - - name: Add the external network used to connect to Parity nodes - set_fact: - docker_compose_parsed: "{{ docker_compose_parsed |combine({'networks': {'ultimate': {'external': 'true'}}}, recursive=True) }}" - - - name: Add all UI containers to the network - set_fact: - docker_compose_parsed: "{{ docker_compose_parsed | combine({'services': {item: {'networks': ['ultimate']}}}, recursive=True) }}" - with_items: "{{ docker_compose_parsed.services }}" - - - name: Write new docker-compose file - copy: - content: "{{ docker_compose_parsed | to_yaml }}" - dest: "/home/poadocker/bridge/ui/docker-compose.yml" - - - name: start the service - shell: service tokenbridge-ui start diff --git a/deployment-e2e/molecule/ultimate-erc-to-erc/molecule.yml b/deployment-e2e/molecule/ultimate-erc-to-erc/molecule.yml index 161a8fd7..e082e6fe 100644 --- a/deployment-e2e/molecule/ultimate-erc-to-erc/molecule.yml +++ b/deployment-e2e/molecule/ultimate-erc-to-erc/molecule.yml @@ -32,8 +32,6 @@ provisioner: inventory: host_vars: oracle-erc-to-erc-host: - COMMON_HOME_RPC_URL: "http://parity1:8545" - COMMON_FOREIGN_RPC_URL: "http://parity2:8545" ORACLE_VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b" ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" ui-erc-to-erc-host: diff --git a/deployment-e2e/molecule/ultimate-erc-to-native/molecule.yml b/deployment-e2e/molecule/ultimate-erc-to-native/molecule.yml index cab9437b..b155c187 100644 --- a/deployment-e2e/molecule/ultimate-erc-to-native/molecule.yml +++ b/deployment-e2e/molecule/ultimate-erc-to-native/molecule.yml @@ -32,8 +32,6 @@ provisioner: inventory: host_vars: oracle-erc-to-native-host: - COMMON_HOME_RPC_URL: "http://parity1:8545" - COMMON_FOREIGN_RPC_URL: "http://parity2:8545" ORACLE_VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b" ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" ORACLE_HOME_START_BLOCK: 1 diff --git a/deployment-e2e/molecule/ultimate-native-to-erc/molecule.yml b/deployment-e2e/molecule/ultimate-native-to-erc/molecule.yml index 2bfae260..2126c88f 100644 --- a/deployment-e2e/molecule/ultimate-native-to-erc/molecule.yml +++ b/deployment-e2e/molecule/ultimate-native-to-erc/molecule.yml @@ -32,8 +32,6 @@ provisioner: inventory: host_vars: oracle-native-to-erc-host: - COMMON_HOME_RPC_URL: "http://parity1:8545" - COMMON_FOREIGN_RPC_URL: "http://parity2:8545" ORACLE_VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b" ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" ui-native-to-erc-host: diff --git a/deployment/group_vars/ultimate.yml b/deployment/group_vars/ultimate.yml index 65547f69..c47e6830 100644 --- a/deployment/group_vars/ultimate.yml +++ b/deployment/group_vars/ultimate.yml @@ -5,13 +5,13 @@ ORACLE_ALLOW_HTTP_FOR_RPC: yes ORACLE_LOG_LEVEL: debug ## Home contract -COMMON_HOME_RPC_URL: "https://sokol.poa.network" +COMMON_HOME_RPC_URL: "http://parity1:8545" UI_HOME_NETWORK_DISPLAY_NAME: "POA Sokol" UI_HOME_WITHOUT_EVENTS: false ORACLE_HOME_RPC_POLLING_INTERVAL: 5000 ## Foreign contract -COMMON_FOREIGN_RPC_URL: "https://sokol.poa.network" +COMMON_FOREIGN_RPC_URL: "http://parity2:8545" UI_FOREIGN_NETWORK_DISPLAY_NAME: "Kovan" UI_FOREIGN_WITHOUT_EVENTS: false ORACLE_FOREIGN_RPC_POLLING_INTERVAL: 1000 @@ -52,3 +52,7 @@ MONITOR_FOREIGN_START_BLOCK: 0 MONITOR_VALIDATOR_HOME_TX_LIMIT: 300000 MONITOR_VALIDATOR_FOREIGN_TX_LIMIT: 300000 MONITOR_TX_NUMBER_THRESHOLD: 100 + +# disable building and pulling of docker images from the Docker Hub +skip_pull: true +skip_build: true diff --git a/deployment/roles/monitor/tasks/jumpbox.yml b/deployment/roles/monitor/tasks/jumpbox.yml index 5e230b79..611031a8 100644 --- a/deployment/roles/monitor/tasks/jumpbox.yml +++ b/deployment/roles/monitor/tasks/jumpbox.yml @@ -3,3 +3,4 @@ shell: docker-compose pull args: chdir: "{{ bridge_path }}/monitor" + when: skip_pull is undefined diff --git a/deployment/roles/oracle/tasks/jumpbox.yml b/deployment/roles/oracle/tasks/jumpbox.yml index 3d1dcf1c..81a50843 100644 --- a/deployment/roles/oracle/tasks/jumpbox.yml +++ b/deployment/roles/oracle/tasks/jumpbox.yml @@ -3,3 +3,4 @@ shell: docker-compose pull args: chdir: "{{ bridge_path }}/oracle" + when: skip_pull is undefined diff --git a/deployment/roles/ui/tasks/jumpbox.yml b/deployment/roles/ui/tasks/jumpbox.yml index 947e28a9..947ba9f2 100644 --- a/deployment/roles/ui/tasks/jumpbox.yml +++ b/deployment/roles/ui/tasks/jumpbox.yml @@ -3,3 +3,4 @@ shell: docker-compose build args: chdir: "{{ bridge_path }}/ui" + when: skip_build is undefined diff --git a/e2e-commons/components-envs/ui-amb-stake-erc20-erc20.env b/e2e-commons/components-envs/ui-amb-stake-erc20-erc20.env index e5bd1765..2c30a798 100644 --- a/e2e-commons/components-envs/ui-amb-stake-erc20-erc20.env +++ b/e2e-commons/components-envs/ui-amb-stake-erc20-erc20.env @@ -19,5 +19,5 @@ COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard COMMON_FOREIGN_GAS_PRICE_FALLBACK=5000000000 UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=15000 COMMON_FOREIGN_GAS_PRICE_FACTOR=1 -UI_PORT=3000 +UI_PORT=3003 UI_STYLES=stake diff --git a/e2e-commons/components-envs/ui-erc20-native.env b/e2e-commons/components-envs/ui-erc20-native.env index 6ba0ac07..7cbd7c7d 100644 --- a/e2e-commons/components-envs/ui-erc20-native.env +++ b/e2e-commons/components-envs/ui-erc20-native.env @@ -19,5 +19,5 @@ COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard COMMON_FOREIGN_GAS_PRICE_FALLBACK=5000000000 UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=15000 COMMON_FOREIGN_GAS_PRICE_FACTOR=1 -UI_PORT=3000 +UI_PORT=3002 UI_STYLES=core diff --git a/e2e-commons/components-envs/ui-erc20.env b/e2e-commons/components-envs/ui-erc20.env index ca0d1140..ac851a15 100644 --- a/e2e-commons/components-envs/ui-erc20.env +++ b/e2e-commons/components-envs/ui-erc20.env @@ -19,5 +19,5 @@ COMMON_FOREIGN_GAS_PRICE_SPEED_TYPE=standard COMMON_FOREIGN_GAS_PRICE_FALLBACK=5000000000 UI_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=15000 COMMON_FOREIGN_GAS_PRICE_FACTOR=1 -UI_PORT=3000 +UI_PORT=3001 UI_STYLES=core diff --git a/e2e-commons/docker-compose.yml b/e2e-commons/docker-compose.yml index d6863e2a..21499f53 100644 --- a/e2e-commons/docker-compose.yml +++ b/e2e-commons/docker-compose.yml @@ -4,12 +4,14 @@ networks: external: true services: parity1: + container_name: parity1 build: ../parity ports: - "8541:8545" networks: - ultimate parity2: + container_name: parity2 build: context: ../parity dockerfile: Dockerfile-foreign diff --git a/e2e-commons/up.sh b/e2e-commons/up.sh index 0bdf21a2..ace0de63 100755 --- a/e2e-commons/up.sh +++ b/e2e-commons/up.sh @@ -80,9 +80,9 @@ while [ "$1" != "" ]; do docker-compose up -d ui ui-erc20 ui-erc20-native ui-amb-stake-erc20-erc20 docker-compose run -d -p 3000:3000 ui yarn start - docker-compose run -d -p 3001:3000 ui-erc20 yarn start - docker-compose run -d -p 3002:3000 ui-erc20-native yarn start - docker-compose run -d -p 3003:3000 ui-amb-stake-erc20-erc20 yarn start + docker-compose run -d -p 3001:3001 ui-erc20 yarn start + docker-compose run -d -p 3002:3002 ui-erc20-native yarn start + docker-compose run -d -p 3003:3003 ui-amb-stake-erc20-erc20 yarn start fi if [ "$1" == "alm" ]; then diff --git a/oracle-e2e/test/amb.js b/oracle-e2e/test/amb.js index 66c73c80..6ffd5d2e 100644 --- a/oracle-e2e/test/amb.js +++ b/oracle-e2e/test/amb.js @@ -142,7 +142,7 @@ describe('arbitrary message bridging', () => { console.error(e) }) - await delay(5000) + await delay(10000) const newSignatures = await homeBridge.getPastEvents('SignedForUserRequest', { fromBlock: 0, diff --git a/ui/docker-compose.yml b/ui/docker-compose.yml index e2905cb1..5c2529b3 100644 --- a/ui/docker-compose.yml +++ b/ui/docker-compose.yml @@ -8,7 +8,7 @@ services: ports: - "${UI_PORT}:${UI_PORT}" env_file: ./.env - environment: + environment: - NODE_ENV=production restart: unless-stopped entrypoint: yarn start