From 6a20d76cf79d86ce17dd48072219ac51a56e595e Mon Sep 17 00:00:00 2001 From: fmacleal Date: Mon, 15 Jul 2024 20:22:53 +0200 Subject: [PATCH 01/19] Adding .idea to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a33923ed..77cde6cd 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ config/*.js logs .env .DS_Store +.idea/ From e1546a3f7f8346b1cda66071d92f7fee1ea5763b Mon Sep 17 00:00:00 2001 From: fmacleal Date: Mon, 10 Jun 2024 21:30:47 +0200 Subject: [PATCH 02/19] Initial version from github actions workflow - Finished the building steps and adding the testing - The work on the testing steps started - After internal discussions, we decided to change approach and create an action - For better use of the RIT execution, we want to create an action to be called by powpeg and rskj. Due that, we are starting creating a Dockerfile with everything necessary to run this integration test. --- .github/images/Dockerfile | 88 +++++++++++++ .github/images/entrypoint.sh | 43 +++++++ .../logbacks/logback-fed-1.xml | 114 +++++++++++++++++ .../logbacks/logback-fed-2.xml | 114 +++++++++++++++++ .../logbacks/logback-fed-3.xml | 114 +++++++++++++++++ .../logbacks/logback-fed-4.xml | 114 +++++++++++++++++ .../logbacks/logback-fed-5.xml | 114 +++++++++++++++++ .../rit-local-configs/regtest-all-keys.js | 116 ++++++++++++++++++ .../scripts/configure_gradle_federator.sh | 45 +++++++ .../images/scripts/configure_rit_locally.sh | 18 +++ .gitignore | 1 + 11 files changed, 881 insertions(+) create mode 100644 .github/images/Dockerfile create mode 100644 .github/images/entrypoint.sh create mode 100644 .github/images/rit-local-configs/logbacks/logback-fed-1.xml create mode 100644 .github/images/rit-local-configs/logbacks/logback-fed-2.xml create mode 100644 .github/images/rit-local-configs/logbacks/logback-fed-3.xml create mode 100644 .github/images/rit-local-configs/logbacks/logback-fed-4.xml create mode 100644 .github/images/rit-local-configs/logbacks/logback-fed-5.xml create mode 100644 .github/images/rit-local-configs/regtest-all-keys.js create mode 100755 .github/images/scripts/configure_gradle_federator.sh create mode 100755 .github/images/scripts/configure_rit_locally.sh diff --git a/.github/images/Dockerfile b/.github/images/Dockerfile new file mode 100644 index 00000000..e1beb09e --- /dev/null +++ b/.github/images/Dockerfile @@ -0,0 +1,88 @@ +FROM ubuntu:24.04 AS builder + +LABEL Description="Custom RSK node image to execute Rootstock Integration Tests" + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + wget gnupg2 curl git ca-certificates mocha \ + && apt clean + +# -- nodeJs --------------------------------------------------------- +ENV NODE_VERSION v20.14.0 +RUN mkdir -p /usr/local/nvm +ENV NVM_DIR /usr/local/nvm + +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + +ENV NODE_PATH $NVM_DIR/$NODE_VERSION/lib/node_modules +ENV PATH $NVM_DIR/versions/node/$NODE_VERSION/bin:$PATH + +# -- java --------------------------------------------------------- +ENV JAVA_VERSION 11 + +RUN apt-get -y install "openjdk-$JAVA_VERSION-jdk" + +ENV JAVA_HOME="/usr/lib/jvm/java-$JAVA_VERSION-openjdk-amd64" \ + PATH="$JAVA_HOME:$PATH" + +RUN export JAVA_HOME=$JAVA_HOME \ + && export PATH="$JAVA_HOME:$PATH" + +# -- python --------------------------------------------------------- +ENV PYTHON_VERSION=2.7.16 + +# Install dependencies +RUN apt-get update \ + && apt-get install -y gcc make openssl libffi-dev libgdbm-dev libsqlite3-dev libssl-dev zlib1g-dev \ + && apt-get clean + +RUN export PREVIOUS_PATH=$(pwd) \ + && cd /tmp + +#Build Python from source +RUN wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz \ + && tar --extract -f Python-$PYTHON_VERSION.tgz \ + && cd ./Python-$PYTHON_VERSION/ \ + && ./configure --with-ensurepip=install --enable-optimizations --prefix=/usr/local \ + && make && make install \ + && cd ../ \ + && rm -r ./Python-$PYTHON_VERSION* \ + && python --version \ + && pip --version \ + && cd $PREVIOUS_PATH + +# -- bitcoind --------------------------------------------------------- +ENV BITCOIN_VERSION 0.18.1 + +RUN cd /tmp \ + && wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz \ + && tar -xzvf bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz -C /opt \ + && mv /opt/bitcoin-${BITCOIN_VERSION} /opt/bitcoin \ + && rm -v /opt/bitcoin/bin/test_bitcoin /opt/bitcoin/bin/bitcoin-qt \ + && ln -sv /opt/bitcoin/bin/* /usr/local/bin + +# -- configure entrypoint to run RIT-------------------------------------------- + +RUN mkdir -p /usr/src/logbacks + +WORKDIR /usr/src + +COPY entrypoint.sh /usr/src/entrypoint.sh +COPY rit-local-configs/regtest-all-keys.js /usr/src/regtest.js +COPY rit-local-configs/logbacks/* /usr/src/logbacks/ +COPY scripts/* /usr/src/ + +RUN chmod +x /usr/src/entrypoint.sh \ + && chmod +x /usr/src/configure_gradle_federator.sh \ + && chmod +x /usr/src/configure_rit_locally.sh \ + && mkdir -p /usr/src/bitcoindata \ + && chmod -R 755 /usr/src/bitcoindata \ + && ls -la /usr/src + +ENTRYPOINT ["/usr/src/entrypoint.sh"] + +EXPOSE 18332 \ No newline at end of file diff --git a/.github/images/entrypoint.sh b/.github/images/entrypoint.sh new file mode 100644 index 00000000..21753661 --- /dev/null +++ b/.github/images/entrypoint.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -e + +RSKJ_BRANCH="master" +POWPEG_BRANCH="master" + + +echo -e "\n\n--------- Starting the configuration of rskj ---------\n\n" + +git clone https://github.com/rsksmart/rskj.git rskj +cd rskj && git checkout $RSKJ_BRANCH +chmod +x ./configure.sh && chmod +x gradlew +./configure.sh +./gradlew --no-daemon clean build -x test +cd .. + +echo -e "\n\n--------- Starting the configuration of powpeg ---------\n\n" +git clone https://github.com/rsksmart/powpeg-node.git powpeg +cp configure_gradle_federator.sh powpeg +cd powpeg && git checkout $POWPEG_BRANCH +chmod +x ./configure.sh && chmod +x gradlew +./configure_gradle_federator.sh +./configure.sh +./gradlew --info --no-daemon clean build -x test + +echo -e "\n\n--------- Starting the configuration of RIT ---------\n\n" +cd /usr/src/ +git clone https://github.com/rsksmart/rootstock-integration-tests.git rit +mv configure_rit_locally.sh rit +mv regtest.js rit/config/regtest.js +mv /usr/src/logbacks/* /usr/src/rit/logbacks/ +cd rit +chmod +x ./configure.sh +./configure.sh +./configure_rit_locally.sh "$FED_VERSION" + +echo -e "\n\n--------- Executing Rootstock Integration Tests ---------\n\n" +npm install -y +npm run test-fail-fast + +# Keep the container running +tail -f /dev/null diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-1.xml b/.github/images/rit-local-configs/logbacks/logback-fed-1.xml new file mode 100644 index 00000000..0f562cb9 --- /dev/null +++ b/.github/images/rit-local-configs/logbacks/logback-fed-1.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + System.out + + %date{yyyy-MM-dd-HH:mm:ss.SSSS} %p [%c{1}] %m%n + + + + + + /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-1.log + + + %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n + + + + ./logs/rskj-%d{yyyy-MM-dd}.%i.log.gz + 100MB + 7 + 1GB + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-2.xml b/.github/images/rit-local-configs/logbacks/logback-fed-2.xml new file mode 100644 index 00000000..509b62ad --- /dev/null +++ b/.github/images/rit-local-configs/logbacks/logback-fed-2.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + System.out + + %date{yyyy-MM-dd-HH:mm:ss.SSSS} %p [%c{1}] %m%n + + + + + + /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-2.log + + + %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n + + + + ./logs/rskj-%d{yyyy-MM-dd}.%i.log.gz + 100MB + 7 + 1GB + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-3.xml b/.github/images/rit-local-configs/logbacks/logback-fed-3.xml new file mode 100644 index 00000000..9fd82fc0 --- /dev/null +++ b/.github/images/rit-local-configs/logbacks/logback-fed-3.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + System.out + + %date{yyyy-MM-dd-HH:mm:ss.SSSS} %p [%c{1}] %m%n + + + + + + /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-3.log + + + %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n + + + + ./logs/rskj-%d{yyyy-MM-dd}.%i.log.gz + 100MB + 7 + 1GB + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-4.xml b/.github/images/rit-local-configs/logbacks/logback-fed-4.xml new file mode 100644 index 00000000..c6ca2443 --- /dev/null +++ b/.github/images/rit-local-configs/logbacks/logback-fed-4.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + System.out + + %date{yyyy-MM-dd-HH:mm:ss.SSSS} %p [%c{1}] %m%n + + + + + + /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-4.log + + + %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n + + + + ./logs/rskj-%d{yyyy-MM-dd}.%i.log.gz + 100MB + 7 + 1GB + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-5.xml b/.github/images/rit-local-configs/logbacks/logback-fed-5.xml new file mode 100644 index 00000000..6936f610 --- /dev/null +++ b/.github/images/rit-local-configs/logbacks/logback-fed-5.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + System.out + + %date{yyyy-MM-dd-HH:mm:ss.SSSS} %p [%c{1}] %m%n + + + + + + /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-5.log + + + %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n + + + + ./logs/rskj-%d{yyyy-MM-dd}.%i.log.gz + 100MB + 7 + 1GB + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.github/images/rit-local-configs/regtest-all-keys.js b/.github/images/rit-local-configs/regtest-all-keys.js new file mode 100644 index 00000000..a9d45f99 --- /dev/null +++ b/.github/images/rit-local-configs/regtest-all-keys.js @@ -0,0 +1,116 @@ +const path = require('path'); +const nodesConfigPath = 'config/node-configs'; +const keysPathResolve = 'node-keys'; +const classpath = process.env.POWPEG_NODE_JAR_PATH; +const federatesLogbackPath = path.resolve(__dirname, 'logback'); + +module.exports = { + init: { + mineInitialBitcoin: true, + federatesLogbackFile: federatesLogbackPath + }, + btc: { + rpcUser: 'test', + rpcPassword: 'test', + dir: process.env.BITCOIN_DATA_DIR, + }, + federate: [ + { + logbackFile: `${federatesLogbackPath}/logback-fed-1.xml`, + classpath: classpath, + configFile: `${nodesConfigPath}/rsk-reg-1.conf`, + publicKeys: { + btc: '0362634ab57dae9cb373a5d536e66a8c4f67468bbcfb063809bab643072d78a124', + rsk: '0362634ab57dae9cb373a5d536e66a8c4f67468bbcfb063809bab643072d78a124', + mst: '0362634ab57dae9cb373a5d536e66a8c4f67468bbcfb063809bab643072d78a124', + }, + customConfig: { + 'federator.signers.BTC.type': 'keyFile', + 'federator.signers.BTC.path': path.resolve(__dirname, `${keysPathResolve}/reg1.key`), + 'federator.signers.RSK.type': 'keyFile', + 'federator.signers.RSK.path': path.resolve(__dirname, `${keysPathResolve}/reg1.key`), + 'federator.signers.MST.type': 'keyFile', + 'federator.signers.MST.path': path.resolve(__dirname, `${keysPathResolve}/reg1.key`) + }, + nodeId: '62634ab57dae9cb373a5d536e66a8c4f67468bbcfb063809bab643072d78a1243bd206c2c7a218d6ff4c9a185e71f066bd354e5267875b7683fbc70a1d455e87' + }, + { + logbackFile: `${federatesLogbackPath}/logback-fed-2.xml`, + classpath: classpath, + configFile: `${nodesConfigPath}/rsk-reg-2.conf`, + publicKeys: { + btc: '03c5946b3fbae03a654237da863c9ed534e0878657175b132b8ca630f245df04db', + rsk: '03c5946b3fbae03a654237da863c9ed534e0878657175b132b8ca630f245df04db', + mst: '03c5946b3fbae03a654237da863c9ed534e0878657175b132b8ca630f245df04db', + }, + customConfig: { + 'federator.signers.BTC.type': 'keyFile', + 'federator.signers.BTC.path': path.resolve(__dirname, `${keysPathResolve}/reg2.key`), + 'federator.signers.RSK.type': 'keyFile', + 'federator.signers.RSK.path': path.resolve(__dirname, `${keysPathResolve}/reg2.key`), + 'federator.signers.MST.type': 'keyFile', + 'federator.signers.MST.path': path.resolve(__dirname, `${keysPathResolve}/reg2.key`) + }, + nodeId: 'c5946b3fbae03a654237da863c9ed534e0878657175b132b8ca630f245df04dbb0bde4f3854613b16032fb214f9cc00f75363976ee078cc4409cdc543036ccfd' + }, + { + logbackFile: `${federatesLogbackPath}/logback-fed-3.xml`, + classpath: classpath, + configFile: `${nodesConfigPath}/rsk-reg-3.conf`, + publicKeys: { + btc: '02cd53fc53a07f211641a677d250f6de99caf620e8e77071e811a28b3bcddf0be1', + rsk: '02cd53fc53a07f211641a677d250f6de99caf620e8e77071e811a28b3bcddf0be1', + mst: '02cd53fc53a07f211641a677d250f6de99caf620e8e77071e811a28b3bcddf0be1', + }, + customConfig: { + 'federator.signers.BTC.type': 'keyFile', + 'federator.signers.BTC.path': path.resolve(__dirname, `${keysPathResolve}/reg3.key`), + 'federator.signers.RSK.type': 'keyFile', + 'federator.signers.RSK.path': path.resolve(__dirname, `${keysPathResolve}/reg3.key`), + 'federator.signers.MST.type': 'keyFile', + 'federator.signers.MST.path': path.resolve(__dirname, `${keysPathResolve}/reg3.key`) + }, + nodeId: 'cd53fc53a07f211641a677d250f6de99caf620e8e77071e811a28b3bcddf0be19e9da12b897b83765fbaebe717fab74fcb1b57c82f7978b8be3296239909e626' + } + ], + additionalFederateNodes: [ + { + logbackFile: `${federatesLogbackPath}/logback-fed-4.xml`, + classpath: classpath, + configFile: `${nodesConfigPath}/rsk-reg-4.conf`, + publicKeys: { + btc: '031da807c71c2f303b7f409dd2605b297ac494a563be3b9ca5f52d95a43d183cc5', + rsk: '031da807c71c2f303b7f409dd2605b297ac494a563be3b9ca5f52d95a43d183cc5', + mst: '031da807c71c2f303b7f409dd2605b297ac494a563be3b9ca5f52d95a43d183cc5', + }, + customConfig: { + 'federator.signers.BTC.type': 'keyFile', + 'federator.signers.BTC.path': path.resolve(__dirname, `${keysPathResolve}/reg4.key`), + 'federator.signers.RSK.type': 'keyFile', + 'federator.signers.RSK.path': path.resolve(__dirname, `${keysPathResolve}/reg4.key`), + 'federator.signers.MST.type': 'keyFile', + 'federator.signers.MST.path': path.resolve(__dirname, `${keysPathResolve}/reg4.key`) + }, + nodeId: '1da807c71c2f303b7f409dd2605b297ac494a563be3b9ca5f52d95a43d183cc52191fc2bd3b06ece06b68390cbb3ba306284aed9ca7cb61dd6289e66e693126f' + }, + { + logbackFile: `${federatesLogbackPath}/logback-fed-5.xml`, + classpath: classpath, + configFile: `${nodesConfigPath}/rsk-reg-5.conf`, + publicKeys: { + btc: '036bb9eab797eadc8b697f0e82a01d01cabbfaaca37e5bafc06fdc6fdd38af894a', + rsk: '036bb9eab797eadc8b697f0e82a01d01cabbfaaca37e5bafc06fdc6fdd38af894a', + mst: '036bb9eab797eadc8b697f0e82a01d01cabbfaaca37e5bafc06fdc6fdd38af894a', + }, + customConfig: { + 'federator.signers.BTC.type': 'keyFile', + 'federator.signers.BTC.path': path.resolve(__dirname, `${keysPathResolve}/reg5.key`), + 'federator.signers.RSK.type': 'keyFile', + 'federator.signers.RSK.path': path.resolve(__dirname, `${keysPathResolve}/reg5.key`), + 'federator.signers.MST.type': 'keyFile', + 'federator.signers.MST.path': path.resolve(__dirname, `${keysPathResolve}/reg5.key`) + }, + nodeId: '6bb9eab797eadc8b697f0e82a01d01cabbfaaca37e5bafc06fdc6fdd38af894a9a8cbaf526d344b5df39b80433609e006586050fd2188d30ab000b0fb6a6baaf' + } + ] +} \ No newline at end of file diff --git a/.github/images/scripts/configure_gradle_federator.sh b/.github/images/scripts/configure_gradle_federator.sh new file mode 100755 index 00000000..e471e309 --- /dev/null +++ b/.github/images/scripts/configure_gradle_federator.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +read -r -d '' SETTINGS_GRADLE_CONTENT_LOCAL < + if (dependency.requested instanceof ModuleComponentSelector + && dependency.requested.group == 'co.rsk' + && dependency.requested.module == 'rskj-core' + && (dependency.requested.version.endsWith('SNAPSHOT') || dependency.requested.version.endsWith('RC'))) { + def targetProject = project(":\${dependency.requested.module}") + if (targetProject != null) { + println('---- USING LOCAL ' + dependency.requested.displayName + ' PROJECT ----') + dependency.useTarget targetProject + } + } + } + } +} +EOF + +# Read the version.properties from federator file +while IFS='=' read -r key value +do + # Remove all spaces + key=$(echo $key | tr -d ' ') + value=$(echo $value | tr -d ' ') + + # Check if key is 'modifier' or 'versionNumber' + if [[ "$key" == "modifier" ]]; then + modifier=${value//\"/} + elif [[ "$key" == "versionNumber" ]]; then + versionNumber=${value//\'/} + fi +done < "src/main/resources/version.properties" + +# Concatenate modifier and versionNumber +FED_VERSION="$modifier-$versionNumber" +echo "$FED_VERSION" + +if [[ $FED_VERSION == SNAPSHOT* || $FED_VERSION == RC* ]]; then + echo -e "$SETTINGS_GRADLE_CONTENT_LOCAL" > DONT-COMMIT-settings.gradle +else + echo "Settings gradle script local not necessary" +fi \ No newline at end of file diff --git a/.github/images/scripts/configure_rit_locally.sh b/.github/images/scripts/configure_rit_locally.sh new file mode 100755 index 00000000..0a594bda --- /dev/null +++ b/.github/images/scripts/configure_rit_locally.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +POWPEG_VERSION="${1:-SNAPSHOT-6.3.0.0}" +echo "POWPEG_VERSION received as parameter: $1" + +read -r -d '' SETTINGS_RIT < .env + + + diff --git a/.gitignore b/.gitignore index 77cde6cd..0be0603a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ logs .env .DS_Store .idea/ +.secrets From caabbe63803e6c1c8d47abcfe44532ec095d1814 Mon Sep 17 00:00:00 2001 From: fmacleal Date: Tue, 25 Jun 2024 17:43:20 +0200 Subject: [PATCH 03/19] Added the initial version of the action and a worfklow to validate it - There are some work in progress to tackle, since we need to have an example of how to use the action created. This is ongoing. - Adding results to the action outputs - In order to be able to validate results, we need to pass the test result to outputs from the Github configuration. This commit does it. - Adding the workflow to validate the GH Action - Adding the step to login so we can pull the image - Refactor of CI to build and push using repo credentials - Applying changes from review - Adding the waitTime and maxAttempts configurable with env variables --- .env-example | 15 +++ .github/action.yml | 36 ++++++ .github/images/Dockerfile | 27 +---- .github/images/entrypoint.sh | 35 +++--- .../logbacks/logback-fed-1.xml | 3 +- .../logbacks/logback-fed-2.xml | 3 +- .../logbacks/logback-fed-3.xml | 3 +- .../logbacks/logback-fed-4.xml | 3 +- .../logbacks/logback-fed-5.xml | 3 +- .../rit-local-configs/regtest-all-keys.js | 4 +- .../scripts/configure_gradle_federator.sh | 4 +- .../images/scripts/configure_rit_locally.sh | 5 +- .github/workflows/ci.yml | 104 ++++++++++++++++++ .gitignore | 4 +- lib/rsk-utils-legacy.js | 4 +- 15 files changed, 192 insertions(+), 61 deletions(-) create mode 100644 .github/action.yml create mode 100644 .github/workflows/ci.yml diff --git a/.env-example b/.env-example index fd4e7b5e..a616c611 100644 --- a/.env-example +++ b/.env-example @@ -1,3 +1,18 @@ INCLUDE_CASES=00_00_01-sync.js,01_01_01-pre_orchid_2wp.js RUN_EACH_TEST_FILE_THESE_TIMES=1 RUN_ALL_TESTS_THESE_TIMES=1 + +# Amount of time in milliseconds for the `waitForBlock` utility function to wait. +# Configurable because depending on the resources of the machine the tests are running on, the wait time might change. +# In a machine with little resources (CPU, RAM, disk), a small wait time might not be enough because blocks can be mined slow and `waitForBlock` +# might fail with a message like `Block number 800 never reached, last seen was 600`, or `Blockchain not advancing after attempting to find a new block 80 times checking every 200 milliseconds. +# Couldn't reach block number 800. Last block number seen was: 600`. In a machine with enough resources having a high wait time might be a waste of time since the tests would run slower because if this wait time. +# In this case, it can be set to a small value. `200` recommended for most machines with enough resources. `500`, `600`, etc., or more for machine with limited resources. +# Adjust as needed, starting with low values so the tests run as fast as they can. +WAIT_FOR_BLOCK_ATTEMPT_TIME_MILLIS= + +# Max attempts for the `waitForBlock` utility function to 'wait' for the given block, trying to find that block once every `WAIT_FOR_BLOCK_ATTEMPT_TIME_MILLIS`. +# The same as the `WAIT_FOR_BLOCK_ATTEMPT_TIME_MILLIS` variable, the value for this variable could be updated depending on the machine the tests are running on. +# `80` recommended for most machines with enough resources. `160`, `250` or more for machine with limited resources. +# Adjust as needed, starting with low values so the tests run as fast as they can. +WAIT_FOR_BLOCK_MAX_ATTEMPTS= diff --git a/.github/action.yml b/.github/action.yml new file mode 100644 index 00000000..36d02fa3 --- /dev/null +++ b/.github/action.yml @@ -0,0 +1,36 @@ +name: 'Rootstock Integration Tests Action' +description: 'This action provides a containerized environment for running integration tests on Rootstock.' +author: 'Rootstock Labs' + +inputs: + rskj-branch: + description: 'The rskj branch to checkout' + required: false + default: 'master' + federator-branch: + description: 'The federate-node branch to checkout' + required: false + default: 'master' + rit-branch: + description: 'The rootstock-integration-tests branch to checkout' + required: false + default: 'main' + rit-log-level: + description: 'Log level for the rootstock-integration-tests' + required: false + default: 'info' + +outputs: + status: + description: 'The status of the integration tests' + message: + description: 'The output message of the integration tests' + +runs: + using: docker + image: ./images/Dockerfile + env: + RSKJ_BRANCH: ${{ inputs.rskj-branch }} + FEDERATOR_BRANCH: ${{ inputs.federator-branch }} + RIT_BRANCH: ${{ inputs.rit-branch }} + RIT_LOG_LEVEL: ${{ inputs.rit-log-level }} diff --git a/.github/images/Dockerfile b/.github/images/Dockerfile index e1beb09e..3ffddc6f 100644 --- a/.github/images/Dockerfile +++ b/.github/images/Dockerfile @@ -4,7 +4,7 @@ LABEL Description="Custom RSK node image to execute Rootstock Integration Tests" RUN apt-get update \ && apt-get install -y --no-install-recommends \ - wget gnupg2 curl git ca-certificates mocha \ + wget gnupg2 curl git ca-certificates mocha \ && apt clean # -- nodeJs --------------------------------------------------------- @@ -32,29 +32,6 @@ ENV JAVA_HOME="/usr/lib/jvm/java-$JAVA_VERSION-openjdk-amd64" \ RUN export JAVA_HOME=$JAVA_HOME \ && export PATH="$JAVA_HOME:$PATH" -# -- python --------------------------------------------------------- -ENV PYTHON_VERSION=2.7.16 - -# Install dependencies -RUN apt-get update \ - && apt-get install -y gcc make openssl libffi-dev libgdbm-dev libsqlite3-dev libssl-dev zlib1g-dev \ - && apt-get clean - -RUN export PREVIOUS_PATH=$(pwd) \ - && cd /tmp - -#Build Python from source -RUN wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz \ - && tar --extract -f Python-$PYTHON_VERSION.tgz \ - && cd ./Python-$PYTHON_VERSION/ \ - && ./configure --with-ensurepip=install --enable-optimizations --prefix=/usr/local \ - && make && make install \ - && cd ../ \ - && rm -r ./Python-$PYTHON_VERSION* \ - && python --version \ - && pip --version \ - && cd $PREVIOUS_PATH - # -- bitcoind --------------------------------------------------------- ENV BITCOIN_VERSION 0.18.1 @@ -85,4 +62,4 @@ RUN chmod +x /usr/src/entrypoint.sh \ ENTRYPOINT ["/usr/src/entrypoint.sh"] -EXPOSE 18332 \ No newline at end of file +EXPOSE 18332 diff --git a/.github/images/entrypoint.sh b/.github/images/entrypoint.sh index 21753661..1e034d6c 100644 --- a/.github/images/entrypoint.sh +++ b/.github/images/entrypoint.sh @@ -2,25 +2,21 @@ set -e -RSKJ_BRANCH="master" -POWPEG_BRANCH="master" - - echo -e "\n\n--------- Starting the configuration of rskj ---------\n\n" - +cd /usr/src/ git clone https://github.com/rsksmart/rskj.git rskj -cd rskj && git checkout $RSKJ_BRANCH +cd rskj && git checkout ${INPUT_RSKJ_BRANCH} chmod +x ./configure.sh && chmod +x gradlew ./configure.sh -./gradlew --no-daemon clean build -x test -cd .. echo -e "\n\n--------- Starting the configuration of powpeg ---------\n\n" +cd /usr/src/ git clone https://github.com/rsksmart/powpeg-node.git powpeg cp configure_gradle_federator.sh powpeg -cd powpeg && git checkout $POWPEG_BRANCH +cd powpeg && git checkout ${INPUT_FEDERATOR_BRANCH} chmod +x ./configure.sh && chmod +x gradlew -./configure_gradle_federator.sh +FED_VERSION=$(bash configure_gradle_federator.sh) +echo "FED_VERSION=$FED_VERSION" ./configure.sh ./gradlew --info --no-daemon clean build -x test @@ -31,13 +27,24 @@ mv configure_rit_locally.sh rit mv regtest.js rit/config/regtest.js mv /usr/src/logbacks/* /usr/src/rit/logbacks/ cd rit +git checkout ${INPUT_RIT_BRANCH} chmod +x ./configure.sh ./configure.sh -./configure_rit_locally.sh "$FED_VERSION" +./configure_rit_locally.sh "${FED_VERSION}" +export LOG_LEVEL=${INPUT_RIT_LOG_LEVEL} echo -e "\n\n--------- Executing Rootstock Integration Tests ---------\n\n" npm install -y npm run test-fail-fast - -# Keep the container running -tail -f /dev/null +STATUS=$? + +echo -e "\n\n--------- RIT Tests Result ---------\n\n" +if [ $STATUS -ne 0 ]; then + MESSAGE="Rootstock Integration Tests Status: FAILED" +else + MESSAGE="Rootstock Integration Tests Status: PASSED" +fi +echo -e "$MESSAGE" + +echo "status=${STATUS}" >>${GITHUB_OUTPUT} +echo "message=${MESSAGE}" >> ${GITHUB_OUTPUT} diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-1.xml b/.github/images/rit-local-configs/logbacks/logback-fed-1.xml index 0f562cb9..d509ed15 100644 --- a/.github/images/rit-local-configs/logbacks/logback-fed-1.xml +++ b/.github/images/rit-local-configs/logbacks/logback-fed-1.xml @@ -22,7 +22,7 @@ - /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-1.log + /usr/src/logs/rsk-fed-1.log %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n @@ -111,4 +111,3 @@ - diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-2.xml b/.github/images/rit-local-configs/logbacks/logback-fed-2.xml index 509b62ad..ac2ebe06 100644 --- a/.github/images/rit-local-configs/logbacks/logback-fed-2.xml +++ b/.github/images/rit-local-configs/logbacks/logback-fed-2.xml @@ -22,7 +22,7 @@ - /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-2.log + /usr/src/logs/rsk-fed-2.log %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n @@ -111,4 +111,3 @@ - diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-3.xml b/.github/images/rit-local-configs/logbacks/logback-fed-3.xml index 9fd82fc0..eaf28053 100644 --- a/.github/images/rit-local-configs/logbacks/logback-fed-3.xml +++ b/.github/images/rit-local-configs/logbacks/logback-fed-3.xml @@ -22,7 +22,7 @@ - /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-3.log + /usr/src/logs/rsk-fed-3.log %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n @@ -111,4 +111,3 @@ - diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-4.xml b/.github/images/rit-local-configs/logbacks/logback-fed-4.xml index c6ca2443..2857427c 100644 --- a/.github/images/rit-local-configs/logbacks/logback-fed-4.xml +++ b/.github/images/rit-local-configs/logbacks/logback-fed-4.xml @@ -22,7 +22,7 @@ - /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-4.log + /usr/src/logs/rsk-fed-4.log %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n @@ -111,4 +111,3 @@ - diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-5.xml b/.github/images/rit-local-configs/logbacks/logback-fed-5.xml index 6936f610..e9d92af0 100644 --- a/.github/images/rit-local-configs/logbacks/logback-fed-5.xml +++ b/.github/images/rit-local-configs/logbacks/logback-fed-5.xml @@ -22,7 +22,7 @@ - /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-5.log + /usr/src/logs/rsk-fed-5.log %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n @@ -111,4 +111,3 @@ - diff --git a/.github/images/rit-local-configs/regtest-all-keys.js b/.github/images/rit-local-configs/regtest-all-keys.js index a9d45f99..20a62915 100644 --- a/.github/images/rit-local-configs/regtest-all-keys.js +++ b/.github/images/rit-local-configs/regtest-all-keys.js @@ -2,7 +2,7 @@ const path = require('path'); const nodesConfigPath = 'config/node-configs'; const keysPathResolve = 'node-keys'; const classpath = process.env.POWPEG_NODE_JAR_PATH; -const federatesLogbackPath = path.resolve(__dirname, 'logback'); +const federatesLogbackPath = path.resolve(__dirname, 'logbacks'); module.exports = { init: { @@ -113,4 +113,4 @@ module.exports = { nodeId: '6bb9eab797eadc8b697f0e82a01d01cabbfaaca37e5bafc06fdc6fdd38af894a9a8cbaf526d344b5df39b80433609e006586050fd2188d30ab000b0fb6a6baaf' } ] -} \ No newline at end of file +} diff --git a/.github/images/scripts/configure_gradle_federator.sh b/.github/images/scripts/configure_gradle_federator.sh index e471e309..0c7d3925 100755 --- a/.github/images/scripts/configure_gradle_federator.sh +++ b/.github/images/scripts/configure_gradle_federator.sh @@ -40,6 +40,4 @@ echo "$FED_VERSION" if [[ $FED_VERSION == SNAPSHOT* || $FED_VERSION == RC* ]]; then echo -e "$SETTINGS_GRADLE_CONTENT_LOCAL" > DONT-COMMIT-settings.gradle -else - echo "Settings gradle script local not necessary" -fi \ No newline at end of file +fi diff --git a/.github/images/scripts/configure_rit_locally.sh b/.github/images/scripts/configure_rit_locally.sh index 0a594bda..444d7d63 100755 --- a/.github/images/scripts/configure_rit_locally.sh +++ b/.github/images/scripts/configure_rit_locally.sh @@ -9,10 +9,9 @@ CONFIG_FILE=/usr/src/rit/config/regtest.js LOG_HOME=/usr/src/rit/logs BITCOIND_BIN_PATH=/usr/local/bin/bitcoind BITCOIN_DATA_DIR=/usr/src/bitcoindata +WAIT_FOR_BLOCK_ATTEMPT_TIME_MILLIS=600 +WAIT_FOR_BLOCK_MAX_ATTEMPTS=1000 EOF echo -e "\n\n---------- Configuring RIT to run the tests locally -----------\n\n" echo -e "$SETTINGS_RIT" > .env - - - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..15a39357 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,104 @@ +name: RIT Action Continuous Integration Test + +on: + pull_request: + push: + branches: + - main + +permissions: + contents: read + packages: write +env: + TEST_TAG: ${{ github.event.repository.name }}/rit:test + LATEST_TAG: ghcr.io/rsksmart/${{ github.event.repository.name }}/rit + +jobs: + build-push-rit-action-image: + name: Test RIT Action docker image + runs-on: ubuntu-latest + timeout-minutes: 60 + + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v4 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.LATEST_TAG }} + ${{ env.TEST_TAG }} + + - name: Setup Docker BuildX + id: setup-buildx + uses: docker/setup-buildx-action@v3 + with: + install: true + driver-opts: network=host + platforms: linux/amd64 + + - name: Build and export locally Docker + uses: docker/build-push-action@v6 + with: + context: .github/images + load: true + tags: ${{ env.TEST_TAG }} + + - name: Test the RIT Container Action + id: test-container + run: | + docker run \ + --env RSKJ_BRANCH="master" \ + --env FEDERATOR_BRANCH="master" \ + --env "GITHUB_OUTPUT=/github-output" \ + -v "$GITHUB_OUTPUT:/github-output" \ + --rm ${{ env.TEST_TAG }} + + - name: Build the RIT Action Container Image + uses: docker/build-push-action@v6 + with: + context: .github/images + tags: ${{ env.LATEST_TAG }} + labels: ${{ steps.meta.outputs.labels }} + load: true + + - name: GitHub container registry login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push Images + run: | + docker push ${{ env.LATEST_TAG }} + + test-rit-action: + needs: build-push-rit-action-image + name: GitHub Actions Test + runs-on: ubuntu-latest + timeout-minutes: 60 + + steps: + - name: GitHub container registry login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} +# + - name: Test RIT Action + id: test-rit-action + uses: docker://ghcr.io/rsksmart/rootstock-integration-tests/rit:latest + with: + rskj-branch: master + federator-branch: master + + - name: Print RIT Status and Message + id: output + run: | + echo "RIT Status = ${{ steps.test-rit-action.outputs.status }}" + echo "RIT Message = ${{ steps.test-rit-action.outputs.message }}" diff --git a/.gitignore b/.gitignore index 0be0603a..14024e55 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,4 @@ config/*.js **/*.bip39 logs .env -.DS_Store -.idea/ -.secrets +.DS_Store \ No newline at end of file diff --git a/lib/rsk-utils-legacy.js b/lib/rsk-utils-legacy.js index 4639d610..ea78023b 100644 --- a/lib/rsk-utils-legacy.js +++ b/lib/rsk-utils-legacy.js @@ -2,6 +2,8 @@ const expect = require('chai').expect; const btcClientProvider = require('./btc-client-provider'); const { sequentialPromise, wait, interval } = require('./utils'); const { getBridgeAbi, getLatestActiveForkName } = require('./precompiled-abi-forks-util'); +const waitForBlockAttemptTimeMillis = process.env.WAIT_FOR_BLOCK_ATTEMPT_TIME_MILLIS || 200 +const waitForBlockMaxAttempts = process.env. WAIT_FOR_BLOCK_MAX_ATTEMPTS || 160; var getMaxBlockNumber = (rskClients) => { var maxBlockNumber; @@ -26,7 +28,7 @@ var waitForSync = (rskClients) => { }); }; -var waitForBlock = (rskClient, blockNumber, waitTime = 200, maxAttempts = 600) => { +var waitForBlock = (rskClient, blockNumber, waitTime = waitForBlockAttemptTimeMillis, maxAttempts = waitForBlockMaxAttempts) => { return new Promise((resolve, reject) => { var clearPoll; var attempts = 0; From 57457ee1d4085dd806604aab986c5e8d2135e608 Mon Sep 17 00:00:00 2001 From: fmacleal <157636304+fmacleal@users.noreply.github.com> Date: Tue, 16 Jul 2024 09:23:54 +0200 Subject: [PATCH 04/19] Update lib/rsk-utils-legacy.js Co-authored-by: Lucas <39061310+lucasvuotto@users.noreply.github.com> --- lib/rsk-utils-legacy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rsk-utils-legacy.js b/lib/rsk-utils-legacy.js index ea78023b..7c7d33b5 100644 --- a/lib/rsk-utils-legacy.js +++ b/lib/rsk-utils-legacy.js @@ -2,7 +2,7 @@ const expect = require('chai').expect; const btcClientProvider = require('./btc-client-provider'); const { sequentialPromise, wait, interval } = require('./utils'); const { getBridgeAbi, getLatestActiveForkName } = require('./precompiled-abi-forks-util'); -const waitForBlockAttemptTimeMillis = process.env.WAIT_FOR_BLOCK_ATTEMPT_TIME_MILLIS || 200 +const waitForBlockAttemptTimeMillis = process.env.WAIT_FOR_BLOCK_ATTEMPT_TIME_MILLIS || 200; const waitForBlockMaxAttempts = process.env. WAIT_FOR_BLOCK_MAX_ATTEMPTS || 160; var getMaxBlockNumber = (rskClients) => { From 7b7fe86749ec3e4fc30d89ab75a58702da0f482b Mon Sep 17 00:00:00 2001 From: fmacleal Date: Tue, 16 Jul 2024 14:26:12 +0200 Subject: [PATCH 05/19] Updating the variables declaration to use let as sonar recommended --- lib/rsk-utils-legacy.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/rsk-utils-legacy.js b/lib/rsk-utils-legacy.js index 7c7d33b5..d3d72032 100644 --- a/lib/rsk-utils-legacy.js +++ b/lib/rsk-utils-legacy.js @@ -5,7 +5,7 @@ const { getBridgeAbi, getLatestActiveForkName } = require('./precompiled-abi-for const waitForBlockAttemptTimeMillis = process.env.WAIT_FOR_BLOCK_ATTEMPT_TIME_MILLIS || 200; const waitForBlockMaxAttempts = process.env. WAIT_FOR_BLOCK_MAX_ATTEMPTS || 160; -var getMaxBlockNumber = (rskClients) => { +let getMaxBlockNumber = (rskClients) => { var maxBlockNumber; var result = Promise.resolve(0); rskClients.forEach(client => { @@ -18,7 +18,7 @@ var getMaxBlockNumber = (rskClients) => { return result; }; -var waitForSync = (rskClients) => { +let waitForSync = (rskClients) => { return getMaxBlockNumber(rskClients).then(bn => { var result = Promise.resolve(); rskClients.forEach(client => { @@ -28,7 +28,7 @@ var waitForSync = (rskClients) => { }); }; -var waitForBlock = (rskClient, blockNumber, waitTime = waitForBlockAttemptTimeMillis, maxAttempts = waitForBlockMaxAttempts) => { +let waitForBlock = (rskClient, blockNumber, waitTime = waitForBlockAttemptTimeMillis, maxAttempts = waitForBlockMaxAttempts) => { return new Promise((resolve, reject) => { var clearPoll; var attempts = 0; @@ -53,7 +53,7 @@ var waitForBlock = (rskClient, blockNumber, waitTime = waitForBlockAttemptTimeMi }); }; -var sendTxWithCheck = (rskClient) => (method, check, fromAddress) => () => { +let sendTxWithCheck = (rskClient) => (method, check, fromAddress) => () => { var txReceiptPromise = method.call({ from: fromAddress }) .then(check) .then(() => method.estimateGas({ from: fromAddress })) @@ -90,18 +90,18 @@ var sendTxWithCheck = (rskClient) => (method, check, fromAddress) => () => { }); }; -var triggerRelease = async(rskClients, btcClient, releaseCreatedCallback, releaseConfirmedCallback) => { +let triggerRelease = async(rskClients, btcClient, releaseCreatedCallback, releaseConfirmedCallback) => { const mineFunction = (amountOfBlocks) => btcClient.generate(amountOfBlocks); await triggerReleaseWithMineFunction(rskClients, mineFunction, releaseCreatedCallback, releaseConfirmedCallback); }; -var triggerRelease2 = async(rskClients, releaseCreatedCallback, releaseConfirmedCallback) => { +let triggerRelease2 = async(rskClients, releaseCreatedCallback, releaseConfirmedCallback) => { const btcClient = btcClientProvider.getBtcClient(); const mineFunction = (amountOfBlocks) => btcClient.nodeClient.mine(amountOfBlocks); await triggerReleaseWithMineFunction(rskClients, mineFunction, releaseCreatedCallback, releaseConfirmedCallback); }; -var triggerPegoutEvent = async(rskClients, releaseCreatedCallback, releaseConfirmedCallback) => { +let triggerPegoutEvent = async(rskClients, releaseCreatedCallback, releaseConfirmedCallback) => { const isHop400AlreadyActive = await Runners.common.forks.hop400.isAlreadyActive(); if (isHop400AlreadyActive) { await increaseBlockToNextPegoutHeight(rskClients[0]); @@ -109,7 +109,7 @@ var triggerPegoutEvent = async(rskClients, releaseCreatedCallback, releaseConfir await triggerRelease2(rskClients, releaseCreatedCallback, releaseConfirmedCallback); }; -var triggerReleaseWithMineFunction = async(rskClients, mineFunction, releaseCreatedCallback, releaseConfirmedCallback) => { +let triggerReleaseWithMineFunction = async(rskClients, mineFunction, releaseCreatedCallback, releaseConfirmedCallback) => { var rskClient = rskClients[0]; // Sync all nodes @@ -160,7 +160,7 @@ var triggerReleaseWithMineFunction = async(rskClients, mineFunction, releaseCrea await wait(2500); }; -var sendFromCow = (rskClient) => (toAddress, amount) => { +let sendFromCow = (rskClient) => (toAddress, amount) => { var initialAddressBalance; var cowAddress; amount = Number(amount); @@ -229,7 +229,7 @@ const getBridgeEventInBlockAndRunAssertions = async(block, eventName, eventAsser return false; } -var getBridgeEventAndRunAssertions = (eventName, eventAssertions, rsk, maxPastBlocksToCheck) => async (rskClient, blocksDepth) => { +let getBridgeEventAndRunAssertions = (eventName, eventAssertions, rsk, maxPastBlocksToCheck) => async (rskClient, blocksDepth) => { var block = await rskClient.eth.getBlock("latest"); if (!!blocksDepth) { block = await rskClient.eth.getBlock(block.number - blocksDepth); @@ -247,7 +247,7 @@ var getBridgeEventAndRunAssertions = (eventName, eventAssertions, rsk, maxPastBl } } -var getTransactionHashFromTxToBridge = async (functionName, rsk, rskClient) => { +let getTransactionHashFromTxToBridge = async (functionName, rsk, rskClient) => { var abi = getBridgeAbi(); var block = await rskClient.eth.getBlock("latest"); var txs = block.transactions; From b1840efdbcf08892059f646ee8b5ccc7cf4c79c3 Mon Sep 17 00:00:00 2001 From: fmacleal Date: Tue, 16 Jul 2024 17:51:31 +0200 Subject: [PATCH 06/19] Applying some other suggestions from review --- .github/action.yml | 6 +++--- .github/workflows/ci.yml | 23 ++++++++++------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.github/action.yml b/.github/action.yml index 36d02fa3..66ccd453 100644 --- a/.github/action.yml +++ b/.github/action.yml @@ -7,8 +7,8 @@ inputs: description: 'The rskj branch to checkout' required: false default: 'master' - federator-branch: - description: 'The federate-node branch to checkout' + powpeg-node-branch: + description: 'The powpeg-node branch to checkout' required: false default: 'master' rit-branch: @@ -31,6 +31,6 @@ runs: image: ./images/Dockerfile env: RSKJ_BRANCH: ${{ inputs.rskj-branch }} - FEDERATOR_BRANCH: ${{ inputs.federator-branch }} + POWPEG_NODE_BRANCH: ${{ inputs.powpeg-node-branch }} RIT_BRANCH: ${{ inputs.rit-branch }} RIT_LOG_LEVEL: ${{ inputs.rit-log-level }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15a39357..a33b8066 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,14 +57,6 @@ jobs: -v "$GITHUB_OUTPUT:/github-output" \ --rm ${{ env.TEST_TAG }} - - name: Build the RIT Action Container Image - uses: docker/build-push-action@v6 - with: - context: .github/images - tags: ${{ env.LATEST_TAG }} - labels: ${{ steps.meta.outputs.labels }} - load: true - - name: GitHub container registry login uses: docker/login-action@v3 with: @@ -72,9 +64,14 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Push Images - run: | - docker push ${{ env.LATEST_TAG }} + - name: Build the RIT Action Container Image + uses: docker/build-push-action@v6 + with: + context: .github/images + tags: ${{ env.LATEST_TAG }} + labels: ${{ steps.meta.outputs.labels }} + load: true + push: true test-rit-action: needs: build-push-rit-action-image @@ -89,13 +86,13 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} -# + - name: Test RIT Action id: test-rit-action uses: docker://ghcr.io/rsksmart/rootstock-integration-tests/rit:latest with: rskj-branch: master - federator-branch: master + powpeg-node-branch: master - name: Print RIT Status and Message id: output From 5f87fd1763097d0bc7918aa28a5272e4ede38209 Mon Sep 17 00:00:00 2001 From: fmacleal <157636304+fmacleal@users.noreply.github.com> Date: Wed, 17 Jul 2024 12:01:24 +0200 Subject: [PATCH 07/19] Apply suggestions from code review Applying the enclosing ENV variables with double quotes suggestions Co-authored-by: Lucas <39061310+lucasvuotto@users.noreply.github.com> --- .github/images/entrypoint.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/images/entrypoint.sh b/.github/images/entrypoint.sh index 1e034d6c..13a1ab51 100644 --- a/.github/images/entrypoint.sh +++ b/.github/images/entrypoint.sh @@ -5,7 +5,7 @@ set -e echo -e "\n\n--------- Starting the configuration of rskj ---------\n\n" cd /usr/src/ git clone https://github.com/rsksmart/rskj.git rskj -cd rskj && git checkout ${INPUT_RSKJ_BRANCH} +cd rskj && git checkout "${INPUT_RSKJ_BRANCH}" chmod +x ./configure.sh && chmod +x gradlew ./configure.sh @@ -13,7 +13,7 @@ echo -e "\n\n--------- Starting the configuration of powpeg ---------\n\n" cd /usr/src/ git clone https://github.com/rsksmart/powpeg-node.git powpeg cp configure_gradle_federator.sh powpeg -cd powpeg && git checkout ${INPUT_FEDERATOR_BRANCH} +cd powpeg && git checkout "${INPUT_FEDERATOR_BRANCH}" chmod +x ./configure.sh && chmod +x gradlew FED_VERSION=$(bash configure_gradle_federator.sh) echo "FED_VERSION=$FED_VERSION" @@ -27,11 +27,11 @@ mv configure_rit_locally.sh rit mv regtest.js rit/config/regtest.js mv /usr/src/logbacks/* /usr/src/rit/logbacks/ cd rit -git checkout ${INPUT_RIT_BRANCH} +git checkout "${INPUT_RIT_BRANCH}" chmod +x ./configure.sh ./configure.sh ./configure_rit_locally.sh "${FED_VERSION}" -export LOG_LEVEL=${INPUT_RIT_LOG_LEVEL} +export LOG_LEVEL="${INPUT_RIT_LOG_LEVEL}" echo -e "\n\n--------- Executing Rootstock Integration Tests ---------\n\n" npm install -y @@ -46,5 +46,5 @@ else fi echo -e "$MESSAGE" -echo "status=${STATUS}" >>${GITHUB_OUTPUT} -echo "message=${MESSAGE}" >> ${GITHUB_OUTPUT} +echo "status=${STATUS}" >>"${GITHUB_OUTPUT}" +echo "message=${MESSAGE}" >>"${GITHUB_OUTPUT}" From 7d420822f01570aa34606eb4800e9297245f375e Mon Sep 17 00:00:00 2001 From: fmacleal Date: Wed, 17 Jul 2024 16:20:37 +0200 Subject: [PATCH 08/19] Applying some other suggestions from review - Refactored the name from federator to powpeg-node - Created a regular user to be used by the process - Created a first version of a README for the action - Added exit codes to the actions --- .github/README.md | 47 +++++++++++++++++++ .github/images/Dockerfile | 16 +++++-- .github/images/entrypoint.sh | 15 ++++-- ...ederator.sh => configure_gradle_powpeg.sh} | 3 +- .github/workflows/ci.yml | 2 +- .gitignore | 3 +- 6 files changed, 72 insertions(+), 14 deletions(-) create mode 100644 .github/README.md rename .github/images/scripts/{configure_gradle_federator.sh => configure_gradle_powpeg.sh} (99%) diff --git a/.github/README.md b/.github/README.md new file mode 100644 index 00000000..324b9adb --- /dev/null +++ b/.github/README.md @@ -0,0 +1,47 @@ +# Rootstock Integration Tests Action + +This action provides a containerized environment for running integration tests on Rootstock. +It receives as inputs the branches of powpeg, rskj and rootstock-integration-tests repositories, +checkout at the branches passed as parameters, build the projects and run the integration tests. + +The rootstock-integration-tests it's a project that tests the integration between rskj and powpeg-node, +it validates that the peg-in and peg-out processes are working correctly. It's extremely important to both projects, +and should be executed before any release of both projects or any merge to the master/main branch. + +## Inputs + +### `rskj-branch` + +**Optional** The rskj branch to checkout. Default is `master`. + +### `powpeg-node-branch` + +**Optional** The powpeg-node branch to checkout. Default is `master`. + +### `rit-branch` + +**Optional** The rootstock-integration-tests branch to checkout. Default is `main`. + +### `rit-log-level` + +**Optional** Log level for the rootstock-integration-tests. Default is `info`. + +## Outputs + +### `status` + +The status of the integration tests. + +### `message` + +The output message of the integration tests. + +## Example usage + +```yaml +uses: docker://ghcr.io/rsksmart/rootstock-integration-tests/rit:latest +with: + rskj-branch: master + powpeg-node-branch: master + rit-branch: main +``` \ No newline at end of file diff --git a/.github/images/Dockerfile b/.github/images/Dockerfile index 3ffddc6f..77dbce36 100644 --- a/.github/images/Dockerfile +++ b/.github/images/Dockerfile @@ -26,10 +26,9 @@ ENV JAVA_VERSION 11 RUN apt-get -y install "openjdk-$JAVA_VERSION-jdk" -ENV JAVA_HOME="/usr/lib/jvm/java-$JAVA_VERSION-openjdk-amd64" \ - PATH="$JAVA_HOME:$PATH" +ENV JAVA_HOME="/usr/lib/jvm/java-$JAVA_VERSION-openjdk-amd64" -RUN export JAVA_HOME=$JAVA_HOME \ +RUN export JAVA_HOME="$JAVA_HOME" \ && export PATH="$JAVA_HOME:$PATH" # -- bitcoind --------------------------------------------------------- @@ -42,6 +41,10 @@ RUN cd /tmp \ && rm -v /opt/bitcoin/bin/test_bitcoin /opt/bitcoin/bin/bitcoin-qt \ && ln -sv /opt/bitcoin/bin/* /usr/local/bin +# -- Create a non-root user and group -- +RUN groupadd -r rituser && useradd -r -g rituser -d /usr/src/ rituser +RUN mkdir -p /usr/src/ && chown -R rituser:rituser /usr/src/ + # -- configure entrypoint to run RIT-------------------------------------------- RUN mkdir -p /usr/src/logbacks @@ -54,11 +57,14 @@ COPY rit-local-configs/logbacks/* /usr/src/logbacks/ COPY scripts/* /usr/src/ RUN chmod +x /usr/src/entrypoint.sh \ - && chmod +x /usr/src/configure_gradle_federator.sh \ + && chmod +x /usr/src/configure_gradle_powpeg.sh \ && chmod +x /usr/src/configure_rit_locally.sh \ && mkdir -p /usr/src/bitcoindata \ && chmod -R 755 /usr/src/bitcoindata \ - && ls -la /usr/src + && chown -R rituser:rituser /usr/src/ + +# -- Switch to non-root user -- +USER rituser ENTRYPOINT ["/usr/src/entrypoint.sh"] diff --git a/.github/images/entrypoint.sh b/.github/images/entrypoint.sh index 13a1ab51..c01d12c2 100644 --- a/.github/images/entrypoint.sh +++ b/.github/images/entrypoint.sh @@ -12,11 +12,11 @@ chmod +x ./configure.sh && chmod +x gradlew echo -e "\n\n--------- Starting the configuration of powpeg ---------\n\n" cd /usr/src/ git clone https://github.com/rsksmart/powpeg-node.git powpeg -cp configure_gradle_federator.sh powpeg -cd powpeg && git checkout "${INPUT_FEDERATOR_BRANCH}" +cp configure_gradle_powpeg.sh powpeg +cd powpeg && git checkout "${INPUT_POWPEG_NODE_BRANCH}" chmod +x ./configure.sh && chmod +x gradlew -FED_VERSION=$(bash configure_gradle_federator.sh) -echo "FED_VERSION=$FED_VERSION" +POWPEG_VERSION=$(bash configure_gradle_powpeg.sh) +echo "POWPEG_VERSION=$POWPEG_VERSION" ./configure.sh ./gradlew --info --no-daemon clean build -x test @@ -30,7 +30,7 @@ cd rit git checkout "${INPUT_RIT_BRANCH}" chmod +x ./configure.sh ./configure.sh -./configure_rit_locally.sh "${FED_VERSION}" +./configure_rit_locally.sh "${POWPEG_VERSION}" export LOG_LEVEL="${INPUT_RIT_LOG_LEVEL}" echo -e "\n\n--------- Executing Rootstock Integration Tests ---------\n\n" @@ -48,3 +48,8 @@ echo -e "$MESSAGE" echo "status=${STATUS}" >>"${GITHUB_OUTPUT}" echo "message=${MESSAGE}" >>"${GITHUB_OUTPUT}" + +if [ $STATUS -ne 0 ]; then + exit 1 +fi +exit 0 \ No newline at end of file diff --git a/.github/images/scripts/configure_gradle_federator.sh b/.github/images/scripts/configure_gradle_powpeg.sh similarity index 99% rename from .github/images/scripts/configure_gradle_federator.sh rename to .github/images/scripts/configure_gradle_powpeg.sh index 0c7d3925..1baac99f 100755 --- a/.github/images/scripts/configure_gradle_federator.sh +++ b/.github/images/scripts/configure_gradle_powpeg.sh @@ -37,7 +37,6 @@ done < "src/main/resources/version.properties" # Concatenate modifier and versionNumber FED_VERSION="$modifier-$versionNumber" echo "$FED_VERSION" - if [[ $FED_VERSION == SNAPSHOT* || $FED_VERSION == RC* ]]; then echo -e "$SETTINGS_GRADLE_CONTENT_LOCAL" > DONT-COMMIT-settings.gradle -fi +fi \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a33b8066..9a6e7f72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,7 @@ jobs: run: | docker run \ --env RSKJ_BRANCH="master" \ - --env FEDERATOR_BRANCH="master" \ + --env POWPEG_NODE_BRANCH="master" \ --env "GITHUB_OUTPUT=/github-output" \ -v "$GITHUB_OUTPUT:/github-output" \ --rm ${{ env.TEST_TAG }} diff --git a/.gitignore b/.gitignore index 14024e55..af2e55a2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ config/*.js **/*.bip39 logs .env -.DS_Store \ No newline at end of file +.DS_Store +.idea/ \ No newline at end of file From a5e9087113463b9d574c4aaffda577ae3353abe2 Mon Sep 17 00:00:00 2001 From: fmacleal Date: Wed, 17 Jul 2024 16:27:00 +0200 Subject: [PATCH 09/19] Attempt to fix the action that isn't getting branch properly --- .github/images/entrypoint.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/images/entrypoint.sh b/.github/images/entrypoint.sh index c01d12c2..f19c0273 100644 --- a/.github/images/entrypoint.sh +++ b/.github/images/entrypoint.sh @@ -5,7 +5,7 @@ set -e echo -e "\n\n--------- Starting the configuration of rskj ---------\n\n" cd /usr/src/ git clone https://github.com/rsksmart/rskj.git rskj -cd rskj && git checkout "${INPUT_RSKJ_BRANCH}" +cd rskj && git checkout ${INPUT_RSKJ_BRANCH} chmod +x ./configure.sh && chmod +x gradlew ./configure.sh @@ -13,7 +13,7 @@ echo -e "\n\n--------- Starting the configuration of powpeg ---------\n\n" cd /usr/src/ git clone https://github.com/rsksmart/powpeg-node.git powpeg cp configure_gradle_powpeg.sh powpeg -cd powpeg && git checkout "${INPUT_POWPEG_NODE_BRANCH}" +cd powpeg && git checkout ${INPUT_POWPEG_NODE_BRANCH} chmod +x ./configure.sh && chmod +x gradlew POWPEG_VERSION=$(bash configure_gradle_powpeg.sh) echo "POWPEG_VERSION=$POWPEG_VERSION" @@ -27,11 +27,11 @@ mv configure_rit_locally.sh rit mv regtest.js rit/config/regtest.js mv /usr/src/logbacks/* /usr/src/rit/logbacks/ cd rit -git checkout "${INPUT_RIT_BRANCH}" +git checkout ${INPUT_RIT_BRANCH} chmod +x ./configure.sh ./configure.sh -./configure_rit_locally.sh "${POWPEG_VERSION}" -export LOG_LEVEL="${INPUT_RIT_LOG_LEVEL}" +./configure_rit_locally.sh ${POWPEG_VERSION} +export LOG_LEVEL=${INPUT_RIT_LOG_LEVEL} echo -e "\n\n--------- Executing Rootstock Integration Tests ---------\n\n" npm install -y @@ -46,8 +46,8 @@ else fi echo -e "$MESSAGE" -echo "status=${STATUS}" >>"${GITHUB_OUTPUT}" -echo "message=${MESSAGE}" >>"${GITHUB_OUTPUT}" +echo "status=${STATUS}" >> ${GITHUB_OUTPUT} +echo "message=${MESSAGE}" >> ${GITHUB_OUTPUT} if [ $STATUS -ne 0 ]; then exit 1 From d4d85e769e812b456c644915dae982dd1f254ba9 Mon Sep 17 00:00:00 2001 From: fmacleal Date: Wed, 17 Jul 2024 16:59:41 +0200 Subject: [PATCH 10/19] Fixing the script build again + Adding some info on the README --- .github/README.md | 9 +++++++-- .github/images/entrypoint.sh | 10 +++++----- .github/workflows/ci.yml | 6 ++++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/README.md b/.github/README.md index 324b9adb..21655e7c 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,12 +1,17 @@ # Rootstock Integration Tests Action This action provides a containerized environment for running integration tests on Rootstock. -It receives as inputs the branches of powpeg, rskj and rootstock-integration-tests repositories, +It receives as inputs the branches of `powpeg`, `rskj` and `rootstock-integration-tests` repositories, checkout at the branches passed as parameters, build the projects and run the integration tests. The rootstock-integration-tests it's a project that tests the integration between rskj and powpeg-node, it validates that the peg-in and peg-out processes are working correctly. It's extremely important to both projects, -and should be executed before any release of both projects or any merge to the master/main branch. +and should be executed before any release of both projects or any merge to the master/main branch. + +To achieve this and make this test more accessible, we created a container-action created to execute this test, +it offers the flexibility to run the tests with any specific tag or branch from *powpeg-node* or *rskj*. +That way, we will add steps on each repository to run the integration tests with the version that we want to test. +No matter if it's a tag, a branch or a specific commit. ## Inputs diff --git a/.github/images/entrypoint.sh b/.github/images/entrypoint.sh index f19c0273..3721cf58 100644 --- a/.github/images/entrypoint.sh +++ b/.github/images/entrypoint.sh @@ -5,7 +5,7 @@ set -e echo -e "\n\n--------- Starting the configuration of rskj ---------\n\n" cd /usr/src/ git clone https://github.com/rsksmart/rskj.git rskj -cd rskj && git checkout ${INPUT_RSKJ_BRANCH} +cd rskj && git checkout "${INPUT_RSKJ_BRANCH}" chmod +x ./configure.sh && chmod +x gradlew ./configure.sh @@ -13,7 +13,7 @@ echo -e "\n\n--------- Starting the configuration of powpeg ---------\n\n" cd /usr/src/ git clone https://github.com/rsksmart/powpeg-node.git powpeg cp configure_gradle_powpeg.sh powpeg -cd powpeg && git checkout ${INPUT_POWPEG_NODE_BRANCH} +cd powpeg && git checkout "${INPUT_POWPEG_NODE_BRANCH}" chmod +x ./configure.sh && chmod +x gradlew POWPEG_VERSION=$(bash configure_gradle_powpeg.sh) echo "POWPEG_VERSION=$POWPEG_VERSION" @@ -27,11 +27,11 @@ mv configure_rit_locally.sh rit mv regtest.js rit/config/regtest.js mv /usr/src/logbacks/* /usr/src/rit/logbacks/ cd rit -git checkout ${INPUT_RIT_BRANCH} +git checkout "${INPUT_RIT_BRANCH}" chmod +x ./configure.sh ./configure.sh -./configure_rit_locally.sh ${POWPEG_VERSION} -export LOG_LEVEL=${INPUT_RIT_LOG_LEVEL} +./configure_rit_locally.sh "${POWPEG_VERSION}" +export LOG_LEVEL="${INPUT_RIT_LOG_LEVEL}" echo -e "\n\n--------- Executing Rootstock Integration Tests ---------\n\n" npm install -y diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a6e7f72..876cb511 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,8 +51,10 @@ jobs: id: test-container run: | docker run \ - --env RSKJ_BRANCH="master" \ - --env POWPEG_NODE_BRANCH="master" \ + --env INPUT_RSKJ_BRANCH="master" \ + --env INPUT_POWPEG_NODE_BRANCH="master" \ + --env INPUT_RIT_BRANCH="main" \ + --env INPUT_RIT_LOG_LEVEL="info" \ --env "GITHUB_OUTPUT=/github-output" \ -v "$GITHUB_OUTPUT:/github-output" \ --rm ${{ env.TEST_TAG }} From a2a019b35416b217da441fc31a420c6cd235c977 Mon Sep 17 00:00:00 2001 From: fmacleal Date: Wed, 17 Jul 2024 17:56:03 +0200 Subject: [PATCH 11/19] Increasing the attempt and timeout to try to make the tes pass + Adding a final version of the README.md for the action --- .github/README.md | 19 +++++++++++++------ .github/action.yml | 4 ++-- .../images/scripts/configure_rit_locally.sh | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/README.md b/.github/README.md index 21655e7c..a52eada6 100644 --- a/.github/README.md +++ b/.github/README.md @@ -14,32 +14,39 @@ That way, we will add steps on each repository to run the integration tests with No matter if it's a tag, a branch or a specific commit. ## Inputs +By default, all the inputs are pointed to the `master/main` branch of the repositories. But, ideally, we will adapt +the action to receive the branches received to be the one in a branch or tag that we want to test. ### `rskj-branch` -**Optional** The rskj branch to checkout. Default is `master`. +The rskj branch to checkout. If no branch or tag passed, it will be used the default `master`. ### `powpeg-node-branch` -**Optional** The powpeg-node branch to checkout. Default is `master`. +The powpeg-node branch to checkout. If no branch or tag passed, it will be used the default `master`. ### `rit-branch` -**Optional** The rootstock-integration-tests branch to checkout. Default is `main`. +**Optional** The rootstock-integration-tests branch to checkout. This one it's optional, because it will be +very unlikely that we need to use a different branch for the rootstock-integration-test. It's offered the possibility +to use a different one, but the default and most frequently used, should be `main`. ### `rit-log-level` **Optional** Log level for the rootstock-integration-tests. Default is `info`. ## Outputs - +The output of the action are basically two values, one is the status of the integration tests, and the other is the message. +I ### `status` -The status of the integration tests. +The status of the integration tests. It would be `0` for success and `1` for failure. ### `message` -The output message of the integration tests. +The output message of the integration tests. It will be: +- In case of success: `Rootstock Integration Tests Status: PASSED` +- In case of error: `Rootstock Integration Tests Status: FAILED` ## Example usage diff --git a/.github/action.yml b/.github/action.yml index 66ccd453..37811e8e 100644 --- a/.github/action.yml +++ b/.github/action.yml @@ -5,11 +5,11 @@ author: 'Rootstock Labs' inputs: rskj-branch: description: 'The rskj branch to checkout' - required: false + required: true default: 'master' powpeg-node-branch: description: 'The powpeg-node branch to checkout' - required: false + required: true default: 'master' rit-branch: description: 'The rootstock-integration-tests branch to checkout' diff --git a/.github/images/scripts/configure_rit_locally.sh b/.github/images/scripts/configure_rit_locally.sh index 444d7d63..63308bd0 100755 --- a/.github/images/scripts/configure_rit_locally.sh +++ b/.github/images/scripts/configure_rit_locally.sh @@ -9,8 +9,8 @@ CONFIG_FILE=/usr/src/rit/config/regtest.js LOG_HOME=/usr/src/rit/logs BITCOIND_BIN_PATH=/usr/local/bin/bitcoind BITCOIN_DATA_DIR=/usr/src/bitcoindata -WAIT_FOR_BLOCK_ATTEMPT_TIME_MILLIS=600 -WAIT_FOR_BLOCK_MAX_ATTEMPTS=1000 +WAIT_FOR_BLOCK_ATTEMPT_TIME_MILLIS=800 +WAIT_FOR_BLOCK_MAX_ATTEMPTS=1200 EOF echo -e "\n\n---------- Configuring RIT to run the tests locally -----------\n\n" From b466a8e9a608975fa8f6b5b9aa70a9095b43b692 Mon Sep 17 00:00:00 2001 From: fmacleal Date: Wed, 17 Jul 2024 18:28:14 +0200 Subject: [PATCH 12/19] Trying to fix the output to GITHUB_OUTPUT --- .github/images/Dockerfile | 12 ++---------- .github/images/entrypoint.sh | 4 ++-- .github/workflows/ci.yml | 2 +- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/images/Dockerfile b/.github/images/Dockerfile index 77dbce36..46c6ea90 100644 --- a/.github/images/Dockerfile +++ b/.github/images/Dockerfile @@ -4,7 +4,7 @@ LABEL Description="Custom RSK node image to execute Rootstock Integration Tests" RUN apt-get update \ && apt-get install -y --no-install-recommends \ - wget gnupg2 curl git ca-certificates mocha \ + wget gnupg2 curl git ca-certificates mocha \ && apt clean # -- nodeJs --------------------------------------------------------- @@ -41,10 +41,6 @@ RUN cd /tmp \ && rm -v /opt/bitcoin/bin/test_bitcoin /opt/bitcoin/bin/bitcoin-qt \ && ln -sv /opt/bitcoin/bin/* /usr/local/bin -# -- Create a non-root user and group -- -RUN groupadd -r rituser && useradd -r -g rituser -d /usr/src/ rituser -RUN mkdir -p /usr/src/ && chown -R rituser:rituser /usr/src/ - # -- configure entrypoint to run RIT-------------------------------------------- RUN mkdir -p /usr/src/logbacks @@ -60,11 +56,7 @@ RUN chmod +x /usr/src/entrypoint.sh \ && chmod +x /usr/src/configure_gradle_powpeg.sh \ && chmod +x /usr/src/configure_rit_locally.sh \ && mkdir -p /usr/src/bitcoindata \ - && chmod -R 755 /usr/src/bitcoindata \ - && chown -R rituser:rituser /usr/src/ - -# -- Switch to non-root user -- -USER rituser + && chmod -R 755 /usr/src/bitcoindata ENTRYPOINT ["/usr/src/entrypoint.sh"] diff --git a/.github/images/entrypoint.sh b/.github/images/entrypoint.sh index 3721cf58..1c4216dd 100644 --- a/.github/images/entrypoint.sh +++ b/.github/images/entrypoint.sh @@ -46,8 +46,8 @@ else fi echo -e "$MESSAGE" -echo "status=${STATUS}" >> ${GITHUB_OUTPUT} -echo "message=${MESSAGE}" >> ${GITHUB_OUTPUT} +echo "status=${STATUS}" >> "${GITHUB_OUTPUT}" +echo "message=${MESSAGE}" >> "${GITHUB_OUTPUT}" if [ $STATUS -ne 0 ]; then exit 1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 876cb511..885cdb57 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: --env INPUT_POWPEG_NODE_BRANCH="master" \ --env INPUT_RIT_BRANCH="main" \ --env INPUT_RIT_LOG_LEVEL="info" \ - --env "GITHUB_OUTPUT=/github-output" \ + --env GITHUB_OUTPUT="/github-output" \ -v "$GITHUB_OUTPUT:/github-output" \ --rm ${{ env.TEST_TAG }} From d92cd9cb3d49dee338367b7919c058f0440c52af Mon Sep 17 00:00:00 2001 From: fmacleal Date: Thu, 18 Jul 2024 17:06:02 +0200 Subject: [PATCH 13/19] Fixing inputs on the test step --- .github/action.yml | 8 ++--- .github/{images => image}/Dockerfile | 0 .github/{images => image}/entrypoint.sh | 24 +++++++++---- .../logbacks/logback-fed-1.xml | 0 .../logbacks/logback-fed-2.xml | 0 .../logbacks/logback-fed-3.xml | 0 .../logbacks/logback-fed-4.xml | 0 .../logbacks/logback-fed-5.xml | 0 .../rit-local-configs/regtest-all-keys.js | 0 .../scripts/configure_gradle_powpeg.sh | 0 .../scripts/configure_rit_locally.sh | 0 .github/workflows/ci.yml | 36 ++++++++++--------- 12 files changed, 40 insertions(+), 28 deletions(-) rename .github/{images => image}/Dockerfile (100%) rename .github/{images => image}/entrypoint.sh (70%) rename .github/{images => image}/rit-local-configs/logbacks/logback-fed-1.xml (100%) rename .github/{images => image}/rit-local-configs/logbacks/logback-fed-2.xml (100%) rename .github/{images => image}/rit-local-configs/logbacks/logback-fed-3.xml (100%) rename .github/{images => image}/rit-local-configs/logbacks/logback-fed-4.xml (100%) rename .github/{images => image}/rit-local-configs/logbacks/logback-fed-5.xml (100%) rename .github/{images => image}/rit-local-configs/regtest-all-keys.js (100%) rename .github/{images => image}/scripts/configure_gradle_powpeg.sh (100%) rename .github/{images => image}/scripts/configure_rit_locally.sh (100%) diff --git a/.github/action.yml b/.github/action.yml index 37811e8e..298ca755 100644 --- a/.github/action.yml +++ b/.github/action.yml @@ -30,7 +30,7 @@ runs: using: docker image: ./images/Dockerfile env: - RSKJ_BRANCH: ${{ inputs.rskj-branch }} - POWPEG_NODE_BRANCH: ${{ inputs.powpeg-node-branch }} - RIT_BRANCH: ${{ inputs.rit-branch }} - RIT_LOG_LEVEL: ${{ inputs.rit-log-level }} + INPUT_RSKJ_BRANCH: ${{ inputs.rskj-branch }} + INPUT_POWPEG_NODE_BRANCH: ${{ inputs.powpeg-node-branch }} + INPUT_RIT_BRANCH: ${{ inputs.rit-branch }} + INPUT_RIT_LOG_LEVEL: ${{ inputs.rit-log-level }} diff --git a/.github/images/Dockerfile b/.github/image/Dockerfile similarity index 100% rename from .github/images/Dockerfile rename to .github/image/Dockerfile diff --git a/.github/images/entrypoint.sh b/.github/image/entrypoint.sh similarity index 70% rename from .github/images/entrypoint.sh rename to .github/image/entrypoint.sh index 1c4216dd..b9a1c551 100644 --- a/.github/images/entrypoint.sh +++ b/.github/image/entrypoint.sh @@ -1,11 +1,21 @@ -#!/bin/bash +#!/bin/sh -l set -e +RSKJ_BRANCH="${INPUT_RSKJ_BRANCH}" +POWPEG_NODE_BRANCH="${INPUT_POWPEG_NODE_BRANCH}" +RIT_BRANCH="${INPUT_RIT_BRANCH}" +LOG_LEVEL="${INPUT_RIT_LOG_LEVEL}" + +echo -e "\n\n--------- Input parameters received ---------\n\n" +echo "RSKJ_BRANCH=$RSKJ_BRANCH" +echo "POWPEG_NODE_BRANCH=$POWPEG_NODE_BRANCH" +echo "RIT_BRANCH=$RIT_BRANCH" +echo "LOG_LEVEL=$LOG_LEVEL" echo -e "\n\n--------- Starting the configuration of rskj ---------\n\n" cd /usr/src/ git clone https://github.com/rsksmart/rskj.git rskj -cd rskj && git checkout "${INPUT_RSKJ_BRANCH}" +cd rskj && git checkout "$RSKJ_BRANCH" chmod +x ./configure.sh && chmod +x gradlew ./configure.sh @@ -13,12 +23,12 @@ echo -e "\n\n--------- Starting the configuration of powpeg ---------\n\n" cd /usr/src/ git clone https://github.com/rsksmart/powpeg-node.git powpeg cp configure_gradle_powpeg.sh powpeg -cd powpeg && git checkout "${INPUT_POWPEG_NODE_BRANCH}" +cd powpeg && git checkout "$POWPEG_NODE_BRANCH" chmod +x ./configure.sh && chmod +x gradlew POWPEG_VERSION=$(bash configure_gradle_powpeg.sh) echo "POWPEG_VERSION=$POWPEG_VERSION" ./configure.sh -./gradlew --info --no-daemon clean build -x test +#./gradlew --info --no-daemon clean build -x test echo -e "\n\n--------- Starting the configuration of RIT ---------\n\n" cd /usr/src/ @@ -27,15 +37,15 @@ mv configure_rit_locally.sh rit mv regtest.js rit/config/regtest.js mv /usr/src/logbacks/* /usr/src/rit/logbacks/ cd rit -git checkout "${INPUT_RIT_BRANCH}" +git checkout "$RIT_BRANCH" chmod +x ./configure.sh ./configure.sh ./configure_rit_locally.sh "${POWPEG_VERSION}" -export LOG_LEVEL="${INPUT_RIT_LOG_LEVEL}" +export LOG_LEVEL="$LOG_LEVEL" echo -e "\n\n--------- Executing Rootstock Integration Tests ---------\n\n" npm install -y -npm run test-fail-fast +#npm run test-fail-fast STATUS=$? echo -e "\n\n--------- RIT Tests Result ---------\n\n" diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-1.xml b/.github/image/rit-local-configs/logbacks/logback-fed-1.xml similarity index 100% rename from .github/images/rit-local-configs/logbacks/logback-fed-1.xml rename to .github/image/rit-local-configs/logbacks/logback-fed-1.xml diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-2.xml b/.github/image/rit-local-configs/logbacks/logback-fed-2.xml similarity index 100% rename from .github/images/rit-local-configs/logbacks/logback-fed-2.xml rename to .github/image/rit-local-configs/logbacks/logback-fed-2.xml diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-3.xml b/.github/image/rit-local-configs/logbacks/logback-fed-3.xml similarity index 100% rename from .github/images/rit-local-configs/logbacks/logback-fed-3.xml rename to .github/image/rit-local-configs/logbacks/logback-fed-3.xml diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-4.xml b/.github/image/rit-local-configs/logbacks/logback-fed-4.xml similarity index 100% rename from .github/images/rit-local-configs/logbacks/logback-fed-4.xml rename to .github/image/rit-local-configs/logbacks/logback-fed-4.xml diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-5.xml b/.github/image/rit-local-configs/logbacks/logback-fed-5.xml similarity index 100% rename from .github/images/rit-local-configs/logbacks/logback-fed-5.xml rename to .github/image/rit-local-configs/logbacks/logback-fed-5.xml diff --git a/.github/images/rit-local-configs/regtest-all-keys.js b/.github/image/rit-local-configs/regtest-all-keys.js similarity index 100% rename from .github/images/rit-local-configs/regtest-all-keys.js rename to .github/image/rit-local-configs/regtest-all-keys.js diff --git a/.github/images/scripts/configure_gradle_powpeg.sh b/.github/image/scripts/configure_gradle_powpeg.sh similarity index 100% rename from .github/images/scripts/configure_gradle_powpeg.sh rename to .github/image/scripts/configure_gradle_powpeg.sh diff --git a/.github/images/scripts/configure_rit_locally.sh b/.github/image/scripts/configure_rit_locally.sh similarity index 100% rename from .github/images/scripts/configure_rit_locally.sh rename to .github/image/scripts/configure_rit_locally.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 885cdb57..494627d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,21 +43,26 @@ jobs: - name: Build and export locally Docker uses: docker/build-push-action@v6 with: - context: .github/images + context: .github/image load: true tags: ${{ env.TEST_TAG }} - name: Test the RIT Container Action id: test-container + env: + INPUT_RSKJ_BRANCH: master + INPUT_POWPEG_NODE_BRANCH: master + INPUT_RIT_BRANCH: main + INPUT_RIT_LOG_LEVEL: info run: | - docker run \ - --env INPUT_RSKJ_BRANCH="master" \ - --env INPUT_POWPEG_NODE_BRANCH="master" \ - --env INPUT_RIT_BRANCH="main" \ - --env INPUT_RIT_LOG_LEVEL="info" \ - --env GITHUB_OUTPUT="/github-output" \ - -v "$GITHUB_OUTPUT:/github-output" \ - --rm ${{ env.TEST_TAG }} + docker run \ + --env GITHUB_OUTPUT="/github-output" \ + --env INPUT_RSKJ_BRANCH="${{ env.INPUT_RSKJ_BRANCH }}" \ + --env INPUT_POWPEG_NODE_BRANCH="${{ env.INPUT_POWPEG_NODE_BRANCH }}" \ + --env INPUT_RIT_BRANCH="${{ env.INPUT_RIT_BRANCH }}" \ + --env INPUT_RIT_LOG_LEVEL="${{ env.INPUT_RIT_LOG_LEVEL }}" \ + -v "$GITHUB_OUTPUT:/github-output" \ + --rm ${{ env.TEST_TAG }} - name: GitHub container registry login uses: docker/login-action@v3 @@ -69,7 +74,7 @@ jobs: - name: Build the RIT Action Container Image uses: docker/build-push-action@v6 with: - context: .github/images + context: .github/image tags: ${{ env.LATEST_TAG }} labels: ${{ steps.meta.outputs.labels }} load: true @@ -82,16 +87,13 @@ jobs: timeout-minutes: 60 steps: - - name: GitHub container registry login - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout + id: checkout + uses: actions/checkout@v4 - name: Test RIT Action id: test-rit-action - uses: docker://ghcr.io/rsksmart/rootstock-integration-tests/rit:latest + uses: .github/ with: rskj-branch: master powpeg-node-branch: master From fdde43e833bc2efdc7b8447d406d1a14ea825d7b Mon Sep 17 00:00:00 2001 From: fmacleal Date: Fri, 19 Jul 2024 19:59:55 +0200 Subject: [PATCH 14/19] Fixing inputs on the test step --- .github/workflows/ci.yml | 12 ++++++------ {.github/image => container-action}/Dockerfile | 0 {.github => container-action}/README.md | 2 +- {.github => container-action}/action.yml | 2 +- {.github/image => container-action}/entrypoint.sh | 4 ++-- .../rit-local-configs/logbacks/logback-fed-1.xml | 0 .../rit-local-configs/logbacks/logback-fed-2.xml | 0 .../rit-local-configs/logbacks/logback-fed-3.xml | 0 .../rit-local-configs/logbacks/logback-fed-4.xml | 0 .../rit-local-configs/logbacks/logback-fed-5.xml | 0 .../rit-local-configs/regtest-all-keys.js | 0 .../scripts/configure_gradle_powpeg.sh | 0 .../scripts/configure_rit_locally.sh | 0 13 files changed, 10 insertions(+), 10 deletions(-) rename {.github/image => container-action}/Dockerfile (100%) rename {.github => container-action}/README.md (97%) rename {.github => container-action}/action.yml (97%) rename {.github/image => container-action}/entrypoint.sh (96%) rename {.github/image => container-action}/rit-local-configs/logbacks/logback-fed-1.xml (100%) rename {.github/image => container-action}/rit-local-configs/logbacks/logback-fed-2.xml (100%) rename {.github/image => container-action}/rit-local-configs/logbacks/logback-fed-3.xml (100%) rename {.github/image => container-action}/rit-local-configs/logbacks/logback-fed-4.xml (100%) rename {.github/image => container-action}/rit-local-configs/logbacks/logback-fed-5.xml (100%) rename {.github/image => container-action}/rit-local-configs/regtest-all-keys.js (100%) rename {.github/image => container-action}/scripts/configure_gradle_powpeg.sh (100%) rename {.github/image => container-action}/scripts/configure_rit_locally.sh (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 494627d3..d5871c28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,8 @@ env: LATEST_TAG: ghcr.io/rsksmart/${{ github.event.repository.name }}/rit jobs: - build-push-rit-action-image: - name: Test RIT Action docker image + build-push-rit-action-container-action: + name: Test RIT Action docker container-action runs-on: ubuntu-latest timeout-minutes: 60 @@ -43,7 +43,7 @@ jobs: - name: Build and export locally Docker uses: docker/build-push-action@v6 with: - context: .github/image + context: container-action/ load: true tags: ${{ env.TEST_TAG }} @@ -74,14 +74,14 @@ jobs: - name: Build the RIT Action Container Image uses: docker/build-push-action@v6 with: - context: .github/image + context: container-action/ tags: ${{ env.LATEST_TAG }} labels: ${{ steps.meta.outputs.labels }} load: true push: true test-rit-action: - needs: build-push-rit-action-image + needs: build-push-rit-action-container-action name: GitHub Actions Test runs-on: ubuntu-latest timeout-minutes: 60 @@ -93,7 +93,7 @@ jobs: - name: Test RIT Action id: test-rit-action - uses: .github/ + uses: ./container-action/ with: rskj-branch: master powpeg-node-branch: master diff --git a/.github/image/Dockerfile b/container-action/Dockerfile similarity index 100% rename from .github/image/Dockerfile rename to container-action/Dockerfile diff --git a/.github/README.md b/container-action/README.md similarity index 97% rename from .github/README.md rename to container-action/README.md index a52eada6..16d6fb04 100644 --- a/.github/README.md +++ b/container-action/README.md @@ -51,7 +51,7 @@ The output message of the integration tests. It will be: ## Example usage ```yaml -uses: docker://ghcr.io/rsksmart/rootstock-integration-tests/rit:latest +uses: rootstock-integration-tests@v1 with: rskj-branch: master powpeg-node-branch: master diff --git a/.github/action.yml b/container-action/action.yml similarity index 97% rename from .github/action.yml rename to container-action/action.yml index 298ca755..657b65ea 100644 --- a/.github/action.yml +++ b/container-action/action.yml @@ -28,7 +28,7 @@ outputs: runs: using: docker - image: ./images/Dockerfile + image: Dockerfile env: INPUT_RSKJ_BRANCH: ${{ inputs.rskj-branch }} INPUT_POWPEG_NODE_BRANCH: ${{ inputs.powpeg-node-branch }} diff --git a/.github/image/entrypoint.sh b/container-action/entrypoint.sh similarity index 96% rename from .github/image/entrypoint.sh rename to container-action/entrypoint.sh index b9a1c551..1003f44d 100644 --- a/.github/image/entrypoint.sh +++ b/container-action/entrypoint.sh @@ -28,7 +28,7 @@ chmod +x ./configure.sh && chmod +x gradlew POWPEG_VERSION=$(bash configure_gradle_powpeg.sh) echo "POWPEG_VERSION=$POWPEG_VERSION" ./configure.sh -#./gradlew --info --no-daemon clean build -x test +./gradlew --info --no-daemon clean build -x test echo -e "\n\n--------- Starting the configuration of RIT ---------\n\n" cd /usr/src/ @@ -45,7 +45,7 @@ export LOG_LEVEL="$LOG_LEVEL" echo -e "\n\n--------- Executing Rootstock Integration Tests ---------\n\n" npm install -y -#npm run test-fail-fast +npm run test-fail-fast STATUS=$? echo -e "\n\n--------- RIT Tests Result ---------\n\n" diff --git a/.github/image/rit-local-configs/logbacks/logback-fed-1.xml b/container-action/rit-local-configs/logbacks/logback-fed-1.xml similarity index 100% rename from .github/image/rit-local-configs/logbacks/logback-fed-1.xml rename to container-action/rit-local-configs/logbacks/logback-fed-1.xml diff --git a/.github/image/rit-local-configs/logbacks/logback-fed-2.xml b/container-action/rit-local-configs/logbacks/logback-fed-2.xml similarity index 100% rename from .github/image/rit-local-configs/logbacks/logback-fed-2.xml rename to container-action/rit-local-configs/logbacks/logback-fed-2.xml diff --git a/.github/image/rit-local-configs/logbacks/logback-fed-3.xml b/container-action/rit-local-configs/logbacks/logback-fed-3.xml similarity index 100% rename from .github/image/rit-local-configs/logbacks/logback-fed-3.xml rename to container-action/rit-local-configs/logbacks/logback-fed-3.xml diff --git a/.github/image/rit-local-configs/logbacks/logback-fed-4.xml b/container-action/rit-local-configs/logbacks/logback-fed-4.xml similarity index 100% rename from .github/image/rit-local-configs/logbacks/logback-fed-4.xml rename to container-action/rit-local-configs/logbacks/logback-fed-4.xml diff --git a/.github/image/rit-local-configs/logbacks/logback-fed-5.xml b/container-action/rit-local-configs/logbacks/logback-fed-5.xml similarity index 100% rename from .github/image/rit-local-configs/logbacks/logback-fed-5.xml rename to container-action/rit-local-configs/logbacks/logback-fed-5.xml diff --git a/.github/image/rit-local-configs/regtest-all-keys.js b/container-action/rit-local-configs/regtest-all-keys.js similarity index 100% rename from .github/image/rit-local-configs/regtest-all-keys.js rename to container-action/rit-local-configs/regtest-all-keys.js diff --git a/.github/image/scripts/configure_gradle_powpeg.sh b/container-action/scripts/configure_gradle_powpeg.sh similarity index 100% rename from .github/image/scripts/configure_gradle_powpeg.sh rename to container-action/scripts/configure_gradle_powpeg.sh diff --git a/.github/image/scripts/configure_rit_locally.sh b/container-action/scripts/configure_rit_locally.sh similarity index 100% rename from .github/image/scripts/configure_rit_locally.sh rename to container-action/scripts/configure_rit_locally.sh From 2cf5cd97eaecefebeb1e16ab65907f517f341b0d Mon Sep 17 00:00:00 2001 From: fmacleal <157636304+fmacleal@users.noreply.github.com> Date: Mon, 22 Jul 2024 16:25:49 +0200 Subject: [PATCH 15/19] Update container-action/scripts/configure_rit_locally.sh Applying suggestions from review Co-authored-by: Lucas <39061310+lucasvuotto@users.noreply.github.com> --- container-action/scripts/configure_rit_locally.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/container-action/scripts/configure_rit_locally.sh b/container-action/scripts/configure_rit_locally.sh index 63308bd0..5afc0687 100755 --- a/container-action/scripts/configure_rit_locally.sh +++ b/container-action/scripts/configure_rit_locally.sh @@ -1,6 +1,11 @@ #!/bin/bash -POWPEG_VERSION="${1:-SNAPSHOT-6.3.0.0}" +if [ $# -ne 1 ] || [ -z "${1:-}" ]; then + echo "Usage: ${0##*/} POWPEG_VERSION" >&2 + exit 1 +fi +POWPEG_VERSION=$1 +shift echo "POWPEG_VERSION received as parameter: $1" read -r -d '' SETTINGS_RIT < Date: Tue, 30 Jul 2024 15:48:17 +0200 Subject: [PATCH 16/19] Upgrading java version to 17 --- container-action/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/container-action/Dockerfile b/container-action/Dockerfile index 46c6ea90..a92c2b27 100644 --- a/container-action/Dockerfile +++ b/container-action/Dockerfile @@ -22,7 +22,7 @@ ENV NODE_PATH $NVM_DIR/$NODE_VERSION/lib/node_modules ENV PATH $NVM_DIR/versions/node/$NODE_VERSION/bin:$PATH # -- java --------------------------------------------------------- -ENV JAVA_VERSION 11 +ENV JAVA_VERSION 17 RUN apt-get -y install "openjdk-$JAVA_VERSION-jdk" From 3f5816315f4f309b7c1e46de9f2ce7a0d985b9ae Mon Sep 17 00:00:00 2001 From: fmacleal Date: Thu, 8 Aug 2024 17:45:50 +0200 Subject: [PATCH 17/19] Applying some other suggestions from review --- .github/workflows/ci.yml | 22 +++++++++++++++++++ container-action/Dockerfile | 3 --- .../scripts/configure_rit_locally.sh | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5871c28..2a2edb74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,3 +103,25 @@ jobs: run: | echo "RIT Status = ${{ steps.test-rit-action.outputs.status }}" echo "RIT Message = ${{ steps.test-rit-action.outputs.message }}" + + publish-rit-action-tag: + needs: test-rit-action + name: Publish RIT Action tag + runs-on: ubuntu-latest + timeout-minutes: 60 + if: github.ref == 'refs/heads/main' + + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v4 + + - name: Create GitHub Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: rootstock-integration-tests@v1 + release_name: Release rootstock-integration-tests@v1 + draft: false + prerelease: false diff --git a/container-action/Dockerfile b/container-action/Dockerfile index a92c2b27..56d3cd81 100644 --- a/container-action/Dockerfile +++ b/container-action/Dockerfile @@ -28,9 +28,6 @@ RUN apt-get -y install "openjdk-$JAVA_VERSION-jdk" ENV JAVA_HOME="/usr/lib/jvm/java-$JAVA_VERSION-openjdk-amd64" -RUN export JAVA_HOME="$JAVA_HOME" \ - && export PATH="$JAVA_HOME:$PATH" - # -- bitcoind --------------------------------------------------------- ENV BITCOIN_VERSION 0.18.1 diff --git a/container-action/scripts/configure_rit_locally.sh b/container-action/scripts/configure_rit_locally.sh index 5afc0687..2c0bc511 100755 --- a/container-action/scripts/configure_rit_locally.sh +++ b/container-action/scripts/configure_rit_locally.sh @@ -6,7 +6,7 @@ if [ $# -ne 1 ] || [ -z "${1:-}" ]; then fi POWPEG_VERSION=$1 shift -echo "POWPEG_VERSION received as parameter: $1" +echo "POWPEG_VERSION received as parameter: $POWPEG_VERSION" read -r -d '' SETTINGS_RIT < Date: Thu, 8 Aug 2024 17:45:50 +0200 Subject: [PATCH 18/19] Applying some other suggestions from review --- container-action/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/container-action/Dockerfile b/container-action/Dockerfile index 56d3cd81..862b0230 100644 --- a/container-action/Dockerfile +++ b/container-action/Dockerfile @@ -4,7 +4,7 @@ LABEL Description="Custom RSK node image to execute Rootstock Integration Tests" RUN apt-get update \ && apt-get install -y --no-install-recommends \ - wget gnupg2 curl git ca-certificates mocha \ + ca-certificates curl git gnupg2 mocha wget \ && apt clean # -- nodeJs --------------------------------------------------------- From 1fb3717352cd94cc46b8096162083ab01e86b1d9 Mon Sep 17 00:00:00 2001 From: fmacleal Date: Tue, 13 Aug 2024 16:34:00 +0200 Subject: [PATCH 19/19] Applying some other suggestions from review --- .gitignore | 2 +- container-action/README.md | 9 +++++---- .../rit-local-configs/logbacks/logback-fed-1.xml | 4 ---- .../rit-local-configs/logbacks/logback-fed-2.xml | 4 ---- .../rit-local-configs/logbacks/logback-fed-3.xml | 4 ---- .../rit-local-configs/logbacks/logback-fed-4.xml | 4 ---- .../rit-local-configs/logbacks/logback-fed-5.xml | 6 +----- lib/rsk-utils-legacy.js | 2 +- 8 files changed, 8 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index af2e55a2..77cde6cd 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ config/*.js logs .env .DS_Store -.idea/ \ No newline at end of file +.idea/ diff --git a/container-action/README.md b/container-action/README.md index 16d6fb04..f3ac048a 100644 --- a/container-action/README.md +++ b/container-action/README.md @@ -14,8 +14,9 @@ That way, we will add steps on each repository to run the integration tests with No matter if it's a tag, a branch or a specific commit. ## Inputs -By default, all the inputs are pointed to the `master/main` branch of the repositories. But, ideally, we will adapt -the action to receive the branches received to be the one in a branch or tag that we want to test. +By default, all the inputs are pointed to the `master/main` branch of the repositories. But, ideally, the action step +should receive the branches, commit or tag that should be tested by the pipeline execution. If we want to test +a specific tag from `powpeg-node`, the input parameter `powpeg-node-branch` should be the tag number `6.4.0.0-rc` for example. ### `rskj-branch` @@ -27,8 +28,8 @@ The powpeg-node branch to checkout. If no branch or tag passed, it will be used ### `rit-branch` -**Optional** The rootstock-integration-tests branch to checkout. This one it's optional, because it will be -very unlikely that we need to use a different branch for the rootstock-integration-test. It's offered the possibility +**Optional** The rootstock-integration-tests branch to checkout. This one it's optional, if it's needed +to use a different branch for the rootstock-integration-test. It's offered the possibility to use a different one, but the default and most frequently used, should be `main`. ### `rit-log-level` diff --git a/container-action/rit-local-configs/logbacks/logback-fed-1.xml b/container-action/rit-local-configs/logbacks/logback-fed-1.xml index d509ed15..56c73786 100644 --- a/container-action/rit-local-configs/logbacks/logback-fed-1.xml +++ b/container-action/rit-local-configs/logbacks/logback-fed-1.xml @@ -15,9 +15,6 @@ %date{yyyy-MM-dd-HH:mm:ss.SSSS} %p [%c{1}] %m%n - - diff --git a/container-action/rit-local-configs/logbacks/logback-fed-2.xml b/container-action/rit-local-configs/logbacks/logback-fed-2.xml index ac2ebe06..0b925b2a 100644 --- a/container-action/rit-local-configs/logbacks/logback-fed-2.xml +++ b/container-action/rit-local-configs/logbacks/logback-fed-2.xml @@ -15,9 +15,6 @@ %date{yyyy-MM-dd-HH:mm:ss.SSSS} %p [%c{1}] %m%n - - diff --git a/container-action/rit-local-configs/logbacks/logback-fed-3.xml b/container-action/rit-local-configs/logbacks/logback-fed-3.xml index eaf28053..5a79fec6 100644 --- a/container-action/rit-local-configs/logbacks/logback-fed-3.xml +++ b/container-action/rit-local-configs/logbacks/logback-fed-3.xml @@ -15,9 +15,6 @@ %date{yyyy-MM-dd-HH:mm:ss.SSSS} %p [%c{1}] %m%n - - diff --git a/container-action/rit-local-configs/logbacks/logback-fed-4.xml b/container-action/rit-local-configs/logbacks/logback-fed-4.xml index 2857427c..9b36ddf1 100644 --- a/container-action/rit-local-configs/logbacks/logback-fed-4.xml +++ b/container-action/rit-local-configs/logbacks/logback-fed-4.xml @@ -15,9 +15,6 @@ %date{yyyy-MM-dd-HH:mm:ss.SSSS} %p [%c{1}] %m%n - - diff --git a/container-action/rit-local-configs/logbacks/logback-fed-5.xml b/container-action/rit-local-configs/logbacks/logback-fed-5.xml index e9d92af0..495ffc4c 100644 --- a/container-action/rit-local-configs/logbacks/logback-fed-5.xml +++ b/container-action/rit-local-configs/logbacks/logback-fed-5.xml @@ -15,9 +15,6 @@ %date{yyyy-MM-dd-HH:mm:ss.SSSS} %p [%c{1}] %m%n - - + \ @@ -104,7 +101,6 @@ - diff --git a/lib/rsk-utils-legacy.js b/lib/rsk-utils-legacy.js index d3d72032..e10c323d 100644 --- a/lib/rsk-utils-legacy.js +++ b/lib/rsk-utils-legacy.js @@ -3,7 +3,7 @@ const btcClientProvider = require('./btc-client-provider'); const { sequentialPromise, wait, interval } = require('./utils'); const { getBridgeAbi, getLatestActiveForkName } = require('./precompiled-abi-forks-util'); const waitForBlockAttemptTimeMillis = process.env.WAIT_FOR_BLOCK_ATTEMPT_TIME_MILLIS || 200; -const waitForBlockMaxAttempts = process.env. WAIT_FOR_BLOCK_MAX_ATTEMPTS || 160; +const waitForBlockMaxAttempts = process.env. WAIT_FOR_BLOCK_MAX_ATTEMPTS || 600; let getMaxBlockNumber = (rskClients) => { var maxBlockNumber;