From 964939595990de60e54107687c0effa52c1c46fb Mon Sep 17 00:00:00 2001 From: Reynold Morel Date: Fri, 27 Sep 2024 16:40:30 -0400 Subject: [PATCH 1/6] Adding repo owner input --- container-action/entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/container-action/entrypoint.sh b/container-action/entrypoint.sh index 1003f44d..87814244 100644 --- a/container-action/entrypoint.sh +++ b/container-action/entrypoint.sh @@ -5,16 +5,18 @@ RSKJ_BRANCH="${INPUT_RSKJ_BRANCH}" POWPEG_NODE_BRANCH="${INPUT_POWPEG_NODE_BRANCH}" RIT_BRANCH="${INPUT_RIT_BRANCH}" LOG_LEVEL="${INPUT_RIT_LOG_LEVEL}" +REPO_OWNER="${INPUT_REPO_OWNER:-rsksmart}" # Default to 'rsksmart' if not provided 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 "REPO_OWNER=$REPO_OWNER" echo -e "\n\n--------- Starting the configuration of rskj ---------\n\n" cd /usr/src/ -git clone https://github.com/rsksmart/rskj.git rskj +git clone "https://github.com/$REPO_OWNER/rskj.git" rskj # Use the variable for repo owner cd rskj && git checkout "$RSKJ_BRANCH" chmod +x ./configure.sh && chmod +x gradlew ./configure.sh From eae4f014b436169c8819bbbceee6907ff056d762 Mon Sep 17 00:00:00 2001 From: rmoreliovlabs Date: Mon, 30 Sep 2024 09:32:02 -0400 Subject: [PATCH 2/6] Print input repo owner --- container-action/entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/container-action/entrypoint.sh b/container-action/entrypoint.sh index 87814244..fa2f8f74 100644 --- a/container-action/entrypoint.sh +++ b/container-action/entrypoint.sh @@ -13,6 +13,7 @@ echo "POWPEG_NODE_BRANCH=$POWPEG_NODE_BRANCH" echo "RIT_BRANCH=$RIT_BRANCH" echo "LOG_LEVEL=$LOG_LEVEL" echo "REPO_OWNER=$REPO_OWNER" +echo "Input REPO_OWNER=${INPUT_REPO_OWNER}" echo -e "\n\n--------- Starting the configuration of rskj ---------\n\n" cd /usr/src/ From 5d55e5a98d597919ad72d23f04b03ff00f2b742d Mon Sep 17 00:00:00 2001 From: rmoreliovlabs Date: Mon, 30 Sep 2024 09:46:31 -0400 Subject: [PATCH 3/6] Adding repo owner to the actions.yml file --- action.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/action.yml b/action.yml index 8deb73f2..97d13327 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,10 @@ inputs: description: 'Log level for the rootstock-integration-tests' required: false default: 'info' + repo-owner: + description: 'The owner of the repository' + required: false + default: 'rsksmart' outputs: status: @@ -34,3 +38,4 @@ runs: INPUT_POWPEG_NODE_BRANCH: ${{ inputs.powpeg-node-branch }} INPUT_RIT_BRANCH: ${{ inputs.rit-branch }} INPUT_RIT_LOG_LEVEL: ${{ inputs.rit-log-level }} + INPUT_REPO_OWNER: ${{ inputs.repo-owner }} From c730127508c642525f128024ea144c5df4c1b46d Mon Sep 17 00:00:00 2001 From: rmoreliovlabs Date: Fri, 4 Oct 2024 10:08:11 -0400 Subject: [PATCH 4/6] testing --- action.yml | 2 +- container-action/entrypoint.sh | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 97d13327..aadc519c 100644 --- a/action.yml +++ b/action.yml @@ -38,4 +38,4 @@ runs: INPUT_POWPEG_NODE_BRANCH: ${{ inputs.powpeg-node-branch }} INPUT_RIT_BRANCH: ${{ inputs.rit-branch }} INPUT_RIT_LOG_LEVEL: ${{ inputs.rit-log-level }} - INPUT_REPO_OWNER: ${{ inputs.repo-owner }} + INPUT_REPO_OWNER: ${{ inputs.repo-owner }} \ No newline at end of file diff --git a/container-action/entrypoint.sh b/container-action/entrypoint.sh index fa2f8f74..c1aeef5c 100644 --- a/container-action/entrypoint.sh +++ b/container-action/entrypoint.sh @@ -6,6 +6,8 @@ POWPEG_NODE_BRANCH="${INPUT_POWPEG_NODE_BRANCH}" RIT_BRANCH="${INPUT_RIT_BRANCH}" LOG_LEVEL="${INPUT_RIT_LOG_LEVEL}" REPO_OWNER="${INPUT_REPO_OWNER:-rsksmart}" # Default to 'rsksmart' if not provided +IS_RSKJ_BRANCH=$(git ls-remote "https://github.com/$REPO_OWNER/rskj.git" "$RSKJ_BRANCH") +IS_POWPEG_BRANCH=$(git ls-remote "https://github.com/$REPO_OWNER/powpeg-node.git" "$POWPEG_NODE_BRANCH") echo -e "\n\n--------- Input parameters received ---------\n\n" echo "RSKJ_BRANCH=$RSKJ_BRANCH" @@ -13,18 +15,29 @@ echo "POWPEG_NODE_BRANCH=$POWPEG_NODE_BRANCH" echo "RIT_BRANCH=$RIT_BRANCH" echo "LOG_LEVEL=$LOG_LEVEL" echo "REPO_OWNER=$REPO_OWNER" -echo "Input REPO_OWNER=${INPUT_REPO_OWNER}" echo -e "\n\n--------- Starting the configuration of rskj ---------\n\n" cd /usr/src/ -git clone "https://github.com/$REPO_OWNER/rskj.git" rskj # Use the variable for repo owner +if test -n "${IS_RSKJ_BRANCH}"; then + echo "Found matching branch name in $REPO_OWNER/rskj.git repo" + git clone "https://github.com/$REPO_OWNER/rskj.git" rskj +else + echo "Found matching branch name in rsksmart/rskj.git repo" + git clone "https://github.com/rsksmart/rskj.git" rskj +fi cd rskj && git checkout "$RSKJ_BRANCH" chmod +x ./configure.sh && chmod +x gradlew ./configure.sh echo -e "\n\n--------- Starting the configuration of powpeg ---------\n\n" cd /usr/src/ -git clone https://github.com/rsksmart/powpeg-node.git powpeg +if test -n "${IS_POWPEG_BRANCH}"; then + echo "Found matching branch name in $REPO_OWNER/powpeg-node.git repo" + git clone "https://github.com/$REPO_OWNER/powpeg-node.git" powpeg +else + echo "Found matching branch name in rsksmart/powpeg-node.git repo" + git clone "https://github.com/rsksmart/powpeg-node.git" powpeg +fi cp configure_gradle_powpeg.sh powpeg cd powpeg && git checkout "$POWPEG_NODE_BRANCH" chmod +x ./configure.sh && chmod +x gradlew From 617310d13ed3e009bc1dec6c946b919ce33d3123 Mon Sep 17 00:00:00 2001 From: rmoreliovlabs Date: Fri, 4 Oct 2024 10:21:14 -0400 Subject: [PATCH 5/6] debugging --- container-action/entrypoint.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/container-action/entrypoint.sh b/container-action/entrypoint.sh index c1aeef5c..d45af2ba 100644 --- a/container-action/entrypoint.sh +++ b/container-action/entrypoint.sh @@ -9,6 +9,38 @@ REPO_OWNER="${INPUT_REPO_OWNER:-rsksmart}" # Default to 'rsksmart' if not provi IS_RSKJ_BRANCH=$(git ls-remote "https://github.com/$REPO_OWNER/rskj.git" "$RSKJ_BRANCH") IS_POWPEG_BRANCH=$(git ls-remote "https://github.com/$REPO_OWNER/powpeg-node.git" "$POWPEG_NODE_BRANCH") +# Check if the branch exists +if [ -n "$IS_RSKJ_BRANCH" ]; then + echo "Branch '$RSKJ_BRANCH' exists in repository '$REPO_OWNER/rskj.git'." +else + echo "Branch '$RSKJ_BRANCH' does not exist in repository '$REPO_OWNER/rskj.git'." +fi + +if [ -n "$IS_POWPEG_BRANCH" ]; then + echo "Branch '$POWPEG_NODE_BRANCH' exists in repository '$REPO_OWNER/powpeg-node.git'." +else + echo "Branch '$POWPEG_NODE_BRANCH' does not exist in repository '$REPO_OWNER/powpeg-node.git'." +fi + + +# Check if the branch exists +#IS_RSKJ_BRANCH=$(curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/$REPO_OWNER/rskj/branches/$RSKJ_BRANCH") + +#if [ "$IS_RSKJ_BRANCH" -eq 200 ]; then +# echo "Branch '$RSKJ_BRANCH' exists in $REPO_OWNER/rskj.git" +#else +# echo "Branch '$RSKJ_BRANCH' does not exist in $REPO_OWNER/rskj.git" +#fi + +#IS_POWPEG_BRANCH=$(curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/$REPO_OWNER/powpeg-node/branches/$POWPEG_NODE_BRANCH") + +#if [ "$IS_POWPEG_BRANCH" -eq 200 ]; then +# echo "Branch '$POWPEG_NODE_BRANCH' exists in $REPO_OWNER/powpeg-node.git" +#else +# echo "Branch '$POWPEG_NODE_BRANCH' does not exist in $REPO_OWNER/powpeg-node.git" +#fi + + echo -e "\n\n--------- Input parameters received ---------\n\n" echo "RSKJ_BRANCH=$RSKJ_BRANCH" echo "POWPEG_NODE_BRANCH=$POWPEG_NODE_BRANCH" From 243ac6c2f68b9137e691c1168c2cc4dab3a88d54 Mon Sep 17 00:00:00 2001 From: rmoreliovlabs Date: Fri, 4 Oct 2024 10:48:34 -0400 Subject: [PATCH 6/6] more testing --- container-action/entrypoint.sh | 40 ++++++++++------------------------ 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/container-action/entrypoint.sh b/container-action/entrypoint.sh index d45af2ba..0cd21f4d 100644 --- a/container-action/entrypoint.sh +++ b/container-action/entrypoint.sh @@ -6,39 +6,23 @@ POWPEG_NODE_BRANCH="${INPUT_POWPEG_NODE_BRANCH}" RIT_BRANCH="${INPUT_RIT_BRANCH}" LOG_LEVEL="${INPUT_RIT_LOG_LEVEL}" REPO_OWNER="${INPUT_REPO_OWNER:-rsksmart}" # Default to 'rsksmart' if not provided -IS_RSKJ_BRANCH=$(git ls-remote "https://github.com/$REPO_OWNER/rskj.git" "$RSKJ_BRANCH") -IS_POWPEG_BRANCH=$(git ls-remote "https://github.com/$REPO_OWNER/powpeg-node.git" "$POWPEG_NODE_BRANCH") # Check if the branch exists -if [ -n "$IS_RSKJ_BRANCH" ]; then - echo "Branch '$RSKJ_BRANCH' exists in repository '$REPO_OWNER/rskj.git'." -else - echo "Branch '$RSKJ_BRANCH' does not exist in repository '$REPO_OWNER/rskj.git'." -fi +IS_RSKJ_BRANCH=$(curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/$REPO_OWNER/rskj/branches/$RSKJ_BRANCH") -if [ -n "$IS_POWPEG_BRANCH" ]; then - echo "Branch '$POWPEG_NODE_BRANCH' exists in repository '$REPO_OWNER/powpeg-node.git'." +if [ "$IS_RSKJ_BRANCH" -eq 200 ]; then + echo "IS_RSKJ_BRANCH is true: Branch '$RSKJ_BRANCH' exists in $REPO_OWNER/rskj.git" else - echo "Branch '$POWPEG_NODE_BRANCH' does not exist in repository '$REPO_OWNER/powpeg-node.git'." + echo "Branch '$RSKJ_BRANCH' does not exist in $REPO_OWNER/rskj.git" fi +IS_POWPEG_BRANCH=$(curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/$REPO_OWNER/powpeg-node/branches/$POWPEG_NODE_BRANCH") -# Check if the branch exists -#IS_RSKJ_BRANCH=$(curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/$REPO_OWNER/rskj/branches/$RSKJ_BRANCH") - -#if [ "$IS_RSKJ_BRANCH" -eq 200 ]; then -# echo "Branch '$RSKJ_BRANCH' exists in $REPO_OWNER/rskj.git" -#else -# echo "Branch '$RSKJ_BRANCH' does not exist in $REPO_OWNER/rskj.git" -#fi - -#IS_POWPEG_BRANCH=$(curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/$REPO_OWNER/powpeg-node/branches/$POWPEG_NODE_BRANCH") - -#if [ "$IS_POWPEG_BRANCH" -eq 200 ]; then -# echo "Branch '$POWPEG_NODE_BRANCH' exists in $REPO_OWNER/powpeg-node.git" -#else -# echo "Branch '$POWPEG_NODE_BRANCH' does not exist in $REPO_OWNER/powpeg-node.git" -#fi +if [ "$IS_POWPEG_BRANCH" -eq 200 ]; then + echo "IS_POWPEG_BRANCH is true: Branch '$POWPEG_NODE_BRANCH' exists in $REPO_OWNER/powpeg-node.git" +else + echo "Branch '$POWPEG_NODE_BRANCH' does not exist in $REPO_OWNER/powpeg-node.git" +fi echo -e "\n\n--------- Input parameters received ---------\n\n" @@ -50,7 +34,7 @@ echo "REPO_OWNER=$REPO_OWNER" echo -e "\n\n--------- Starting the configuration of rskj ---------\n\n" cd /usr/src/ -if test -n "${IS_RSKJ_BRANCH}"; then +if [ "$IS_RSKJ_BRANCH" -eq 200 ]; then echo "Found matching branch name in $REPO_OWNER/rskj.git repo" git clone "https://github.com/$REPO_OWNER/rskj.git" rskj else @@ -63,7 +47,7 @@ chmod +x ./configure.sh && chmod +x gradlew echo -e "\n\n--------- Starting the configuration of powpeg ---------\n\n" cd /usr/src/ -if test -n "${IS_POWPEG_BRANCH}"; then +if [ "$IS_POWPEG_BRANCH" -eq 200 ]; then echo "Found matching branch name in $REPO_OWNER/powpeg-node.git repo" git clone "https://github.com/$REPO_OWNER/powpeg-node.git" powpeg else