From 521a2b0b0c083d8e91de4b92e6fd04746fbb4850 Mon Sep 17 00:00:00 2001 From: Benjamin <31835324+Fuma419@users.noreply.github.com> Date: Thu, 2 May 2024 23:22:21 -0400 Subject: [PATCH] moving pr 1743 to node 8.9.1 (#1747) ## Description - Branched from: https://github.com/cardano-community/guild-operators/pull/1743 - Updated CARDANO_NODE_VERSION to 8.9.1 - updated node-deps.json to 8.9.1 - updated blst to latest per release specs - Added Fork/Branch ARG to dockerfile_bin & entrypoint.sh to enable docker test/dev on forked repos - added missing jg dep in docker build based on build errors ## Where should the reviewer start? This should be merged into the original branch (node-8.9.0) and tested more extensively. I can help in that effort but this is my first contribution and my automated test env and familiarity is lacking. ## Motivation and context - Reduce node release implementation timetable for guild-operators docker images. - Enable docker development from Forks - Give back and contribute to the [guild-operators](https://github.com/cardano-community/guild-operators) ## Which issue it fixes? updating this existing branch (node-8.9.0) to 8.9.1 release ref PR: (https://github.com/cardano-community/guild-operators/pull/1743) ## How has this been tested? Successfully deployed and completely synced nodes using the Docker image and Host env on mainnet, preprod, preview networks. No further functionality has been verified. This should be considered as untested and is not ready for production. --------- Co-authored-by: rdlrt <3169068+rdlrt@users.noreply.github.com> Co-authored-by: Shane Powser Co-authored-by: Ben Zawodni Co-authored-by: illuminatus Co-authored-by: fuma419 --- .github/workflows/premerge.yml | 57 +++++++++++-------- files/docker/node/dockerfile_bin | 10 ++-- files/node-deps.json | 6 +- ...rockylinux-guild-deploy.sh-l.containerfile | 2 +- scripts/cnode-helper-scripts/env | 3 +- scripts/cnode-helper-scripts/guild-deploy.sh | 3 +- 6 files changed, 45 insertions(+), 36 deletions(-) diff --git a/.github/workflows/premerge.yml b/.github/workflows/premerge.yml index 6aff5f2f0..69c4c550e 100644 --- a/.github/workflows/premerge.yml +++ b/.github/workflows/premerge.yml @@ -20,7 +20,7 @@ jobs: distro: [rockylinux, ubuntu] env: REGISTRY: ghcr.io - BRANCH: ${{ github.event.inputs.branch || '' }} + BRANCH: ${{ github.event.inputs.branch || github.head_ref }} if: github.event.pull_request.draft == false steps: - name: Maximize build space @@ -45,63 +45,70 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - uses: actions/checkout@v3 - - name: Define BRANCH, COMMIT and G_ACCOUNT in environment + - name: Define BRANCH, COMMIT_SHA and G_ACCOUNT in environment run: | - echo "G_ACCOUNT=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV - if [[ -z "${{ env.BRANCH }}" ]]; then - echo "BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV - echo "COMMIT=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV + echo "IS_FORK=${{ github.event.pull_request.head.repo.fork }}" >> $GITHUB_ENV + echo "FORK_OWNER=${{ github.event.pull_request.head.repo.owner.login }}" >> $GITHUB_ENV + echo "G_ACCOUNT=${{ github.repository_owner }}" >> $GITHUB_ENV + echo "COMMIT_SHA=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV + + - name: Setup G_ACCOUNT based on fork status + run: | + if [ "$IS_FORK" = "true" ]; then + echo "This means the PR is from a fork" + echo "BUILD_G_ACCOUNT=${{ github.event.pull_request.head.repo.owner.login }}" >> $GITHUB_ENV else - echo "COMMIT=$(git rev-parse --short ${{ env.BRANCH }})" >> $GITHUB_ENV + echo "This means the PR is from the same repository" + echo "BUILD_G_ACCOUNT=${{ github.repository_owner }}" >> $GITHUB_ENV fi - name: Testing guild-deploy.sh (IO fork of libsodium) run: | docker build . \ --file files/tests/pre-merge/${{ matrix.distro }}-guild-deploy.sh-l.containerfile \ --compress \ - --build-arg BRANCH=${{ env.BRANCH }} \ - --build-arg COMMIT=${{ env.COMMIT }} \ - --build-arg G_ACCOUNT=${{ env.G_ACCOUNT }} \ - --tag ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:guild-deploy-l_${{ env.COMMIT }} + --build-arg BRANCH=$BRANCH \ + --build-arg COMMIT=$COMMIT_SHA \ + --build-arg G_ACCOUNT=${{ env.BUILD_G_ACCOUNT }} \ + --tag $REGISTRY/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:guild-deploy-l_$COMMIT_SHA - name: Get Image ID run: | - PREMERGE_IMAGE_ID1=$(docker inspect ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:guild-deploy-l_${{ env.COMMIT }} --format='{{.Id}}') + PREMERGE_IMAGE_ID1=$(docker inspect ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:guild-deploy-l_${{ env.COMMIT_SHA }} --format='{{.Id}}') echo "PREMERGE_IMAGE_ID1=${PREMERGE_IMAGE_ID1}" >> $GITHUB_ENV - - name: Push pre-merge-${{ matrix.distro }}:guild-deploy-l_${{ env.COMMIT }} + - name: Push pre-merge-${{ matrix.distro }}:guild-deploy-l_${{ env.COMMIT_SHA }} run: | - docker push ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:guild-deploy-l_${{ env.COMMIT }} + docker push ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:guild-deploy-l_${{ env.COMMIT_SHA }} - name: Testing cabal-build-all.sh (IO fork of libsodium) run: | - echo "Working from PR Branch ${{ env.G_ACCOUNT }}/guild-operators/${{ env.BRANCH }} on Commit ${{ env.COMMIT }}" + echo "Working from PR Branch ${{ env.G_ACCOUNT }}/guild-operators/${{ env.BRANCH }} on COMMIT_SHA ${{ env.COMMIT_SHA }}" docker build . \ --file files/tests/pre-merge/${{ matrix.distro }}-cabal-l.containerfile \ --compress \ --build-arg BRANCH=${{ env.BRANCH }} \ - --build-arg COMMIT=${{ env.COMMIT }} \ - --build-arg G_ACCOUNT=${{ env.G_ACCOUNT }} \ - --tag ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT }} + --build-arg COMMIT=${{ env.COMMIT_SHA }} \ + --build-arg G_ACCOUNT=${{ env.BUILD_G_ACCOUNT }} \ + --tag ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT_SHA }} - name: Get Versions and Image ID run: | - VERSION_DETAILS=($(docker run --rm ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT }} cardano-node --version | awk '/^cardano-node/')) - PREMERGE_IMAGE_ID2=$(docker inspect ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT }} --format='{{.Id}}') + VERSION_DETAILS=($(docker run --rm ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT_SHA }} cardano-node --version | awk '/^cardano-node/')) + PREMERGE_IMAGE_ID2=$(docker inspect ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT_SHA }} --format='{{.Id}}') echo "CARDANO_NODE_VERSION=${VERSION_DETAILS[1]}" >> $GITHUB_ENV echo "GHC_VERSION=${VERSION_DETAILS[5]}" >> $GITHUB_ENV echo "PREMERGE_IMAGE_ID2=${PREMERGE_IMAGE_ID2}" >> $GITHUB_ENV - - name: Push pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT }} + - name: Push pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT_SHA }} run: | - docker push ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT }} + docker push ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT_SHA }} - name: Add summary details if: always() run: | echo "## Pre-Merge Summary Details" >> $GITHUB_STEP_SUMMARY echo "| Name | Value |" >> $GITHUB_STEP_SUMMARY echo "| ---- | ----- |" >> $GITHUB_STEP_SUMMARY - echo "| Guild Deploy Image | ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:guild-deploy-l_${{ env.COMMIT }} |" >> $GITHUB_STEP_SUMMARY + echo "| Guild Deploy Image | ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:guild-deploy-l_${{ env.COMMIT_SHA }} |" >> $GITHUB_STEP_SUMMARY echo "| Guild Deploy Image ID | ${{ env.PREMERGE_IMAGE_ID1 }} |" >> $GITHUB_STEP_SUMMARY - echo "| Cabal Build Image | ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT }} |" >> $GITHUB_STEP_SUMMARY + echo "| Cabal Build Image | ${{ env.REGISTRY }}/${{ env.G_ACCOUNT }}/pre-merge-${{ matrix.distro }}:cabal-l_${{ env.COMMIT_SHA }} |" >> $GITHUB_STEP_SUMMARY echo "| Cabal Build Image ID | ${{ env.PREMERGE_IMAGE_ID2 }} |" >> $GITHUB_STEP_SUMMARY echo "| G_ACCOUNT | ${{ env.G_ACCOUNT }} |" >> $GITHUB_STEP_SUMMARY echo "| BRANCH | ${{ env.BRANCH }} |" >> $GITHUB_STEP_SUMMARY - echo "| COMMIT | ${{ env.COMMIT }} |" >> $GITHUB_STEP_SUMMARY + echo "| COMMIT_SHA | ${{ env.COMMIT_SHA }} |" >> $GITHUB_STEP_SUMMARY echo "| CARDANO_NODE_VERSION | ${{ env.CARDANO_NODE_VERSION }} |" >> $GITHUB_STEP_SUMMARY echo "| GHC_VERSION | ${{ env.GHC_VERSION }} |" >> $GITHUB_STEP_SUMMARY diff --git a/files/docker/node/dockerfile_bin b/files/docker/node/dockerfile_bin index a0e549747..b9aec97a4 100644 --- a/files/docker/node/dockerfile_bin +++ b/files/docker/node/dockerfile_bin @@ -5,8 +5,8 @@ STOPSIGNAL SIGINT LABEL desc="Cardano Node by Guild's Operators" ARG DEBIAN_FRONTEND=noninteractive -ARG G_ACCOUNT -ARG GUILD_DEPLOY_BRANCH +ARG G_ACCOUNT=cardano-community +ARG GUILD_DEPLOY_BRANCH=master USER root WORKDIR / @@ -39,7 +39,6 @@ RUN adduser --disabled-password --gecos '' guild \ && adduser guild sudo \ && mkdir -pv /home/guild/.local/ /home/guild/.scripts/ - RUN set -x && apt update \ && apt-get update \ && mkdir -p /root/.local/bin \ @@ -47,7 +46,8 @@ RUN set -x && apt update \ && export SUDO='N' \ && export UPDATE_CHECK='N' \ && export SKIP_DBSYNC_DOWNLOAD='Y' \ - && chmod +x ./guild-deploy.sh && ./guild-deploy.sh -b ${GUILD_DEPLOY_BRANCH} -s p \ + && export G_ACCOUNT=${G_ACCOUNT} \ + && chmod +x ./guild-deploy.sh && ./guild-deploy.sh -b ${GUILD_DEPLOY_BRANCH} -s p \ && ls /opt/ \ && mkdir -p $CNODE_HOME/priv/files \ && apt-get -y remove libpq-dev build-essential pkg-config libffi-dev libgmp-dev libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev make g++ \ @@ -56,10 +56,10 @@ RUN set -x && apt update \ && apt-get -y autoremove \ && rm -rf /var/lib/apt/lists/* - RUN set -x && export SUDO='N' \ && export UPDATE_CHECK='N' \ && export SKIP_DBSYNC_DOWNLOAD='Y' \ + && export G_ACCOUNT=${G_ACCOUNT} \ && ./guild-deploy.sh -b ${GUILD_DEPLOY_BRANCH} -s dcmowx \ && cd /usr/bin \ && wget http://www.vdberg.org/~richard/tcpping \ diff --git a/files/node-deps.json b/files/node-deps.json index bc72b5c35..17d14e84b 100644 --- a/files/node-deps.json +++ b/files/node-deps.json @@ -5,10 +5,10 @@ "secp256k1": "v0.3.2", "sodium": "dbb48cce5429cb6585c9034f002568964f1ce567" }, - "8.9.0": + "8.9.2": { - "blst": "v0.3.11", + "blst": "3dd0f804b1819e5d03fb22ca2e6fac105932043a", "secp256k1": "v0.3.2", "sodium": "dbb48cce5429cb6585c9034f002568964f1ce567" } -} \ No newline at end of file +} diff --git a/files/tests/pre-merge/rockylinux-guild-deploy.sh-l.containerfile b/files/tests/pre-merge/rockylinux-guild-deploy.sh-l.containerfile index 769e047c3..2cad36f19 100644 --- a/files/tests/pre-merge/rockylinux-guild-deploy.sh-l.containerfile +++ b/files/tests/pre-merge/rockylinux-guild-deploy.sh-l.containerfile @@ -14,7 +14,7 @@ ENV \ WORKDIR / -RUN dnf -y --allowerasing install findutils &&\ +RUN dnf -y --allowerasing install findutils jq &&\ dnf clean all &&\ mkdir -pv /root/.local/bin /root/.ghcup/bin &&\ curl -s -f -k -o guild-deploy.sh "https://raw.githubusercontent.com/${G_ACCOUNT}/guild-operators/${BRANCH}/scripts/cnode-helper-scripts/guild-deploy.sh" &&\ diff --git a/scripts/cnode-helper-scripts/env b/scripts/cnode-helper-scripts/env index a2a9d3f4d..704e3ba71 100644 --- a/scripts/cnode-helper-scripts/env +++ b/scripts/cnode-helper-scripts/env @@ -929,7 +929,8 @@ fi node_version="$(${CNODEBIN} version | head -1 | cut -d' ' -f2)" cli_version="$(${CCLI} version | head -1 | cut -d' ' -f2)" -if ! versionCheck "8.9.0" "${node_version}" || ! versionCheck "8.20.3.0" "${cli_version}"; then + +if ! versionCheck "8.9.2" "${node_version}" || ! versionCheck "8.20.3.0" "${cli_version}"; then echo -e "\nKoios scripts have now been upgraded to support cardano-node 8.9.x ('${node_version}' found) / cardano-cli 8.20.x.x ('${cli_version}' found).\nPlease update cardano-node binaries (ensure to read release notes and update various configs using guild-deploy (use appropriate options to download/install/overwrite parts you need) or use tagged branches for older node version (eg: ./