From 8b5774b9a87ae4f179806c03f8d45d450c836b77 Mon Sep 17 00:00:00 2001 From: Mohamed Elmoslemany Date: Thu, 4 Jul 2024 10:02:53 +0200 Subject: [PATCH 1/9] workflows refactoring --- .github/CODEOWNERS | 21 +- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/feature_spec.md | 2 +- .github/workflows/buf-push.yml | 15 ++ .github/workflows/build-deb-pkg.sh | 10 +- .github/workflows/build-docker.yml | 20 -- .github/workflows/build-tgz-pkg.sh | 10 +- .github/workflows/build_artifacts.yml | 27 --- .github/workflows/ci.yml | 94 ++++---- .../{scripts => }/cleanup-net-outage-sim.sh | 0 .github/workflows/codeql-analysis.yml | 12 +- .github/workflows/debian/template/control | 4 +- .github/workflows/fuzz.yml | 7 +- .github/workflows/fuzz_merkledb.yml | 8 +- .github/workflows/net-outage-sim.yml | 11 +- .github/workflows/publish_image.sh | 18 +- .../{scripts => }/run-net-outage-sim.sh | 14 +- .../workflows/yum/specfile/camino-node.spec | 19 -- README.md | 8 +- RELEASES.md | 4 +- scripts/ansible/.ansible-lint | 3 - scripts/ansible/README.md | 206 ------------------ scripts/ansible/ansible.cfg | 16 -- scripts/ansible/create_public_ami.yml | 9 - scripts/ansible/files/camino.gpg.key | 2 - .../ansible/inventories/examples/amazon.yml | 7 - scripts/ansible/inventories/localhost.yml | 4 - scripts/ansible/inventories/raspberrypi.yml | 5 - scripts/ansible/kill_playbook.yml | 8 - scripts/ansible/ping_playbook.yml | 9 - scripts/ansible/restart_playbook.yml | 10 - .../roles/camino_base/tasks/centos-7.yml | 9 - .../roles/camino_base/tasks/centos-8.yml | 9 - .../roles/camino_base/tasks/debian.yml | 9 - .../ansible/roles/camino_base/tasks/main.yml | 8 - .../roles/camino_base/tasks/not_supported.yml | 10 - .../roles/camino_base/tasks/ubuntu.yml | 9 - .../roles/camino_build/defaults/main.yml | 5 - .../ansible/roles/camino_build/tasks/main.yml | 15 -- .../roles/camino_download/defaults/main.yml | 17 -- .../roles/camino_download/tasks/main.yml | 53 ----- .../roles/camino_install/defaults/main.yml | 25 --- .../roles/camino_install/tasks/main.yml | 84 ------- .../ansible/roles/camino_reset/tasks/main.yml | 9 - .../roles/camino_service/defaults/main.yml | 6 - .../roles/camino_service/handlers/main.yml | 10 - .../roles/camino_service/tasks/main.yml | 21 -- .../templates/avalanche.service | 29 --- .../roles/camino_staker/tasks/main.yml | 46 ---- .../roles/camino_start/defaults/main.yml | 2 - .../ansible/roles/camino_start/tasks/main.yml | 47 ---- .../ansible/roles/camino_stop/tasks/main.yml | 17 -- .../roles/camino_user/defaults/main.yml | 2 - .../ansible/roles/camino_user/tasks/main.yml | 14 -- .../roles/golang_base/defaults/main.yml | 12 - .../roles/golang_base/tasks/centos-7.yml | 17 -- .../roles/golang_base/tasks/centos-8.yml | 28 --- .../roles/golang_base/tasks/debian-10.yml | 58 ----- .../ansible/roles/golang_base/tasks/main.yml | 8 - .../roles/golang_base/tasks/not_supported.yml | 10 - .../roles/golang_base/tasks/ubuntu-18.04.yml | 32 --- .../roles/golang_base/tasks/ubuntu-20.04.yml | 1 - .../roles/public-ami/defaults/main.yml | 10 - .../ansible/roles/public-ami/tasks/main.yml | 109 --------- .../public-ami/templates/C/config.json.j2 | 1 - .../templates/avalanchego.service.j2 | 18 -- .../roles/public-ami/templates/conf.json.j2 | 9 - scripts/ansible/service_playbook.yml | 10 - scripts/ansible/update_playbook.yml | 10 - scripts/build.sh | 40 +++- scripts/build_and_test.sh | 2 +- scripts/build_avalanche.sh | 61 ------ scripts/build_camino.sh | 32 ++- scripts/build_image.sh | 19 +- scripts/build_local_image.sh | 14 -- scripts/build_publish_image.sh | 2 +- scripts/build_tmpnetctl.sh | 11 +- scripts/build_xsvm.sh | 2 +- scripts/constants.sh | 1 + scripts/tests.e2e.sh | 2 +- scripts/tests.upgrade.sh | 42 ++-- tests/e2e/README.md | 10 +- tests/fixture/e2e/flags.go | 6 +- tests/fixture/tmpnet/README.md | 22 +- tests/fixture/tmpnet/cmd/main.go | 6 +- tests/upgrade/upgrade_test.go | 8 +- 86 files changed, 235 insertions(+), 1419 deletions(-) create mode 100644 .github/workflows/buf-push.yml delete mode 100644 .github/workflows/build-docker.yml delete mode 100644 .github/workflows/build_artifacts.yml rename .github/workflows/{scripts => }/cleanup-net-outage-sim.sh (100%) mode change 100755 => 100644 .github/workflows/publish_image.sh rename .github/workflows/{scripts => }/run-net-outage-sim.sh (87%) delete mode 100644 .github/workflows/yum/specfile/camino-node.spec delete mode 100644 scripts/ansible/.ansible-lint delete mode 100644 scripts/ansible/README.md delete mode 100644 scripts/ansible/ansible.cfg delete mode 100644 scripts/ansible/create_public_ami.yml delete mode 100644 scripts/ansible/files/camino.gpg.key delete mode 100644 scripts/ansible/inventories/examples/amazon.yml delete mode 100644 scripts/ansible/inventories/localhost.yml delete mode 100644 scripts/ansible/inventories/raspberrypi.yml delete mode 100644 scripts/ansible/kill_playbook.yml delete mode 100644 scripts/ansible/ping_playbook.yml delete mode 100644 scripts/ansible/restart_playbook.yml delete mode 100644 scripts/ansible/roles/camino_base/tasks/centos-7.yml delete mode 100644 scripts/ansible/roles/camino_base/tasks/centos-8.yml delete mode 100644 scripts/ansible/roles/camino_base/tasks/debian.yml delete mode 100644 scripts/ansible/roles/camino_base/tasks/main.yml delete mode 100644 scripts/ansible/roles/camino_base/tasks/not_supported.yml delete mode 100644 scripts/ansible/roles/camino_base/tasks/ubuntu.yml delete mode 100644 scripts/ansible/roles/camino_build/defaults/main.yml delete mode 100644 scripts/ansible/roles/camino_build/tasks/main.yml delete mode 100644 scripts/ansible/roles/camino_download/defaults/main.yml delete mode 100644 scripts/ansible/roles/camino_download/tasks/main.yml delete mode 100644 scripts/ansible/roles/camino_install/defaults/main.yml delete mode 100644 scripts/ansible/roles/camino_install/tasks/main.yml delete mode 100644 scripts/ansible/roles/camino_reset/tasks/main.yml delete mode 100644 scripts/ansible/roles/camino_service/defaults/main.yml delete mode 100644 scripts/ansible/roles/camino_service/handlers/main.yml delete mode 100644 scripts/ansible/roles/camino_service/tasks/main.yml delete mode 100644 scripts/ansible/roles/camino_service/templates/avalanche.service delete mode 100644 scripts/ansible/roles/camino_staker/tasks/main.yml delete mode 100644 scripts/ansible/roles/camino_start/defaults/main.yml delete mode 100644 scripts/ansible/roles/camino_start/tasks/main.yml delete mode 100644 scripts/ansible/roles/camino_stop/tasks/main.yml delete mode 100644 scripts/ansible/roles/camino_user/defaults/main.yml delete mode 100644 scripts/ansible/roles/camino_user/tasks/main.yml delete mode 100644 scripts/ansible/roles/golang_base/defaults/main.yml delete mode 100644 scripts/ansible/roles/golang_base/tasks/centos-7.yml delete mode 100644 scripts/ansible/roles/golang_base/tasks/centos-8.yml delete mode 100644 scripts/ansible/roles/golang_base/tasks/debian-10.yml delete mode 100644 scripts/ansible/roles/golang_base/tasks/main.yml delete mode 100644 scripts/ansible/roles/golang_base/tasks/not_supported.yml delete mode 100644 scripts/ansible/roles/golang_base/tasks/ubuntu-18.04.yml delete mode 100644 scripts/ansible/roles/golang_base/tasks/ubuntu-20.04.yml delete mode 100644 scripts/ansible/roles/public-ami/defaults/main.yml delete mode 100644 scripts/ansible/roles/public-ami/tasks/main.yml delete mode 100644 scripts/ansible/roles/public-ami/templates/C/config.json.j2 delete mode 100644 scripts/ansible/roles/public-ami/templates/avalanchego.service.j2 delete mode 100644 scripts/ansible/roles/public-ami/templates/conf.json.j2 delete mode 100644 scripts/ansible/service_playbook.yml delete mode 100644 scripts/ansible/update_playbook.yml delete mode 100755 scripts/build_avalanche.sh delete mode 100755 scripts/build_local_image.sh diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c9737ad46f63..539095bbbfb4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,22 +1,3 @@ # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-syntax -* @StephenButtolph -/app/ @danlaine -/codec/ @danlaine -/database/corruptabledb/ @ceyonur -/ids/ @danlaine @joshua-kim -/indexer/ @danlaine -/message/ @gyuho -/network/ @danlaine @joshua-kim @StephenButtolph -/network/throttling/ @danlaine @dboehm-avalabs @StephenButtolph -/proto/ @gyuho -/snow/ @danlaine @StephenButtolph -/snow/consensus/ @gyuho @StephenButtolph -/snow/engine/snowman/syncer/ @abi87 -/snow/uptime/ @ceyonur -/utils/logging/ @ceyonur -/vms/platformvm/ @abi87 @danlaine @dhrubabasu @StephenButtolph -/vms/proposervm/ @abi87 @StephenButtolph -/vms/registry/ @joshua-kim -/tests/ @abi87 @gyuho @marun -/x/ @danlaine @darioush @dboehm-avalabs +* @evlekht diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dc12cb88f7c0..979bc55d9f27 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -20,7 +20,7 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. **Logs** -If applicable, please include the relevant logs that indicate a problem and/or the log directory of your node. By default, this can be found at `~/.avalanchego/logs/`. +If applicable, please include the relevant logs that indicate a problem and/or the log directory of your node. By default, this can be found at `~/.caminogo/logs/`. **Metrics** If applicable, please include any metrics gathered from your node to assist us in diagnosing the problem. diff --git a/.github/ISSUE_TEMPLATE/feature_spec.md b/.github/ISSUE_TEMPLATE/feature_spec.md index 6676db968241..0890f38c57b4 100644 --- a/.github/ISSUE_TEMPLATE/feature_spec.md +++ b/.github/ISSUE_TEMPLATE/feature_spec.md @@ -1,6 +1,6 @@ --- name: Feature specification -about: Discussion on design and implementation of new features for avalanchego. +about: Discussion on design and implementation of new features for caminogo. title: '' labels: enhancement assignees: '' diff --git a/.github/workflows/buf-push.yml b/.github/workflows/buf-push.yml new file mode 100644 index 000000000000..69fbdfdf3241 --- /dev/null +++ b/.github/workflows/buf-push.yml @@ -0,0 +1,15 @@ +name: buf-push + +on: + workflow_dispatch: + +jobs: + push: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: bufbuild/buf-setup-action@v1.34.0 + - uses: bufbuild/buf-push-action@v1 + with: + input: "proto" + buf_token: ${{ secrets.BUF_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/build-deb-pkg.sh b/.github/workflows/build-deb-pkg.sh index e01fe6017dcd..6399cb184748 100755 --- a/.github/workflows/build-deb-pkg.sh +++ b/.github/workflows/build-deb-pkg.sh @@ -3,16 +3,16 @@ set -euo pipefail DEBIAN_BASE_DIR=$PKG_ROOT/debian -AVALANCHE_BUILD_BIN_DIR=$DEBIAN_BASE_DIR/usr/local/bin +CAMINO_BUILD_BIN_DIR=$DEBIAN_BASE_DIR/usr/local/bin TEMPLATE=.github/workflows/debian/template DEBIAN_CONF=$DEBIAN_BASE_DIR/DEBIAN mkdir -p "$DEBIAN_BASE_DIR" mkdir -p "$DEBIAN_CONF" -mkdir -p "$AVALANCHE_BUILD_BIN_DIR" +mkdir -p "$CAMINO_BUILD_BIN_DIR" # Assume binaries are at default locations -OK=$(cp ./build/avalanchego "$AVALANCHE_BUILD_BIN_DIR") +OK=$(cp ./build/caminogo "$CAMINO_BUILD_BIN_DIR") if [[ $OK -ne 0 ]]; then exit "$OK"; fi @@ -33,5 +33,5 @@ NEW_VERSION_STRING="Version: $VER" NEW_ARCH_STRING="Architecture: $ARCH" sed -i "s/Version.*/$NEW_VERSION_STRING/g" debian/DEBIAN/control sed -i "s/Architecture.*/$NEW_ARCH_STRING/g" debian/DEBIAN/control -dpkg-deb --build debian "avalanchego-$TAG-$ARCH.deb" -aws s3 cp "avalanchego-$TAG-$ARCH.deb" "s3://${BUCKET}/linux/debs/ubuntu/$RELEASE/$ARCH/" +dpkg-deb --build debian "caminogo-$TAG-$ARCH.deb" +#gsutil cp "caminogogo-$TAG-$ARCH.deb" "gs://$BUCKET/linux/debs/ubuntu/$RELEASE/$ARCH/" diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml deleted file mode 100644 index 77ee3ce7c90d..000000000000 --- a/.github/workflows/build-docker.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Build + Publish Docker Image - -on: - release: - types: [created] - workflow_dispatch: - -jobs: - build_publish_image: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Build image and publish to DockerHub - env: - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASS: ${{ secrets.DOCKER_PASS }} - DOCKER_REPO: ${{ secrets.DOCKER_REPO }} - run: scripts/build_publish_image.sh diff --git a/.github/workflows/build-tgz-pkg.sh b/.github/workflows/build-tgz-pkg.sh index 4d6e11bfbd42..7a5211263117 100755 --- a/.github/workflows/build-tgz-pkg.sh +++ b/.github/workflows/build-tgz-pkg.sh @@ -2,11 +2,11 @@ set -euo pipefail -AVALANCHE_ROOT=$PKG_ROOT/avalanchego-$TAG +CAMINO_ROOT=$PKG_ROOT/caminogo-$TAG -mkdir -p "$AVALANCHE_ROOT" +mkdir -p "$CAMINO_ROOT" -OK=$(cp ./build/avalanchego "$AVALANCHE_ROOT") +OK=$(cp ./build/caminogo "$CAMINO_ROOT") if [[ $OK -ne 0 ]]; then exit "$OK"; fi @@ -15,5 +15,5 @@ fi echo "Build tgz package..." cd "$PKG_ROOT" echo "Tag: $TAG" -tar -czvf "avalanchego-linux-$ARCH-$TAG.tar.gz" "avalanchego-$TAG" -aws s3 cp "avalanchego-linux-$ARCH-$TAG.tar.gz" "s3://$BUCKET/linux/binaries/ubuntu/$RELEASE/$ARCH/" +tar -czvf "caminogo-linux-$ARCH-$TAG.tar.gz" "caminogo-$TAG" +#gsutil cp "caminogo-linux-$ARCH-$TAG.tar.gz" "gs://$BUCKET/linux/binaries/ubuntu/$RELEASE/$ARCH/" diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml deleted file mode 100644 index da2e6556558f..000000000000 --- a/.github/workflows/build_artifacts.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Build and publish on supported platforms - -on: - release: - types: [created] - -permissions: - contents: write - -jobs: - build-artifacts: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: '~1.20.12' - check-latest: true - - name: Run Build and Publish - shell: bash - run: scripts/build_releases.sh - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0641c2907912..6174627b5111 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,6 @@ name: Tests on: pull_request: - tags-ignore: ["*"] - branches: [chain4travel, dev] - push: branches: [chain4travel, dev] workflow_dispatch: merge_group: @@ -31,8 +28,8 @@ jobs: # os: [macos-12, ubuntu-20.04, ubuntu-22.04, windows-2022, [self-hosted, linux, ARM64, focal], [self-hosted, linux, ARM64, jammy]] os: [ubuntu-22.04] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ env.go_version }} check-latest: true @@ -48,8 +45,8 @@ jobs: Fuzz: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ env.go_version }} check-latest: true @@ -59,10 +56,10 @@ jobs: e2e: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v5 with: go-version: ${{ env.go_version }} check-latest: true @@ -73,7 +70,7 @@ jobs: shell: bash run: E2E_SERIAL=1 ./scripts/tests.e2e.sh - name: Upload tmpnet network dir - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: e2e-tmpnet-data @@ -82,10 +79,10 @@ jobs: e2e_existing_network: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v5 with: go-version: ${{ env.go_version }} check-latest: true @@ -96,39 +93,38 @@ jobs: shell: bash run: E2E_SERIAL=1 ./scripts/tests.e2e.existing.sh - name: Upload tmpnet network dir - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: e2e-existing-network-tmpnet-data path: ${{ env.tmpnet_data_path }} if-no-files-found: error - # TODO: re-activate this test after there is a compatible tag to use - # Upgrade: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - uses: actions/setup-go@v3 - # with: - # go-version: ${{ env.go_version }} - # check-latest: true - # - name: Build caminogo binaries - # shell: bash - # run: ./scripts/build.sh - # - name: Run e2e tests - # shell: bash - # run: ./scripts/tests.upgrade.sh - # - name: Upload tmpnet network dir - # uses: actions/upload-artifact@v3 - # if: always() - # with: - # name: upgrade-tmpnet-data - # path: ${{ env.tmpnet_data_path }} - # if-no-files-found: error + Upgrade: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.go_version }} + check-latest: true + - name: Build CaminoGo Binary + shell: bash + run: ./scripts/build.sh + - name: Run e2e tests + shell: bash + run: ./scripts/tests.upgrade.sh + - name: Upload tmpnet network dir + uses: actions/upload-artifact@v4 + if: always() + with: + name: upgrade-tmpnet-data + path: ${{ env.tmpnet_data_path }} + if-no-files-found: error Lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ env.go_version }} check-latest: true @@ -142,8 +138,8 @@ jobs: name: Protobuf Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1.26.1 + - uses: actions/checkout@v4 + - uses: bufbuild/buf-setup-action@v1.34.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} - uses: bufbuild/buf-lint-action@v1 @@ -153,12 +149,12 @@ jobs: name: Up-to-date protobuf runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ env.go_version }} check-latest: true - - uses: bufbuild/buf-setup-action@v1.26.1 + - uses: bufbuild/buf-setup-action@v1.34.0 - shell: bash run: scripts/protobuf_codegen.sh - shell: bash @@ -167,8 +163,8 @@ jobs: name: Up-to-date mocks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ env.go_version }} check-latest: true @@ -180,22 +176,22 @@ jobs: name: Up-to-date go.mod and go.sum runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ env.go_version }} check-latest: true - shell: bash run: go mod tidy - shell: bash - run: .github/workflows/check-clean-branch.sh + run: .github/workflows/scripts/check-clean-branch.sh build_docker_image: name: Test docker image building runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Build docker image - run: scripts/build_local_image.sh + run: scripts/build_image.sh diff --git a/.github/workflows/scripts/cleanup-net-outage-sim.sh b/.github/workflows/cleanup-net-outage-sim.sh similarity index 100% rename from .github/workflows/scripts/cleanup-net-outage-sim.sh rename to .github/workflows/cleanup-net-outage-sim.sh diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f2a39eab2fae..7f8c1861aa77 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -12,11 +12,9 @@ name: "CodeQL" on: - push: - branches: [chain4travel, dev] pull_request: - tags-ignore: ["*"] branches: [chain4travel, dev] + workflow_dispatch: merge_group: types: [checks_requested] @@ -38,11 +36,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -53,7 +51,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -67,4 +65,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/debian/template/control b/.github/workflows/debian/template/control index f347eb067358..e986a8dbdbce 100644 --- a/.github/workflows/debian/template/control +++ b/.github/workflows/debian/template/control @@ -1,5 +1,5 @@ -Package: camino-go -Version: 0.2.0 +Package: caminogo +Version: 1.1.0 Section: misc Priority: optional Architecture: arm64 diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index fdca7ab41b8b..6db622e3acdb 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -2,7 +2,8 @@ name: Run fuzz tests on: schedule: - - cron: "0 0 * * *" + # Run every Saturday at 9 am + - cron: "0 9 * * 6" permissions: contents: read @@ -12,11 +13,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Git checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: 'dev' - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: '~1.20.12' check-latest: true diff --git a/.github/workflows/fuzz_merkledb.yml b/.github/workflows/fuzz_merkledb.yml index c232bd933d17..e2f55577c50a 100644 --- a/.github/workflows/fuzz_merkledb.yml +++ b/.github/workflows/fuzz_merkledb.yml @@ -3,8 +3,8 @@ name: Scheduled Fuzz Testing on: workflow_dispatch: schedule: - # Run every 6 hours - - cron: "0 0,6,12,18 * * *" + # Run every Saturday at 9 am + - cron: "0 9 * * 6" permissions: contents: read @@ -14,11 +14,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Git checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: 'dev' - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: '~1.20.12' check-latest: true diff --git a/.github/workflows/net-outage-sim.yml b/.github/workflows/net-outage-sim.yml index d31e62d1de66..3f5bbdfbb150 100644 --- a/.github/workflows/net-outage-sim.yml +++ b/.github/workflows/net-outage-sim.yml @@ -4,7 +4,8 @@ on: #schedule: # * is a special character in YAML so you have to quote this string # Run every day at 7 AM. (The database backup is created around 5 AM.) - # - cron: "0 7 * * *" + # disabled because of needed storage of network db + # - cron: "0 9 * * 6" workflow_dispatch: jobs: @@ -13,20 +14,20 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Cleanup docker (avoid conflicts with previous runs) shell: bash - run: .github/workflows/scripts/cleanup-net-outage-sim.sh + run: .github/workflows/cleanup-net-outage-sim.sh - name: Download caminogo:latest run: docker pull chain4travel/caminogo:latest - name: Run the internet outage simulation shell: bash - run: .github/workflows/scripts/run-net-outage-sim.sh + run: .github/workflows/run-net-outage-sim.sh - name: Cleanup again if: always() # Always clean up shell: bash - run: .github/workflows/scripts/cleanup-net-outage-sim.sh + run: .github/workflows/cleanup-net-outage-sim.sh diff --git a/.github/workflows/publish_image.sh b/.github/workflows/publish_image.sh old mode 100755 new mode 100644 index 0aef0feb5cec..5a9eb609bd8c --- a/.github/workflows/publish_image.sh +++ b/.github/workflows/publish_image.sh @@ -7,23 +7,23 @@ if [[ -z "$DOCKER_USERNAME" ]]; then exit 0; fi -# Avalanche root directory -AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ../.. && pwd ) +# Camino root directory +CAMINO_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ../.. && pwd ) # Load the constants -source "$AVALANCHE_PATH"/scripts/constants.sh +source "$CAMINO_PATH"/scripts/constants.sh -# Build current avalanchego -source "$AVALANCHE_PATH"/scripts/build_image.sh -r +# Build current caminogo +source "$CAMINO_PATH"/scripts/build_image.sh -r if [[ $current_branch == "master" ]]; then - echo "Tagging current avalanchego image as $avalanchego_dockerhub_repo:latest" - docker tag "$avalanchego_dockerhub_repo:$current_branch" "$avalanchego_dockerhub_repo:latest" + echo "Tagging current caminogo image as $caminogo_dockerhub_repo:latest" + docker tag "$caminogo_dockerhub_repo:$current_branch" "$caminogo_dockerhub_repo:latest" fi -echo "Pushing: $avalanchego_dockerhub_repo:$current_branch" +echo "Pushing: $caminogo_dockerhub_repo:$current_branch" echo "$DOCKER_PASS" | docker login --username "$DOCKER_USERNAME" --password-stdin ## pushing image with tags -docker image push -a "$avalanchego_dockerhub_repo" +docker image push -a "$caminogo_dockerhub_repo" \ No newline at end of file diff --git a/.github/workflows/scripts/run-net-outage-sim.sh b/.github/workflows/run-net-outage-sim.sh similarity index 87% rename from .github/workflows/scripts/run-net-outage-sim.sh rename to .github/workflows/run-net-outage-sim.sh index 7d1adf3ada1f..52f5f902a663 100644 --- a/.github/workflows/scripts/run-net-outage-sim.sh +++ b/.github/workflows/run-net-outage-sim.sh @@ -43,18 +43,10 @@ rm -rf /var/lib/caminogo 2>/dev/null || true # Do || true to ignore error if fil echo "done existing database files" #download latest mainnet DB backup -FILENAME="mainnet-db-daily-" -DATE=$(date +'%m-%d-%Y') -DB_FILE="$FILENAME$DATE" -echo "Copying database file $DB_FILE from S3 to local..." -aws s3 cp s3://camino-db-daily/ /opt/ --no-progress --recursive --exclude "*" --include "$DB_FILE*" -echo "Done downloading database" - -# extract DB -echo "Extracting database..." +echo "Copying database from gcs to local..." mkdir -p /var/lib/caminogo/db -tar -zxf /opt/"$DB_FILE"*-tar.gz -C /var/lib/caminogo/db -echo "Done extracting database" +gsutil cp gs://camino-db/* /var/lib/caminogo/db + echo "Creating Docker network..." docker network create controlled-net diff --git a/.github/workflows/yum/specfile/camino-node.spec b/.github/workflows/yum/specfile/camino-node.spec deleted file mode 100644 index 40f450304020..000000000000 --- a/.github/workflows/yum/specfile/camino-node.spec +++ /dev/null @@ -1,19 +0,0 @@ -%define _build_id_links none - -Name: caminogo -Version: %{version} -Release: %{release} -Summary: The Camino platform binaries -URL: https://github.com/chain4travel/%{name} -License: BSD-3 -AutoReqProv: no - -%description -Camino is a lightweight protocol which runs on moderate computer requirements. - -%files -/usr/local/bin/caminogo - -%changelog -* Fri Apr 15 2022 devop -- Initial version diff --git a/README.md b/README.md index ca5e8e379ff0..b6011485e30c 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Make sure docker is installed on the machine - so commands like `docker run` etc Building the docker image of latest caminogo branch can be done by running: ```sh -./scripts/build_local_image.sh +./scripts/build_image.sh ``` To check the built image, run: @@ -165,7 +165,7 @@ This should only be necessary when modifying exported interfaces or after modify ### Version Semantics -AvalancheGo is first and foremost a client for the Avalanche network. The versioning of AvalancheGo follows that of the Avalanche network. +CaminoGo is first and foremost a client for the Camino network. The versioning of CaminoGo follows that of the Camino network. - `v0.x.x` indicates a development network version. - `v1.x.x` indicates a production network version. @@ -174,11 +174,11 @@ AvalancheGo is first and foremost a client for the Avalanche network. The versio ### Library Compatibility Guarantees -Because AvalancheGo's version denotes the network version, it is expected that interfaces exported by AvalancheGo's packages may change in `Patch` version updates. +Because CaminoGo's version denotes the network version, it is expected that interfaces exported by CaminoGo's packages may change in `Patch` version updates. ### API Compatibility Guarantees -APIs exposed when running AvalancheGo will maintain backwards compatibility, unless the functionality is explicitly deprecated and announced when removed. +APIs exposed when running CaminoGo will maintain backwards compatibility, unless the functionality is explicitly deprecated and announced when removed. ## Supported Platforms diff --git a/RELEASES.md b/RELEASES.md index 3dc879172c5f..a36088ca92f5 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4,8 +4,8 @@ This version is the first one running on our testnet. The supported plugin version is `20`. -### AvalancheGo version -- Based on avalanchego [v1.9.4](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.4) +### CaminoGo version +- Based on caminogo [v1.1.0](https://github.com/chain4travel/caminogo/releases/tag/v1.1.0) ### Camino features - Added AddressStates to track KYC and other address related states diff --git a/scripts/ansible/.ansible-lint b/scripts/ansible/.ansible-lint deleted file mode 100644 index b576e34d7454..000000000000 --- a/scripts/ansible/.ansible-lint +++ /dev/null @@ -1,3 +0,0 @@ -parsable: true - -# vim: filetype=yaml diff --git a/scripts/ansible/README.md b/scripts/ansible/README.md deleted file mode 100644 index e1c14a86acc6..000000000000 --- a/scripts/ansible/README.md +++ /dev/null @@ -1,206 +0,0 @@ -# Ansible for Camino-Node - -[Ansible](https://ansible.com) playbooks, roles, & inventories to install -[Caminogo](https://github.com/chain4travel/caminogo) as a systemd service. -Target(s) can be - -- localhost -- Cloud VMs (e.g. Amazon, Azure, Digital Ocean) -- Raspberry Pi -- any host running a supported operating system -- any combination of the above - - -## Using - -To create a Camino-Node service on localhost - -1. Check you have Ansible 2.9+ (see [Installing](#installing)) -2. Clone the Caminogo git repository - ``` - $ git clone https://github.com/chain4travel/caminogo - ``` - -3. Change to this directory - ``` - $ cd caminogo/scripts/ansible - ``` - -4. Run the service playbook - ``` - $ ansible-playbook \ - -i inventories/localhost.yml \ - --ask-become-pass \ - service_playbook.yml - ``` - - You don't need `--ask-become-pass` if your account doesn't require a sudo - password. To install on remote hosts you will need to create an inventory, - see [customising]. - - Output should look similar to the [example run](#example-run). - -5. Check the service is running - ``` - $ systemctl status caminogo - ``` - - The output should look similar to - ``` - ● caminogo.service - Camino node for Camino consensus network - Loaded: loaded (/etc/systemd/system/caminogo.service; enabled; vendor preset: enabled) - Active: active (running) since Wed 2020-10-21 10:00:00 UTC; 32s ago - ... - ``` - - -## Installing - -Ansible 2.9 (or higher) is required. To check, run - -``` -ansible --version -``` - -the first line of output should be like `ansible 2.9.x`, or `ansible 2.10.x` -(`x` can be any number). If the output includes `ansible: command not found`, -or an earlier version (e.g. `ansible 2.8.16`), then you need to install a -supported version. - -To install a supported version - -1. Create a Python Virtualenv - ``` - $ python3 -m venv venv/ - ``` - -2. Activate the Virtualenv - ``` - $ source venv/bin/activate - ``` - -4. Install Ansible inside the virtualenv - ``` - $ pip install "ansible>=2.9" - ``` - - -## Customising - -To run against remote targets you'll need an [Ansible inventory](https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#inventory-basics-formats-hosts-and-groups). -Here are some examples to use as a starting point. - -### Amazon - -```yaml -camino_nodes: - hosts: - ec2-203-0-113-42.us-east-1.compute.amazonaws.com: - ec2-203-0-113-9.ap-southeast-1.compute.amazonaws.com: - vars: - ansible_ssh_private_key_file: "~/.ssh/aws_identity.pem" - ansible_user: "ubuntu" -``` - -### Raspberry Pi - -```yaml -camino_nodes: - hosts: - raspberrypi.local: - vars: - ansible_user: "pi" -``` - -## Requirements - -Target operating systems supported by these roles & playbooks are - -- CentOS 7 -- CentOS 8 -- Debian 10 -- Raspberry Pi OS -- Ubuntu 18.04 LTS -- Ubuntu 20.04 LTS - - -## Example run - -``` -PLAY [Configure Camino service] ********************************************* - -TASK [Gathering Facts] ********************************************************* -ok: [localhost] - -TASK [camino_download : Query releases] ************************************* -ok: [localhost] - -TASK [camino_download : Fetch release] ************************************** -changed: [localhost] => (item=caminogo-linux-arm64-v0.0.0.tar.gz) -changed: [localhost] => (item=caminogo-linux-arm64-v0.0.0.tar.gz.sig) - -TASK [camino_download : Create temp gnupghome] ****************************** -changed: [localhost] - -TASK [camino_download : Import keys] **************************************** -changed: [localhost] - -TASK [camino_download : Verify signature] *********************************** -ok: [localhost] - -TASK [camino_download : Cleanup temp gnupghome] ***************************** -changed: [localhost] - -TASK [camino_download : Unpack release] ************************************* -changed: [localhost] => (item=caminogo-linux-arm64-v1.5.0.tar.gz) - -TASK [camino_user : Create Camino daemon group] ************************** -changed: [localhost] - -TASK [camino_user : Create Camino daemon user] *************************** -changed: [localhost] - -TASK [camino_install : Create shared directories] *************************** -changed: [localhost] => (item={'path': '/usr/local/bin'}) -changed: [localhost] => (item={'path': '/var/local/lib'}) -changed: [localhost] => (item={'path': '/var/local/log'}) - -TASK [camino_install : Create Camino directories] ************************ -changed: [localhost] => (item=/var/local/lib/caminogo) -changed: [localhost] => (item=/var/local/lib/caminogo/db) -changed: [localhost] => (item=/var/local/lib/caminogo/staking) -changed: [localhost] => (item=/var/local/log/caminogo) -changed: [localhost] => (item=/usr/local/lib/caminogo) - -TASK [camino_install : Install Camino binary] **************************** -changed: [localhost] - -TASK [camino_install : Remove outdated support files] ********************** -ok: [localhost] => (item={'path': '/usr/local/lib/caminogo/evm'}) -ok: [localhost] => (item={'path': '/usr/local/lib/caminogo/caminogo-preupgrade'}) -ok: [localhost] => (item={'path': '/usr/local/lib/caminogo/caminogo-latest'}) - -TASK [camino_install : Install support files] ******************************* -changed: [localhost] => (item=/usr/local/lib/caminogo/plugins) - -TASK [camino_staker : Create staking key] *********************************** -changed: [localhost] - -TASK [camino_staker : Create staking certificate signing request] *********** -changed: [localhost] - -TASK [camino_staker : Create staking certificate] *************************** -changed: [localhost] - -TASK [camino_service : Configure Camino service] ************************* -changed: [localhost] - -TASK [camino_service : Enable Camino service] **************************** -changed: [localhost] - -RUNNING HANDLER [camino_service : Restart Camino service] **************** -changed: [localhost] - -PLAY RECAP ********************************************************************* -localhost : ok=6 changed=24 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 -``` diff --git a/scripts/ansible/ansible.cfg b/scripts/ansible/ansible.cfg deleted file mode 100644 index 17be8384879b..000000000000 --- a/scripts/ansible/ansible.cfg +++ /dev/null @@ -1,16 +0,0 @@ -[defaults] -any_errors_fatal = true -transport = ssh -deprecation_warnings = false -host_key_checking = false - -[ssh_connection] -# Optimisation, speeds up playbook execution by reducing network round trips. -# However, remote systems must not have requiretty set in /etc/sudoers. -pipelining = true -ssh_args = - -C - -o ControlMaster=auto - -o ControlPersist=60s - -o ForwardAgent=yes - -o UserKnownHostsFile=/dev/null diff --git a/scripts/ansible/create_public_ami.yml b/scripts/ansible/create_public_ami.yml deleted file mode 100644 index 409b4b304595..000000000000 --- a/scripts/ansible/create_public_ami.yml +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env ansible-playbook ---- -- name: Create a public AMI image for AWS Marketplace - connection: ssh - gather_facts: false - become: yes - hosts: all - roles: - - name: public-ami diff --git a/scripts/ansible/files/camino.gpg.key b/scripts/ansible/files/camino.gpg.key deleted file mode 100644 index d439c418d016..000000000000 --- a/scripts/ansible/files/camino.gpg.key +++ /dev/null @@ -1,2 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- ------END PGP PUBLIC KEY BLOCK----- \ No newline at end of file diff --git a/scripts/ansible/inventories/examples/amazon.yml b/scripts/ansible/inventories/examples/amazon.yml deleted file mode 100644 index 5d33ab777d63..000000000000 --- a/scripts/ansible/inventories/examples/amazon.yml +++ /dev/null @@ -1,7 +0,0 @@ -camino_nodes: - hosts: - must-be-specified.compute.amazonaws.com: - must-be-specified.compute.amazonaws.com: - vars: - ansible_ssh_private_key_file: "~/.ssh/aws_identity.pem" - ansible_user: "camino" diff --git a/scripts/ansible/inventories/localhost.yml b/scripts/ansible/inventories/localhost.yml deleted file mode 100644 index 4d8c592a9d19..000000000000 --- a/scripts/ansible/inventories/localhost.yml +++ /dev/null @@ -1,4 +0,0 @@ -camino_nodes: - hosts: - localhost: - ansible_connection: local diff --git a/scripts/ansible/inventories/raspberrypi.yml b/scripts/ansible/inventories/raspberrypi.yml deleted file mode 100644 index 8d7fbead4f9c..000000000000 --- a/scripts/ansible/inventories/raspberrypi.yml +++ /dev/null @@ -1,5 +0,0 @@ -camino_nodes: - hosts: - raspberrypi.local: - vars: - ansible_user: "pi" diff --git a/scripts/ansible/kill_playbook.yml b/scripts/ansible/kill_playbook.yml deleted file mode 100644 index 2f2bea74a94a..000000000000 --- a/scripts/ansible/kill_playbook.yml +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ansible-playbook ---- -- name: Update the network - connection: ssh - gather_facts: false - hosts: all - roles: - - name: camino_stop diff --git a/scripts/ansible/ping_playbook.yml b/scripts/ansible/ping_playbook.yml deleted file mode 100644 index 83f5c0b3d9a4..000000000000 --- a/scripts/ansible/ping_playbook.yml +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env ansible-playbook ---- -- name: Update the network - connection: ssh - gather_facts: false - hosts: all - tasks: - - name: Ping node - ping: diff --git a/scripts/ansible/restart_playbook.yml b/scripts/ansible/restart_playbook.yml deleted file mode 100644 index cafe8702438a..000000000000 --- a/scripts/ansible/restart_playbook.yml +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env ansible-playbook ---- -- name: Update the network - connection: ssh - hosts: all - roles: - - name: camino_stop - - name: camino_build - - name: camino_reset - - name: camino_start diff --git a/scripts/ansible/roles/camino_base/tasks/centos-7.yml b/scripts/ansible/roles/camino_base/tasks/centos-7.yml deleted file mode 100644 index a29816477090..000000000000 --- a/scripts/ansible/roles/camino_base/tasks/centos-7.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: Install Camino dependencies - become: true - yum: - name: - - git - # Staking key management - - openssl - - python-cryptography # Python 2.x bindings - state: present diff --git a/scripts/ansible/roles/camino_base/tasks/centos-8.yml b/scripts/ansible/roles/camino_base/tasks/centos-8.yml deleted file mode 100644 index 2da387f89986..000000000000 --- a/scripts/ansible/roles/camino_base/tasks/centos-8.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: Install Camino dependencies - become: true - yum: - name: - - git - # Staking key management - - openssl - - python3-cryptography - state: present diff --git a/scripts/ansible/roles/camino_base/tasks/debian.yml b/scripts/ansible/roles/camino_base/tasks/debian.yml deleted file mode 100644 index df177e30bb27..000000000000 --- a/scripts/ansible/roles/camino_base/tasks/debian.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: Install Camino dependencies - become: true - apt: - name: - - git - # Staking key management - - openssl - - python3-cryptography - state: present diff --git a/scripts/ansible/roles/camino_base/tasks/main.yml b/scripts/ansible/roles/camino_base/tasks/main.yml deleted file mode 100644 index d76021c19629..000000000000 --- a/scripts/ansible/roles/camino_base/tasks/main.yml +++ /dev/null @@ -1,8 +0,0 @@ -- name: Dispatch tasks - include_tasks: "{{ item }}" - with_first_found: - - "{{ ansible_facts.distribution | lower }}-{{ ansible_facts.distribution_major_version }}.yml" - - "{{ ansible_facts.distribution | lower }}.yml" - - "not_supported.yml" - tags: - - camino_base diff --git a/scripts/ansible/roles/camino_base/tasks/not_supported.yml b/scripts/ansible/roles/camino_base/tasks/not_supported.yml deleted file mode 100644 index 841ddde1315e..000000000000 --- a/scripts/ansible/roles/camino_base/tasks/not_supported.yml +++ /dev/null @@ -1,10 +0,0 @@ -- name: Not supported - fail: - msg: - This operating system is not supported by this role - (system={{ ansible_facts.system }}, - os_family={{ ansible_facts.os_family }}, - distribution={{ ansible_facts.distribution }}, - distribution_version={{ ansible_facts.distribution_version }}). - tags: - - camino_base diff --git a/scripts/ansible/roles/camino_base/tasks/ubuntu.yml b/scripts/ansible/roles/camino_base/tasks/ubuntu.yml deleted file mode 100644 index df177e30bb27..000000000000 --- a/scripts/ansible/roles/camino_base/tasks/ubuntu.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: Install Camino dependencies - become: true - apt: - name: - - git - # Staking key management - - openssl - - python3-cryptography - state: present diff --git a/scripts/ansible/roles/camino_build/defaults/main.yml b/scripts/ansible/roles/camino_build/defaults/main.yml deleted file mode 100644 index 5a085916c285..000000000000 --- a/scripts/ansible/roles/camino_build/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -camino_binaries_dir: "{{ repo_folder }}/build" -repo_folder: "~{{ ansible_facts.user_id }}/go/src/github.com/chain4travel/caminogo" -repo_name: chain4travel/caminogo -repo_url: https://github.com/{{ repo_name }} -repo_branch: dev diff --git a/scripts/ansible/roles/camino_build/tasks/main.yml b/scripts/ansible/roles/camino_build/tasks/main.yml deleted file mode 100644 index ad1505fb48c4..000000000000 --- a/scripts/ansible/roles/camino_build/tasks/main.yml +++ /dev/null @@ -1,15 +0,0 @@ -- name: Update git clone - git: - repo: "{{ repo_url }}" - dest: "{{ repo_folder }}" - version: "{{ repo_branch }}" - update: yes - force: yes - -- name: Build project - # noqa 301 - command: ./scripts/build.sh - args: - chdir: "{{ repo_folder }}" - environment: - PATH: /usr/lib/go-{{ golang_version_min_major }}.{{ golang_version_min_minor }}/bin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin diff --git a/scripts/ansible/roles/camino_download/defaults/main.yml b/scripts/ansible/roles/camino_download/defaults/main.yml deleted file mode 100644 index 9dfc77127edc..000000000000 --- a/scripts/ansible/roles/camino_download/defaults/main.yml +++ /dev/null @@ -1,17 +0,0 @@ -caminogo_architectures: - x86_64: amd64 - aarch64: arm64 - -camino_binaries_dir: "caminogo-{{ caminogo_version }}" - -caminogo_architecture: "{{ caminogo_architectures[ansible_facts.architecture] }}" -caminogo_archive: "caminogo-{{ caminogo_os }}-{{ caminogo_architecture }}-{{ caminogo_version }}.tar.gz" -caminogo_release: "{{ caminogo_releases.json | rejectattr('prerelease') | first }}" -caminogo_os: "{{ ansible_facts.system | lower }}" -caminogo_version: "{{ caminogo_release.tag_name }}" - -caminogo_signer_keyid: D93080B0C0D5FE8B -caminogo_signer_pubkey: "{{ lookup('file', 'caminogo.gpg.key') }}" - -repo_url: https://github.com/chain4travel/caminogo -repo_api_base: https://api.github.com diff --git a/scripts/ansible/roles/camino_download/tasks/main.yml b/scripts/ansible/roles/camino_download/tasks/main.yml deleted file mode 100644 index 93ccb5ae327b..000000000000 --- a/scripts/ansible/roles/camino_download/tasks/main.yml +++ /dev/null @@ -1,53 +0,0 @@ -- name: Query releases - uri: - url: "{{ repo_api_base }}/repos{{ repo_url | urlsplit('path') }}/releases" - register: caminogo_releases - changed_when: false - check_mode: false - -- name: Fetch release - get_url: - url: "{{ repo_url }}/releases/download/{{ caminogo_version }}/{{ item.file }}" - dest: ./ - loop: - - file: "{{ caminogo_archive }}" - - file: "{{ caminogo_archive }}.sig" - loop_control: - label: "{{ item.file }}" - -- name: Verify release - block: - - name: Create temp gnupghome - tempfile: - state: directory - suffix: gpg - register: camino_download_gnupghome - - - name: Import keys - environment: - GNUPGHOME: "{{ camino_download_gnupghome.path }}" - command: - cmd: gpg --import - stdin: "{{ caminogo_signer_pubkey }}" - - - name: Verify signature - environment: - GNUPGHOME: "{{ camino_download_gnupghome.path }}" - command: - cmd: gpg --trusted-key "{{ caminogo_signer_keyid }}" --verify "{{ caminogo_archive }}.sig" "{{ caminogo_archive }}" - changed_when: false - always: - - name: Cleanup temp gnupghome - file: - path: "{{ camino_download_gnupghome.path }}" - state: absent - -- name: Unpack release - unarchive: - src: "{{ caminogo_archive }}" - dest: ./ - remote_src: true - loop: - - file: "{{ caminogo_archive }}" - loop_control: - label: "{{ item.file }}" diff --git a/scripts/ansible/roles/camino_install/defaults/main.yml b/scripts/ansible/roles/camino_install/defaults/main.yml deleted file mode 100644 index 60233f6157b2..000000000000 --- a/scripts/ansible/roles/camino_install/defaults/main.yml +++ /dev/null @@ -1,25 +0,0 @@ -# These names, & default values are based on Meson build builtin options; -# which in turn follow established *nix conventions. -# See -# https://mesonbuild.com/Builtin-options.html -# https://www.gnu.org/prep/standards/html_node/Directory-Variables.html -prefix: "/usr/local" -bindir: "{{ prefix }}/bin" -libdir: "{{ prefix }}/lib" -localstatedir: "{{ prefix | replace('/usr', '/var') }}" -sharedstatedir: "{{ localstatedir }}/lib" -# Has no Meson builtin equivalent -logdir: "{{ localstatedir }}/log" - -camino_binary: "{{ camino_binaries_dir }}/caminogo" - -# These names are specific to Camino. Default values are based loosely on *nix -# conventions. -camino_daemon_home_dir: "{{ sharedstatedir }}/caminogo" -camino_daemon_db_dir: "{{ camino_daemon_home_dir }}/db" -camino_daemon_log_dir: "{{ logdir }}/caminogo" -camino_daemon_lib_dir: "{{ libdir }}/caminogo" -camino_daemon_staking_dir: "{{ camino_daemon_home_dir }}/staking" -camino_daemon_staking_tls_cert: "{{ camino_daemon_staking_dir }}/staker.crt" -camino_daemon_staking_tls_csr: "{{ camino_daemon_staking_dir }}/staker.csr" -camino_daemon_staking_tls_key: "{{ camino_daemon_staking_dir }}/staker.key" diff --git a/scripts/ansible/roles/camino_install/tasks/main.yml b/scripts/ansible/roles/camino_install/tasks/main.yml deleted file mode 100644 index 4207b51030d2..000000000000 --- a/scripts/ansible/roles/camino_install/tasks/main.yml +++ /dev/null @@ -1,84 +0,0 @@ -- name: Create shared directories - become: true - file: - path: "{{ item.path }}" - state: directory - # This task intentionally leaves the owner, group, & mode unspecified. - # These directories (e.g. /var/local/log) are shared resources. - # We lack the authority to unilaterally decide their permissions. - # The goals are - # - Don't modify existing permissions, if the directories already exist. - # - Follow system policy (e.g. umask ), if the directories are created. - # noqa 208 - loop: - - path: "{{ bindir }}" - - path: "{{ sharedstatedir }}" - - path: "{{ logdir }}" - -- name: Create Camino directories - become: true - file: - path: "{{ item.path }}" - owner: "{{ item.owner | default(camino_daemon_user) }}" - group: "{{ item.group | default(camino_daemon_group) }}" - mode: "{{ item.mode }}" - recurse: "{{ item.recurse | default(omit) }}" - state: directory - loop: - - path: "{{ camino_daemon_home_dir }}" - mode: u=rwX,go=rX - - path: "{{ camino_daemon_db_dir }}" - mode: u=rwX,go=rX - - path: "{{ camino_daemon_staking_dir }}" - mode: u=rX,go= - - path: "{{ camino_daemon_log_dir }}" - mode: u=rwX,go=rX - - path: "{{ camino_daemon_lib_dir }}" - owner: root - group: root - mode: u=rwX,go=rX - recurse: true - loop_control: - label: "{{ item.path }}" - notify: - - Restart Camino service - -- name: Install Camino binary - become: true - copy: - src: "{{ camino_binary }}" - dest: "{{ bindir }}/{{ camino_binary | basename }}" - remote_src: true - owner: root - group: root - mode: u=rwx,go=rx - notify: - - Restart Camino service - -- name: Remove outdated support files - become: true - file: - path: "{{ item.path }}" - state: absent - loop: - - path: "{{ camino_daemon_lib_dir }}/evm" - - path: "{{ camino_daemon_lib_dir }}/caminogo-preupgrade" - - path: "{{ camino_daemon_lib_dir }}/caminogo-latest" - notify: - - Restart Camino service - -- name: Install support files - become: true - copy: - src: "{{ item.src }}" - dest: "{{ camino_daemon_lib_dir }}/" - owner: root - group: root - mode: u=rwx,go=rx - remote_src: true - loop: - - src: "{{ camino_binaries_dir }}/plugins" - loop_control: - label: "{{ camino_daemon_lib_dir }}/{{ item.src | basename }}" - notify: - - Restart Camino service diff --git a/scripts/ansible/roles/camino_reset/tasks/main.yml b/scripts/ansible/roles/camino_reset/tasks/main.yml deleted file mode 100644 index e2e9bdad6210..000000000000 --- a/scripts/ansible/roles/camino_reset/tasks/main.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: Remove previous database - file: - path: "{{ db_dir }}" - state: absent - -- name: Remove previous logs - file: - path: "{{ log_dir }}" - state: absent diff --git a/scripts/ansible/roles/camino_service/defaults/main.yml b/scripts/ansible/roles/camino_service/defaults/main.yml deleted file mode 100644 index 38f00a48efab..000000000000 --- a/scripts/ansible/roles/camino_service/defaults/main.yml +++ /dev/null @@ -1,6 +0,0 @@ -camino_daemon_dynamic_public_ip: ifconfigme -camino_daemon_http_host: localhost -# This variable is ignored, if camino_daemon_dynamic_public_ip is not false -camino_daemon_public_ip: "{{ ansible_facts.default_ipv4.address }}" -camino_daemon_service_name: caminogo -log_level: info diff --git a/scripts/ansible/roles/camino_service/handlers/main.yml b/scripts/ansible/roles/camino_service/handlers/main.yml deleted file mode 100644 index bcac39baac76..000000000000 --- a/scripts/ansible/roles/camino_service/handlers/main.yml +++ /dev/null @@ -1,10 +0,0 @@ -- name: Reload systemd - become: true - systemd: - daemon_reload: true - -- name: Restart Camino service - become: true - service: - name: "{{ camino_daemon_service_name }}" - state: restarted diff --git a/scripts/ansible/roles/camino_service/tasks/main.yml b/scripts/ansible/roles/camino_service/tasks/main.yml deleted file mode 100644 index 0f34518c46db..000000000000 --- a/scripts/ansible/roles/camino_service/tasks/main.yml +++ /dev/null @@ -1,21 +0,0 @@ -- name: Configure Camino service - become: true - template: - src: camino.service - dest: "/etc/systemd/system/{{ camino_daemon_service_name }}.service" - owner: root - group: root - mode: u=rw,go=r - notify: - - Reload systemd - - Restart Camino service - -- name: Enable Camino service - become: true - systemd: - name: "{{ camino_daemon_service_name }}" - state: started - enabled: true - daemon_reload: true - notify: - - Restart Camino service diff --git a/scripts/ansible/roles/camino_service/templates/avalanche.service b/scripts/ansible/roles/camino_service/templates/avalanche.service deleted file mode 100644 index da037f07d768..000000000000 --- a/scripts/ansible/roles/camino_service/templates/avalanche.service +++ /dev/null @@ -1,29 +0,0 @@ -# {{ ansible_managed }} - -[Unit] -Description=Caminogo node -Documentation=https://docs.camino.network/ -After=network.target -StartLimitIntervalSec=0 - -[Service] -Type=simple -WorkingDirectory={{ camino_daemon_home_dir }} -Restart=always -RestartSec=1 -User={{ camino_daemon_user }} -ExecStart={{ bindir }}/{{ camino_binary | basename }} \ -{% if camino_daemon_dynamic_public_ip %} - --dynamic-public-ip="{{ camino_daemon_dynamic_public_ip }}" \ -{% else %} - --public-ip="{{ camino_daemon_public_ip }}" \ -{% endif %} - --http-host="{{ camino_daemon_http_host }}" \ - --db-dir="{{ camino_daemon_db_dir }}" \ - --log-dir="{{ camino_daemon_log_dir }}" \ - --log-level="{{ log_level }}" \ - --staking-tls-cert-file="{{ camino_daemon_staking_tls_cert }}" \ - --staking-tls-key-file="{{ camino_daemon_staking_tls_key }}" - -[Install] -WantedBy=multi-user.target diff --git a/scripts/ansible/roles/camino_staker/tasks/main.yml b/scripts/ansible/roles/camino_staker/tasks/main.yml deleted file mode 100644 index 9ec2cf4d1390..000000000000 --- a/scripts/ansible/roles/camino_staker/tasks/main.yml +++ /dev/null @@ -1,46 +0,0 @@ -- name: Create staking key - become: true - openssl_privatekey: - path: "{{ camino_daemon_staking_tls_key }}" - size: 4096 - backup: true - owner: "{{ camino_daemon_user }}" - group: "{{ camino_daemon_group }}" - mode: u=rw,go= - -# This CSR isn't used at all by avlanchego. It's a required step when creating -# a certificate with Ansible, even a self signed one. Leaving the CSR in place -# (rather than deleting it) keeps the role idempotent. -- name: Create staking certificate signing request - become: true - openssl_csr: - path: "{{ camino_daemon_staking_tls_csr }}" - basic_constraints: - - "CA:FALSE" - basic_constraints_critical: true - key_usage: - - digitalSignature - - dataEncipherment - key_usage_critical: true - privatekey_path: "{{ camino_daemon_staking_tls_key }}" - use_common_name_for_san: false - owner: "{{ camino_daemon_user }}" - group: "{{ camino_daemon_group }}" - mode: u=rw,go=r - -# These parameters in this role were arrived at by inspecting an certificate -# that was generated by avlanchego. There is one intentional difference. -# The role generates certificates valid for the Ansible default of 10 years. -# avlanchego generates them valid for 100 years. By using Ansible's default -# (rather than overriding it) the role can be kept idempotent. -- name: Create staking certificate - become: true - openssl_certificate: - path: "{{ camino_daemon_staking_tls_cert }}" - backup: true - csr_path: "{{ camino_daemon_staking_tls_csr }}" - privatekey_path: "{{ camino_daemon_staking_tls_key }}" - provider: selfsigned - owner: "{{ camino_daemon_user }}" - group: "{{ camino_daemon_group }}" - mode: u=rw,go=r diff --git a/scripts/ansible/roles/camino_start/defaults/main.yml b/scripts/ansible/roles/camino_start/defaults/main.yml deleted file mode 100644 index 192cbbd4889b..000000000000 --- a/scripts/ansible/roles/camino_start/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -log_level: info -camino_binary: ~/go/src/github.com/chain4travel/caminogo/build/caminogo diff --git a/scripts/ansible/roles/camino_start/tasks/main.yml b/scripts/ansible/roles/camino_start/tasks/main.yml deleted file mode 100644 index 7440fdeb4650..000000000000 --- a/scripts/ansible/roles/camino_start/tasks/main.yml +++ /dev/null @@ -1,47 +0,0 @@ -- name: Start node - # noqa 301 - shell: - nohup {{ camino_binary }} - --network-id="{{ network_id }}" - --api-admin-enabled="{{ api_admin_enabled }}" - --api-keystore-enabled="{{ api_keystore_enabled }}" - --api-metrics-enabled="{{ api_metrics_enabled }}" - --tx-fee="{{ tx_fee }}" - --min-validator-stake="{{ min_validator_stake }}" - --min-delegator-stake="{{ min_delegator_stake }}" - --assertions-enabled="{{ assertions_enabled }}" - --signature-verification-enabled="{{ signature_verification_enabled }}" - --db-type="{{ db_type }}" - --db-dir="{{ db_dir }}" - --http-host="{{ http_host }}" - --http-port="{{ http_port }}" - --http-tls-enabled="{{ http_tls_enabled }}" - --http-tls-key-file="{{ http_tls_key_file }}" - --http-tls-cert-file="{{ http_tls_cert_file }}" - --bootstrap-ips="{{ bootstrap_ips }}" - --bootstrap-ids="{{ bootstrap_ids }}" - --staker-msg-reserved="{{ staker_msg_reserved }}" - --staker-cpu-reserved="{{ staker_cpu_reserved }}" - --public-ip="{{ ansible_host }}" - --staking-port="{{ staking_port }}" - --staking-enabled="{{ staking_enabled }}" - --staking-tls-key-file="{{ staking_tls_key_file }}" - --staking-tls-cert-file="{{ staking_tls_cert_file }}" - --plugin-dir="{{ plugin_dir }}" - --log-dir="{{ log_dir }}" - --log-level="{{ log_level }}" - --snow-sample-size="{{ snow_sample_size }}" - --snow-quorum-size="{{ snow_quorum_size }}" - --snow-virtuous-commit-threshold="{{ snow_virtuous_commit_threshold }}" - --snow-rogue-commit-threshold="{{ snow_rogue_commit_threshold }}" - --snow-camino-num-parents="{{ snow_camino_num_parents }}" - --snow-camino-batch-size="{{ snow_camino_batch_size }}" - --api-ipcs-enabled="{{ api_ipcs_enabled }}" - --max-non-staker-pending-msgs="{{ max_non_staker_pending_msgs }}" - --network-minimum-timeout={{ network_minimum_timeout }} - --network-initial-timeout={{ network_initial_timeout }} - --max-pending-msgs={{ max_pending_msgs }} - --send-queue-size={{ send_queue_size }} - >/dev/null 2>&1 & - environment: - PATH: /sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin diff --git a/scripts/ansible/roles/camino_stop/tasks/main.yml b/scripts/ansible/roles/camino_stop/tasks/main.yml deleted file mode 100644 index d0b62488fa03..000000000000 --- a/scripts/ansible/roles/camino_stop/tasks/main.yml +++ /dev/null @@ -1,17 +0,0 @@ -- name: Kill Node - command: killall -SIGTERM caminogo - register: killall_caminogo - changed_when: - - "killall_caminogo.rc in [0]" - failed_when: - - "killall_caminogo.rc not in [0]" - - "killall_caminogo.stderr not in ['caminogo: no process found']" - -- name: Kill EVM - command: killall -SIGTERM evm - register: killall_evm - changed_when: - - "killall_evm.rc in [0]" - failed_when: - - "killall_evm.rc not in [0]" - - "killall_evm.stderr not in ['evm: no process found']" diff --git a/scripts/ansible/roles/camino_user/defaults/main.yml b/scripts/ansible/roles/camino_user/defaults/main.yml deleted file mode 100644 index 346159353d52..000000000000 --- a/scripts/ansible/roles/camino_user/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -camino_daemon_user: camino -camino_daemon_group: "{{ camino_daemon_user }}" diff --git a/scripts/ansible/roles/camino_user/tasks/main.yml b/scripts/ansible/roles/camino_user/tasks/main.yml deleted file mode 100644 index 3be6f0845947..000000000000 --- a/scripts/ansible/roles/camino_user/tasks/main.yml +++ /dev/null @@ -1,14 +0,0 @@ -- name: Create Camino daemon group - become: true - group: - name: "{{ camino_daemon_group }}" - system: true - -- name: Create Camino daemon user - become: true - user: - name: "{{ camino_daemon_user }}" - group: "{{ camino_daemon_group }}" - home: "{{ camino_daemon_home_dir }}" - shell: /bin/false - system: true diff --git a/scripts/ansible/roles/golang_base/defaults/main.yml b/scripts/ansible/roles/golang_base/defaults/main.yml deleted file mode 100644 index 837143938a85..000000000000 --- a/scripts/ansible/roles/golang_base/defaults/main.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -# Changes to the minimum golang version must also be replicated in -# scripts/ansible/roles/golang_base/defaults/main.yml (here) -# scripts/build_camino.sh -# scripts/local.Dockerfile -# Dockerfile -# README.md -# go.mod -golang_version_min: 1.17.9 -golang_version_min_info: "{{ golang_version_min.split('.') | map('int') | list }}" -golang_version_min_major: "{{ golang_version_min_info[0] }}" -golang_version_min_minor: "{{ golang_version_min_info[1] }}" diff --git a/scripts/ansible/roles/golang_base/tasks/centos-7.yml b/scripts/ansible/roles/golang_base/tasks/centos-7.yml deleted file mode 100644 index e2bf1b4b3443..000000000000 --- a/scripts/ansible/roles/golang_base/tasks/centos-7.yml +++ /dev/null @@ -1,17 +0,0 @@ -# CentOS 7.x does not include golang. -# The EPEL repository includes it, and tracks golang packages from Fedora. - -- name: Install Go repo - yum: - name: - - epel-release - tags: - - golang_base - -- name: Install Go - become: true - yum: - name: - - "golang >= {{ golang_version_min }}" - tags: - - golang_base diff --git a/scripts/ansible/roles/golang_base/tasks/centos-8.yml b/scripts/ansible/roles/golang_base/tasks/centos-8.yml deleted file mode 100644 index ca9d4a277f77..000000000000 --- a/scripts/ansible/roles/golang_base/tasks/centos-8.yml +++ /dev/null @@ -1,28 +0,0 @@ -# CentOS Linux 8.x has periodic minor releases, each one has a Go release. -# CentOS Stream 8 is a rolling release, Go is updated on a continuous basis. - -- name: Add Go repository - # Typically the version of Go in CentOS Linux will be too old. So use the - # CentOS Stream AppStream repository, but but only for Go packages. - yum_repository: - name: centos-stream-appstream - description: CentOS Stream $releasever - AppStream - mirrorlist: http://mirrorlist.centos.org/?release=8-stream&arch=$basearch&repo=AppStream&infra=$infra - gpgcheck: true - gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial - file: CentOS-Stream-AppStream # .repo extension is added by Ansible - includepkgs: golang* - # Only run on CentOS Linux. CentOS Stream already has this repo configured. - # On CentOS Linux distribution_version is ".". - # On CentOS Stream distribution_version is just "". - when: (ansible_facts.distribution_version | length) >= 3 - tags: - - golang_base - -- name: Install Go - become: true - yum: - name: - - "golang >= {{ golang_version_min }}" - tags: - - golang_base diff --git a/scripts/ansible/roles/golang_base/tasks/debian-10.yml b/scripts/ansible/roles/golang_base/tasks/debian-10.yml deleted file mode 100644 index 3f5fdaa3ae5a..000000000000 --- a/scripts/ansible/roles/golang_base/tasks/debian-10.yml +++ /dev/null @@ -1,58 +0,0 @@ -# Debian 10.x (buster) includes golang 1.11.x. -# The testing repository tracks https://golang.org releases more closely. - -- name: Configure Apt - become: true - copy: - content: "{{ golang_base_apt_conf.content }}" - dest: "{{ golang_base_apt_conf.dest }}" - owner: root - group: root - mode: u=rw,go=r - loop: - - content: | - APT::Default-Release "stable"; - dest: /etc/apt/apt.conf.d/99defaultrelease - - content: | - Package: * - Pin: release o=Debian,a=testing,n=bullseye - Pin-Priority: 400 - dest: /etc/apt/preferences.d/99pin-bullseye - loop_control: - label: "{{ golang_base_apt_conf.dest }}" - loop_var: golang_base_apt_conf - tags: - - golang_base - -- name: Add Go repository - become: true - apt_repository: - repo: deb http://deb.debian.org/debian testing main - tags: - - golang_base - -- name: Install Go - become: true - # Apt doesn't support specifying a minimum version (e.g. foo >= 1.0) - # https://github.com/ansible/ansible/issues/69034 - apt: - name: - - "golang-{{ golang_version_min_major }}.{{ golang_version_min_minor }}-go" - default_release: testing - tags: - - golang_base - -- name: Query installed packages - package_facts: - tags: - - golang_base - -- name: Check minimum Go version - vars: - pkg_name: golang-{{ golang_version_min_major }}.{{ golang_version_min_minor }}-go - assert: - that: - - pkg_name in ansible_facts.packages - - ansible_facts.packages[pkg_name][0].version is version(golang_version_min, '>=') - tags: - - golang_base diff --git a/scripts/ansible/roles/golang_base/tasks/main.yml b/scripts/ansible/roles/golang_base/tasks/main.yml deleted file mode 100644 index 3537aa28559f..000000000000 --- a/scripts/ansible/roles/golang_base/tasks/main.yml +++ /dev/null @@ -1,8 +0,0 @@ -- name: Dispatch tasks - include_tasks: "{{ item }}" - with_first_found: - - "{{ ansible_facts.distribution | lower }}-{{ ansible_facts.distribution_version }}.yml" - - "{{ ansible_facts.distribution | lower }}-{{ ansible_facts.distribution_major_version }}.yml" - - "not_supported.yml" - tags: - - golang_base diff --git a/scripts/ansible/roles/golang_base/tasks/not_supported.yml b/scripts/ansible/roles/golang_base/tasks/not_supported.yml deleted file mode 100644 index 2021acc4f9e8..000000000000 --- a/scripts/ansible/roles/golang_base/tasks/not_supported.yml +++ /dev/null @@ -1,10 +0,0 @@ -- name: Not supported - fail: - msg: - This operating system is not supported by this role - (system={{ ansible_facts.system }}, - os_family={{ ansible_facts.os_family }}, - distribution={{ ansible_facts.distribution }}, - distribution_version={{ ansible_facts.distribution_version }}). - tags: - - golang_base diff --git a/scripts/ansible/roles/golang_base/tasks/ubuntu-18.04.yml b/scripts/ansible/roles/golang_base/tasks/ubuntu-18.04.yml deleted file mode 100644 index 84f4b6c9085e..000000000000 --- a/scripts/ansible/roles/golang_base/tasks/ubuntu-18.04.yml +++ /dev/null @@ -1,32 +0,0 @@ -# As mentioned by https://github.com/golang/go/wiki/Ubuntu -- name: Add Go repository - become: true - apt_repository: - repo: ppa:longsleep/golang-backports - tags: - - golang_base - -- name: Install Go - become: true - # Apt doesn't support specifying a minimum version (e.g. foo >= 1.0) - # https://github.com/ansible/ansible/issues/69034 - apt: - name: - - "golang-{{ golang_version_min_major }}.{{ golang_version_min_minor }}-go" - tags: - - golang_base - -- name: Query installed packages - package_facts: - tags: - - golang_base - -- name: Check minimum Go version - vars: - pkg_name: golang-{{ golang_version_min_major }}.{{ golang_version_min_minor }}-go - assert: - that: - - pkg_name in ansible_facts.packages - - ansible_facts.packages[pkg_name][0].version is version(golang_version_min, '>=') - tags: - - golang_base diff --git a/scripts/ansible/roles/golang_base/tasks/ubuntu-20.04.yml b/scripts/ansible/roles/golang_base/tasks/ubuntu-20.04.yml deleted file mode 100644 index 8710b1685eb8..000000000000 --- a/scripts/ansible/roles/golang_base/tasks/ubuntu-20.04.yml +++ /dev/null @@ -1 +0,0 @@ -ubuntu-18.04.yml \ No newline at end of file diff --git a/scripts/ansible/roles/public-ami/defaults/main.yml b/scripts/ansible/roles/public-ami/defaults/main.yml deleted file mode 100644 index df99e079f739..000000000000 --- a/scripts/ansible/roles/public-ami/defaults/main.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -ava_user: chain4travel -ava_group: admin -network: kopernikus -db_dir: /data/caminogo -log_dir: /var/log/caminogo -config_dir: /etc/caminogo -plugin_dir: /usr/local/lib/caminogo/plugins -repo_url: https://github.com/chain4travel/caminogo -repo_folder: /tmp/caminogo diff --git a/scripts/ansible/roles/public-ami/tasks/main.yml b/scripts/ansible/roles/public-ami/tasks/main.yml deleted file mode 100644 index 084f72e32926..000000000000 --- a/scripts/ansible/roles/public-ami/tasks/main.yml +++ /dev/null @@ -1,109 +0,0 @@ -- name: Setup gpg key - apt_key: - url: https://downloads.camino.foundation/camino-node.gpg.key - state: present - -- name: Setup caminogo repo - apt_repository: - repo: deb https://downloads.camino.foundation/apt bionic main - state: present - -- name: Setup golang repo - apt_repository: - repo: ppa:longsleep/golang-backports - state: present - -- name: Install go - apt: - name: golang - state: latest - -- name: Update git clone - git: - repo: "{{ repo_url }}" - dest: "{{ repo_folder }}" - version: "{{ tag }}" - update: yes - force: yes - -- name: Setup systemd - template: - src: templates/caminogo.service.j2 - dest: /etc/systemd/system/caminogo.service - mode: 0755 - -- name: Create chain4travel user - user: - name: "{{ c4t_user }}" - shell: /bin/bash - uid: 114 - group: "{{ c4t_group }}" - -- name: Create camino config dir - file: - path: /etc/caminogo - owner: "{{ c4t_user }}" - group: "{{ c4t_group }}" - state: directory - -- name: Create camino C config dir - file: - path: /etc/caminogo/C - owner: "{{ c4t_user }}" - group: "{{ c4t_group }}" - state: directory - -- name: Create camino log dir - file: - path: "{{ log_dir }}" - owner: "{{ c4t_user }}" - group: "{{ c4t_group }}" - state: directory - -- name: Create camino database dir - file: - path: "{{ db_dir }}" - owner: "{{ c4t_user }}" - group: "{{ c4t_group }}" - state: directory - -- name: Create camino plugins directory - file: - path: "{{ plugin_dir }}" - owner: "{{ c4t_user }}" - group: "{{ c4t_group }}" - state: directory - recurse: yes - -- name: Build caminogo - command: ./scripts/build.sh - args: - chdir: "{{ repo_folder }}" - -- name: Copy caminogo binaries to the correct location - command: cp build/caminogo /usr/local/bin/caminogo - args: - chdir: "{{ repo_folder }}" - -- name: Copy evm binaries to the correct location - command: cp build/plugins/evm {{ plugin_dir }} - args: - chdir: "{{ repo_folder }}" - - -- name: Configure caminogo - template: - src: templates/conf.json.j2 - dest: /etc/caminogo/conf.json - mode: 0644 - -- name: Configure camino C Chain - template: - src: templates/C/config.json.j2 - dest: /etc/caminogo/C/config.json - mode: 0644 - -- name: Enable Camino - systemd: - name: caminogo - enabled: yes diff --git a/scripts/ansible/roles/public-ami/templates/C/config.json.j2 b/scripts/ansible/roles/public-ami/templates/C/config.json.j2 deleted file mode 100644 index 0967ef424bce..000000000000 --- a/scripts/ansible/roles/public-ami/templates/C/config.json.j2 +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/scripts/ansible/roles/public-ami/templates/avalanchego.service.j2 b/scripts/ansible/roles/public-ami/templates/avalanchego.service.j2 deleted file mode 100644 index dc6ffedf7c80..000000000000 --- a/scripts/ansible/roles/public-ami/templates/avalanchego.service.j2 +++ /dev/null @@ -1,18 +0,0 @@ -[Unit] -Description=Camino go client -After=syslog.target network.target - -[Service] -User=camino -Type=simple -Environment=HOME=/home/camino -ExecStart=/usr/local/bin/caminogo --config-file /etc/caminogo/conf.json -KillMode=process -KillSignal=SIGINT -TimeoutStopSec=90 -Restart=on-failure -RestartSec=10s -LimitNOFILE=65000 - -[Install] -WantedBy=multi-user.target diff --git a/scripts/ansible/roles/public-ami/templates/conf.json.j2 b/scripts/ansible/roles/public-ami/templates/conf.json.j2 deleted file mode 100644 index 535a08c6aa39..000000000000 --- a/scripts/ansible/roles/public-ami/templates/conf.json.j2 +++ /dev/null @@ -1,9 +0,0 @@ -{ - "api-keystore-enabled": false, - "http-host": "0.0.0.0", - "log-dir": "{{ log_dir }}", - "db-dir": "{{ db_dir }}", - "api-admin-enabled": false, - "dynamic-public-ip": "opendns", - "network-id": "{{ network }}" -} diff --git a/scripts/ansible/service_playbook.yml b/scripts/ansible/service_playbook.yml deleted file mode 100644 index b9c38917edb1..000000000000 --- a/scripts/ansible/service_playbook.yml +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env ansible-playbook ---- -- name: Configure Camino service - hosts: camino_nodes - roles: - - name: camino_download - - name: camino_user - - name: camino_install - - name: camino_staker - - name: camino_service diff --git a/scripts/ansible/update_playbook.yml b/scripts/ansible/update_playbook.yml deleted file mode 100644 index 54de83fe5f09..000000000000 --- a/scripts/ansible/update_playbook.yml +++ /dev/null @@ -1,10 +0,0 @@ - -#!/usr/bin/env ansible-playbook ---- -- name: Update the network - connection: ssh - hosts: all - roles: - - name: camino_stop - - name: camino_build - - name: camino_start diff --git a/scripts/build.sh b/scripts/build.sh index 988ec0678008..1e7023b6997c 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,11 +2,45 @@ set -euo pipefail -# Camino-Node root folder -CAMINOGO_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) +print_usage() { + printf "Usage: build [OPTIONS] + Build caminogo + + Options: + + -r Build with race detector +" +} + +race='' +while getopts 'r' flag; do + case "${flag}" in + r) race='-r' ;; + *) print_usage + exit 1 ;; + esac +done + +# Caminogo root folder +CAMINO_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) +# Load the constants +source "$CAMINO_PATH"/scripts/constants.sh + +# Download dependencies echo "Downloading dependencies..." (cd "$CAMINOGO_PATH" && go mod download) +build_args="$race" + # Build caminogo -"$CAMINOGO_PATH"/scripts/build_camino.sh \ No newline at end of file +"$CAMINO_PATH"/scripts/build_camino.sh $build_args + +# Exit build successfully if the CaminoGo binary is created successfully +if [[ -f "$caminogo_path" ]]; then + echo "Build Successful" + exit 0 +else + echo "Build failure" >&2 + exit 1 +fi diff --git a/scripts/build_and_test.sh b/scripts/build_and_test.sh index 94b1e90f1712..a2ae7feea9bd 100755 --- a/scripts/build_and_test.sh +++ b/scripts/build_and_test.sh @@ -2,7 +2,7 @@ set -euo pipefail -# Avalanche root directory +# Camino root directory CAMINOGO_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) "$CAMINOGO_PATH"/scripts/build.sh diff --git a/scripts/build_avalanche.sh b/scripts/build_avalanche.sh deleted file mode 100755 index 27e36d4913d7..000000000000 --- a/scripts/build_avalanche.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash -# shellcheck disable=all - -set -euo pipefail - -print_usage() { - printf "Usage: build_avalanche [OPTIONS] - - Build avalanchego - - Options: - - -r Build with race detector -" -} - -race='' -while getopts 'r' flag; do - case "${flag}" in - r) race='-race' ;; - *) print_usage - exit 1 ;; - esac -done - -# Changes to the minimum golang version must also be replicated in -# scripts/build_avalanche.sh (here) -# Dockerfile -# README.md -# go.mod -go_version_minimum="1.20.12" - -go_version() { - go version | sed -nE -e 's/[^0-9.]+([0-9.]+).+/\1/p' -} - -version_lt() { - # Return true if $1 is a lower version than than $2, - local ver1=$1 - local ver2=$2 - # Reverse sort the versions, if the 1st item != ver1 then ver1 < ver2 - if [[ $(echo -e -n "$ver1\n$ver2\n" | sort -rV | head -n1) != "$ver1" ]]; then - return 0 - else - return 1 - fi -} - -if version_lt "$(go_version)" "$go_version_minimum"; then - echo "AvalancheGo requires Go >= $go_version_minimum, Go $(go_version) found." >&2 - exit 1 -fi - -# Avalanchego root folder -AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) -# Load the constants -source "$AVALANCHE_PATH"/scripts/constants.sh - -build_args="$race" -echo "Building AvalancheGo..." -go build $build_args -ldflags "-X github.com/ava-labs/avalanchego/version.GitCommit=$git_commit $static_ld_flags" -o "$avalanchego_path" "$AVALANCHE_PATH/main/"*.go diff --git a/scripts/build_camino.sh b/scripts/build_camino.sh index f9f7d014b03c..99bc63327f33 100755 --- a/scripts/build_camino.sh +++ b/scripts/build_camino.sh @@ -1,15 +1,29 @@ #!/usr/bin/env bash -set -o errexit -set -o nounset -set -o pipefail +set -euo pipefail -echo "Building camino node..." +print_usage() { + printf "Usage: build_camino [OPTIONS] + + Build caminogo + + Options: + + -r Build with race detector +" +} + +race='' +while getopts 'r' flag; do + case "${flag}" in + r) race='-race' ;; + *) print_usage + exit 1 ;; + esac +done # Changes to the minimum golang version must also be replicated in -# scripts/ansible/roles/golang_base/defaults/main.yml (here) # scripts/build_camino.sh (here) -# scripts/local.Dockerfile # Dockerfile # README.md # go.mod @@ -32,7 +46,7 @@ version_lt() { } if version_lt "$(go_version)" "$go_version_minimum"; then - echo "Camino-Node requires Go >= $go_version_minimum, Go $(go_version) found." >&2 + echo "CaminoGo requires Go >= $go_version_minimum, Go $(go_version) found." >&2 exit 1 fi @@ -48,7 +62,9 @@ LDFLAGS="$LDFLAGS -X github.com/ava-labs/coreth/plugin/evm.GitCommit=$caminoethv LDFLAGS="$LDFLAGS -X github.com/ava-labs/coreth/plugin/evm.Version=$caminoethvm_tag" LDFLAGS="$LDFLAGS $static_ld_flags" -go build -ldflags "$LDFLAGS" -o "$CAMINOGO_BIN_PATH" "$CAMINOGO_PATH/main/"*.go +build_args="$race" +echo "Building CaminoGo..." +go build $build_args -ldflags "$LDFLAGS" -o "$CAMINOGO_BIN_PATH" "$CAMINOGO_PATH/main/"*.go # Make plugin folder mkdir -p "$plugin_dir" diff --git a/scripts/build_image.sh b/scripts/build_image.sh index 9fb42964ae81..ed9a288de67b 100755 --- a/scripts/build_image.sh +++ b/scripts/build_image.sh @@ -1,19 +1,14 @@ #!/usr/bin/env bash -# shellcheck disable=all -# TODO: re-assess shellcheck disable=all after workflow cleanup -set -euo pipefail +set -o errexit +set -o nounset +set -o pipefail # Directory above this script -AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) +CAMINOGO_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) # Load the constants -source "$AVALANCHE_PATH"/scripts/constants.sh +source "$CAMINOGO_PATH"/scripts/constants.sh -# WARNING: this will use the most recent commit even if there are un-committed changes present -full_commit_hash="$(git --git-dir="$AVALANCHE_PATH/.git" rev-parse HEAD)" -commit_hash="${full_commit_hash::8}" - -echo "Building Docker Image with tags: $avalanchego_dockerhub_repo:$commit_hash , $avalanchego_dockerhub_repo:$current_branch" -docker build -t "$avalanchego_dockerhub_repo:$commit_hash" \ - -t "$avalanchego_dockerhub_repo:$current_branch" "$AVALANCHE_PATH" -f "$AVALANCHE_PATH/Dockerfile" +echo "Building Docker Image with tag $camino_node_dockerhub_repo:$current_branch" +docker build -t "$camino_node_dockerhub_repo:$current_branch" "$CAMINOGO_PATH" -f "$CAMINOGO_PATH/Dockerfile" \ No newline at end of file diff --git a/scripts/build_local_image.sh b/scripts/build_local_image.sh deleted file mode 100755 index 69c4c09fe10a..000000000000 --- a/scripts/build_local_image.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -o pipefail - -# Directory above this script -CAMINOGO_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) - -# Load the constants -source "$CAMINOGO_PATH"/scripts/constants.sh - -echo "Building Docker Image with tag $camino_node_dockerhub_repo:$current_branch" -docker build -t "$camino_node_dockerhub_repo:$current_branch" "$CAMINOGO_PATH" -f "$CAMINOGO_PATH/Dockerfile" diff --git a/scripts/build_publish_image.sh b/scripts/build_publish_image.sh index 5341beb8cc92..95c3c7b7a9d2 100755 --- a/scripts/build_publish_image.sh +++ b/scripts/build_publish_image.sh @@ -8,7 +8,7 @@ set -o pipefail CAMINOGO_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) # Build the container -"$CAMINOGO_PATH"/scripts/build_local_image.sh +"$CAMINOGO_PATH"/scripts/build_image.sh # If this is not a trusted build (Docker Credentials are not set) if [[ -z "$DOCKER_USERNAME" ]]; then diff --git a/scripts/build_tmpnetctl.sh b/scripts/build_tmpnetctl.sh index 3ec17032c063..974e83efc467 100755 --- a/scripts/build_tmpnetctl.sh +++ b/scripts/build_tmpnetctl.sh @@ -2,13 +2,18 @@ set -euo pipefail -# Avalanchego root folder +# Caminogo root folder CAMINOGO_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) # Load the constants source "$CAMINOGO_PATH"/scripts/constants.sh +LDFLAGS="-X github.com/ava-labs/avalanchego/version.GitCommit=$git_commit" +LDFLAGS="$LDFLAGS -X github.com/ava-labs/avalanchego/version.GitVersion=$git_tag" +LDFLAGS="$LDFLAGS -X github.com/ava-labs/coreth/plugin/evm.GitCommit=$caminoethvm_commit" +LDFLAGS="$LDFLAGS -X github.com/ava-labs/coreth/plugin/evm.Version=$caminoethvm_tag" +LDFLAGS="$LDFLAGS $static_ld_flags" + echo "Building tmpnetctl..." -go build -ldflags\ - "-X github.com/ava-labs/avalanchego/version.GitCommit=$git_commit $static_ld_flags"\ +go build -ldflags "$LDFLAGS"\ -o "$CAMINOGO_PATH/build/tmpnetctl"\ "$CAMINOGO_PATH/tests/fixture/tmpnet/cmd/"*.go diff --git a/scripts/build_xsvm.sh b/scripts/build_xsvm.sh index d67e2cbc2075..9c4f29297b89 100755 --- a/scripts/build_xsvm.sh +++ b/scripts/build_xsvm.sh @@ -12,7 +12,7 @@ source ./scripts/constants.sh echo "Building xsvm plugin..." go build -o ./build/xsvm ./vms/example/xsvm/cmd/xsvm/ -PLUGIN_DIR="$HOME/.avalanchego/plugins" +PLUGIN_DIR="$HOME/.caminogo/plugins" PLUGIN_PATH="${PLUGIN_DIR}/v3m4wPxaHpvGr8qfMeyK6PRW3idZrPHmYcMTt7oXdK47yurVH" echo "Symlinking ./build/xsvm to ${PLUGIN_PATH}" mkdir -p "${PLUGIN_DIR}" diff --git a/scripts/constants.sh b/scripts/constants.sh index 782b378c71e3..e22eef0b3b5b 100755 --- a/scripts/constants.sh +++ b/scripts/constants.sh @@ -12,6 +12,7 @@ CAMINOGO_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) # Where CaminoGo binary goes build_dir="$CAMINOGO_PATH/build" +caminogo_path="$build_dir/caminogo" CAMINOGO_BIN_PATH="$build_dir/caminogo" camino_node_symlink_path="$build_dir/camino-node" plugin_dir="$build_dir/plugins" diff --git a/scripts/tests.e2e.sh b/scripts/tests.e2e.sh index 89d37e9942cc..b3cded7f6771 100755 --- a/scripts/tests.e2e.sh +++ b/scripts/tests.e2e.sh @@ -35,7 +35,7 @@ if [[ -n "${E2E_USE_EXISTING_NETWORK:-}" && -n "${TMPNET_NETWORK_DIR:-}" ]]; the E2E_ARGS="--use-existing-network" else CAMINOGO_BIN_PATH="$(realpath "${CAMINOGO_BIN_PATH:-./build/caminogo}")" - E2E_ARGS="--avalanchego-path=${CAMINOGO_BIN_PATH}" + E2E_ARGS="--caminogo-path=${CAMINOGO_BIN_PATH}" fi ################################# diff --git a/scripts/tests.upgrade.sh b/scripts/tests.upgrade.sh index c85940473e78..cef4b045c2e5 100755 --- a/scripts/tests.upgrade.sh +++ b/scripts/tests.upgrade.sh @@ -15,12 +15,11 @@ fi # backwards-compatible networks. When a breaking change is made to the # local network, this flag must be updated to the last compatible # version with the latest code. -# -# v1.1.18 includes restrictions on ports sent over the p2p network along with -# proposervm and P-chain rule changes on the local network. -DEFAULT_VERSION="1.1.18" + +DEFAULT_VERSION="v1.1.15" VERSION="${1:-${DEFAULT_VERSION}}" + if [[ -z "${VERSION}" ]]; then echo "Missing version argument!" echo "Usage: ${0} [VERSION]" >>/dev/stderr @@ -30,32 +29,23 @@ fi CAMINOGO_BIN_PATH="$(realpath "${CAMINOGO_BIN_PATH:-./build/caminogo}")" ################################# -# download caminogo -# https://github.com/ava-labs/caminogo/releases +# clone caminogo tag +# https://github.com/chain4travel/caminogo.git GOARCH=$(go env GOARCH) GOOS=$(go env GOOS) -DOWNLOAD_URL=https://github.com/ava-labs/caminogo/releases/download/v${VERSION}/caminogo-linux-${GOARCH}-v${VERSION}.tar.gz -DOWNLOAD_PATH=/tmp/caminogo.tar.gz -if [[ ${GOOS} == "darwin" ]]; then - DOWNLOAD_URL=https://github.com/ava-labs/caminogo/releases/download/v${VERSION}/caminogo-macos-v${VERSION}.zip - DOWNLOAD_PATH=/tmp/caminogo.zip -fi +GIT_URL=https://github.com/chain4travel/caminogo.git -rm -f ${DOWNLOAD_PATH} -rm -rf "/tmp/caminogo-v${VERSION}" +rm -rf "/tmp/caminogo-${VERSION}" rm -rf /tmp/caminogo-build -echo "downloading caminogo ${VERSION} at ${DOWNLOAD_URL}" -curl -L "${DOWNLOAD_URL}" -o "${DOWNLOAD_PATH}" +echo "cloning caminogo tag ${VERSION}" +git clone -b ${VERSION} ${GIT_URL} /tmp/caminogo-${VERSION} + +find "/tmp/caminogo-${VERSION}" + +cd /tmp/caminogo-${VERSION} +./scripts/build.sh -echo "extracting downloaded caminogo" -if [[ ${GOOS} == "linux" ]]; then - tar xzvf ${DOWNLOAD_PATH} -C /tmp -elif [[ ${GOOS} == "darwin" ]]; then - unzip ${DOWNLOAD_PATH} -d /tmp/caminogo-build - mv /tmp/caminogo-build/build "/tmp/caminogo-v${VERSION}" -fi -find "/tmp/caminogo-v${VERSION}" # Sourcing constants.sh ensures that the necessary CGO flags are set to # build the portable version of BLST. Without this, ginkgo may fail to @@ -75,5 +65,5 @@ ACK_GINKGO_RC=true ginkgo build ./tests/upgrade echo "running upgrade tests against the local cluster with ${CAMINOGO_BIN_PATH}" ./tests/upgrade/upgrade.test \ --ginkgo.v \ - --avalanchego-path="/tmp/caminogo-v${VERSION}/caminogo" \ - --avalanchego-path-to-upgrade-to="${CAMINOGO_BIN_PATH}" + --caminogo-path="/tmp/caminogo-${VERSION}/build/caminogo" \ + --caminogo-path-to-upgrade-to="${CAMINOGO_BIN_PATH}" diff --git a/tests/e2e/README.md b/tests/e2e/README.md index d6e5bfd96dca..48b77a7ad699 100644 --- a/tests/e2e/README.md +++ b/tests/e2e/README.md @@ -28,7 +28,7 @@ primarily target the X-Chain: ```bash ./tests/e2e/e2e.test \ - --avalanchego-path=./build/avalanchego \ + --caminogo-path=./build/caminogo \ --ginkgo.label-filter=x ``` @@ -69,13 +69,13 @@ of the test under development. To create a temporary network for use across test runs: ```bash -# From the root of the avalanchego repo +# From the root of the caminogo repo # Build the tmpnetctl binary $ ./scripts/build_tmpnetctl.sh # Start a new network -$ ./build/tmpnetctl start-network --avalanchego-path=/path/to/avalanchego +$ ./build/tmpnetctl start-network --caminogo-path=/path/to/caminogo ... Started network 1000 @ /home/me/.tmpnet/networks/1000 @@ -87,12 +87,12 @@ with one of the following statements: # Start a new test run using the existing network ginkgo -v ./tests/e2e -- \ - --avalanchego-path=/path/to/avalanchego \ + --caminogo-path=/path/to/caminogo \ --ginkgo.focus-file=[name of file containing test] \ --use-existing-network \ --network-dir=/path/to/network -# It is also possible to set the CAMINOGO_BIN_PATH env var instead of supplying --avalanchego-path +# It is also possible to set the CAMINOGO_BIN_PATH env var instead of supplying --caminogo-path # and to set TMPNET_NETWORK_DIR instead of supplying --network-dir. ``` diff --git a/tests/fixture/e2e/flags.go b/tests/fixture/e2e/flags.go index 2a00df97a885..1a388b6f1793 100644 --- a/tests/fixture/e2e/flags.go +++ b/tests/fixture/e2e/flags.go @@ -44,14 +44,14 @@ func RegisterFlags() *FlagVars { vars := FlagVars{} flag.StringVar( &vars.avalancheGoExecPath, - "avalanchego-path", + "caminogo-path", os.Getenv(tmpnet.AvalancheGoPathEnvName), - fmt.Sprintf("avalanchego executable path (required if not using an existing network). Also possible to configure via the %s env variable.", tmpnet.AvalancheGoPathEnvName), + fmt.Sprintf("caminogo executable path (required if not using an existing network). Also possible to configure via the %s env variable.", tmpnet.AvalancheGoPathEnvName), ) flag.StringVar( &vars.pluginDir, "plugin-dir", - os.ExpandEnv("$HOME/.avalanchego/plugins"), + os.ExpandEnv("$HOME/.caminogo/plugins"), "[optional] the dir containing VM plugins.", ) flag.StringVar( diff --git a/tests/fixture/tmpnet/README.md b/tests/fixture/tmpnet/README.md index 909a29c6ee12..810c8e8db415 100644 --- a/tests/fixture/tmpnet/README.md +++ b/tests/fixture/tmpnet/README.md @@ -1,6 +1,6 @@ # tmpnet - temporary network orchestration -This package implements a simple orchestrator for the avalanchego +This package implements a simple orchestrator for the caminogo nodes of a temporary network. Configuration is stored on disk, and nodes run as independent processes whose process details are also written to disk. Using the filesystem to store configuration and @@ -16,7 +16,7 @@ commonly refers to a persistent blockchain network used for testing. To avoid confusion, the name was changed to `tmpnet` and its cli `tmpnetctl`. `tmpnet` is short for `temporary network` since the networks it deploys are likely to live for a limited duration in -support of the development and testing of avalanchego and its related +support of the development and testing of caminogo and its related repositories. ## Package details @@ -27,7 +27,7 @@ the following non-test files: | Filename | Types | Purpose | |:------------------|:------------|:-----------------------------------------------| | defaults.go | | Defines common default configuration | -| flags.go | FlagsMap | Simplifies configuration of avalanchego flags | +| flags.go | FlagsMap | Simplifies configuration of caminogo flags | | genesis.go | | Creates test genesis | | network.go | Network | Orchestrates and configures temporary networks | | network_config.go | Network | Reads and writes network configuration | @@ -44,13 +44,13 @@ the following non-test files: A temporary network can be managed by the `tmpnetctl` cli tool: ```bash -# From the root of the avalanchego repo +# From the root of the caminogo repo # Build the tmpnetctl binary $ ./scripts/build_tmpnetctl.sh # Start a new network -$ ./build/tmpnetctl start-network --avalanchego-path=/path/to/avalanchego +$ ./build/tmpnetctl start-network --caminogo-path=/path/to/caminogo ... Started network 1000 @ /home/me/.tmpnet/networks/1000 @@ -98,8 +98,8 @@ _ := tmpnet.StartNewNetwork( // Start the network ginkgo.GinkgoWriter, // Writer to report progress of initialization network, "", // Empty string uses the default network path (~/tmpnet/networks) - "/path/to/avalanchego", // The path to the binary that nodes will execute - "/path/to/plugins", // The path nodes will use for plugin binaries (suggested value ~/.avalanchego/plugins) + "/path/to/caminogo", // The path to the binary that nodes will execute + "/path/to/plugins", // The path nodes will use for plugin binaries (suggested value ~/.caminogo/plugins) 5, // Number of initial validating nodes ) @@ -117,7 +117,7 @@ By default, nodes in a temporary network will be started with staking and API ports set to `0` to ensure that ports will be dynamically chosen. The tmpnet fixture discovers the ports used by a given node by reading the `[base-data-dir]/process.json` file written by -avalanchego on node start. The use of dynamic ports supports testing +caminogo on node start. The use of dynamic ports supports testing with many temporary networks without having to manually select compatible port ranges. @@ -158,7 +158,7 @@ HOME ### Common networking configuration Network configuration such as default flags (e.g. `--log-level=`), -runtime defaults (e.g. avalanchego path) and pre-funded private keys +runtime defaults (e.g. caminogo path) and pre-funded private keys are stored at `[network-dir]/config.json`. A given default will only be applied to a new node on its addition to the network if the node does not explicitly set a given value. @@ -211,7 +211,7 @@ flag. The details required to configure a node's execution are written to `[network-path]/[node-id]/config.json`. This file contains the -runtime-specific details like the path of the avalanchego binary to +runtime-specific details like the path of the caminogo binary to start the node with. #### Flags @@ -225,7 +225,7 @@ editing the config file. #### Process details -The process details of a node are written by avalanchego to +The process details of a node are written by caminogo to `[base-data-dir]/process.json`. The file contains the PID of the node process, the URI of the node's API, and the address other nodes can use to bootstrap themselves (aka staking address). diff --git a/tests/fixture/tmpnet/cmd/main.go b/tests/fixture/tmpnet/cmd/main.go index dd59c300bbb3..7d8d31546e67 100644 --- a/tests/fixture/tmpnet/cmd/main.go +++ b/tests/fixture/tmpnet/cmd/main.go @@ -21,7 +21,7 @@ import ( const cliVersion = "0.0.1" var ( - errAvalancheGoRequired = fmt.Errorf("--avalanchego-path or %s are required", tmpnet.AvalancheGoPathEnvName) + errAvalancheGoRequired = fmt.Errorf("--caminogo-path or %s are required", tmpnet.AvalancheGoPathEnvName) errNetworkDirRequired = fmt.Errorf("--network-dir or %s are required", tmpnet.NetworkDirEnvName) ) @@ -103,8 +103,8 @@ func main() { }, } startNetworkCmd.PersistentFlags().StringVar(&rootDir, "root-dir", os.Getenv(tmpnet.RootDirEnvName), "The path to the root directory for temporary networks") - startNetworkCmd.PersistentFlags().StringVar(&avalancheGoPath, "avalanchego-path", os.Getenv(tmpnet.AvalancheGoPathEnvName), "The path to an avalanchego binary") - startNetworkCmd.PersistentFlags().StringVar(&pluginDir, "plugin-dir", os.ExpandEnv("$HOME/.avalanchego/plugins"), "[optional] the dir containing VM plugins") + startNetworkCmd.PersistentFlags().StringVar(&avalancheGoPath, "caminogo-path", os.Getenv(tmpnet.AvalancheGoPathEnvName), "The path to an caminogo binary") + startNetworkCmd.PersistentFlags().StringVar(&pluginDir, "plugin-dir", os.ExpandEnv("$HOME/.caminogo/plugins"), "[optional] the dir containing VM plugins") startNetworkCmd.PersistentFlags().Uint8Var(&nodeCount, "node-count", tmpnet.DefaultNodeCount, "Number of nodes the network should initially consist of") rootCmd.AddCommand(startNetworkCmd) diff --git a/tests/upgrade/upgrade_test.go b/tests/upgrade/upgrade_test.go index 4dba94c17f23..c117cd51c21a 100644 --- a/tests/upgrade/upgrade_test.go +++ b/tests/upgrade/upgrade_test.go @@ -31,15 +31,15 @@ var ( func init() { flag.StringVar( &avalancheGoExecPath, - "avalanchego-path", + "caminogo-path", "", - "avalanchego executable path", + "caminogo executable path", ) flag.StringVar( &avalancheGoExecPathToUpgradeTo, - "avalanchego-path-to-upgrade-to", + "caminogo-path-to-upgrade-to", "", - "avalanchego executable path to upgrade to", + "caminogo executable path to upgrade to", ) } From 75e2a911cf0c5b6f8d9fcf7084de0a509f204097 Mon Sep 17 00:00:00 2001 From: Mohamed Elmoslemany Date: Thu, 4 Jul 2024 10:24:41 +0200 Subject: [PATCH 2/9] update default version for upgrade tests to v1.1.19-rc0 --- scripts/tests.upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tests.upgrade.sh b/scripts/tests.upgrade.sh index cef4b045c2e5..a2caefbe4a32 100755 --- a/scripts/tests.upgrade.sh +++ b/scripts/tests.upgrade.sh @@ -16,7 +16,7 @@ fi # local network, this flag must be updated to the last compatible # version with the latest code. -DEFAULT_VERSION="v1.1.15" +DEFAULT_VERSION="v1.1.19-rc0" VERSION="${1:-${DEFAULT_VERSION}}" From 6a8263db333260f20a9b1fa59edc52d45c307631 Mon Sep 17 00:00:00 2001 From: Mohamed Elmoslemany Date: Thu, 4 Jul 2024 10:39:20 +0200 Subject: [PATCH 3/9] fix workflows issues --- .github/workflows/ci.yml | 2 +- .github/workflows/publish_image.sh | 8 ++++---- README.md | 2 +- scripts/protobuf_codegen.sh | 2 +- scripts/tests.upgrade.sh | 8 +++----- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6174627b5111..4253a843c740 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -184,7 +184,7 @@ jobs: - shell: bash run: go mod tidy - shell: bash - run: .github/workflows/scripts/check-clean-branch.sh + run: .github/workflows/check-clean-branch.sh build_docker_image: name: Test docker image building runs-on: ubuntu-latest diff --git a/.github/workflows/publish_image.sh b/.github/workflows/publish_image.sh index 5a9eb609bd8c..2fa4f5c5d9e1 100644 --- a/.github/workflows/publish_image.sh +++ b/.github/workflows/publish_image.sh @@ -17,13 +17,13 @@ source "$CAMINO_PATH"/scripts/constants.sh source "$CAMINO_PATH"/scripts/build_image.sh -r if [[ $current_branch == "master" ]]; then - echo "Tagging current caminogo image as $caminogo_dockerhub_repo:latest" - docker tag "$caminogo_dockerhub_repo:$current_branch" "$caminogo_dockerhub_repo:latest" + echo "Tagging current caminogo image as $camino_node_dockerhub_repo:latest" + docker tag "$camino_node_dockerhub_repo:$current_branch" "$camino_node_dockerhub_repo:latest" fi -echo "Pushing: $caminogo_dockerhub_repo:$current_branch" +echo "Pushing: $camino_node_dockerhub_repo:$current_branch" echo "$DOCKER_PASS" | docker login --username "$DOCKER_USERNAME" --password-stdin ## pushing image with tags -docker image push -a "$caminogo_dockerhub_repo" \ No newline at end of file +docker image push -a "$camino_node_dockerhub_repo" \ No newline at end of file diff --git a/README.md b/README.md index b6011485e30c..8156655dfcac 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ To regenerate the protobuf go code, run `scripts/protobuf_codegen.sh` from the r This should only be necessary when upgrading protobuf versions or modifying .proto definition files. -To use this script, you must have [buf](https://docs.buf.build/installation) (v1.26.1), protoc-gen-go (v1.30.0) and protoc-gen-go-grpc (v1.3.0) installed. +To use this script, you must have [buf](https://docs.buf.build/installation) (1.34.0), protoc-gen-go (v1.30.0) and protoc-gen-go-grpc (v1.3.0) installed. To install the buf dependencies: diff --git a/scripts/protobuf_codegen.sh b/scripts/protobuf_codegen.sh index 7a02a72f8cdc..e8d2100b0840 100755 --- a/scripts/protobuf_codegen.sh +++ b/scripts/protobuf_codegen.sh @@ -11,7 +11,7 @@ fi # any version changes here should also be bumped in Dockerfile.buf # ref. https://docs.buf.build/installation # ref. https://github.com/bufbuild/buf/releases -BUF_VERSION='1.26.1' +BUF_VERSION='1.34.0' if [[ $(buf --version | cut -f2 -d' ') != "${BUF_VERSION}" ]]; then echo "could not find buf ${BUF_VERSION}, is it installed + in PATH?" exit 255 diff --git a/scripts/tests.upgrade.sh b/scripts/tests.upgrade.sh index a2caefbe4a32..0bd1db28d027 100755 --- a/scripts/tests.upgrade.sh +++ b/scripts/tests.upgrade.sh @@ -16,7 +16,7 @@ fi # local network, this flag must be updated to the last compatible # version with the latest code. -DEFAULT_VERSION="v1.1.19-rc0" +DEFAULT_VERSION="v1.1.15-rc1" VERSION="${1:-${DEFAULT_VERSION}}" @@ -31,19 +31,17 @@ CAMINOGO_BIN_PATH="$(realpath "${CAMINOGO_BIN_PATH:-./build/caminogo}")" ################################# # clone caminogo tag # https://github.com/chain4travel/caminogo.git -GOARCH=$(go env GOARCH) -GOOS=$(go env GOOS) GIT_URL=https://github.com/chain4travel/caminogo.git rm -rf "/tmp/caminogo-${VERSION}" rm -rf /tmp/caminogo-build echo "cloning caminogo tag ${VERSION}" -git clone -b ${VERSION} ${GIT_URL} /tmp/caminogo-${VERSION} +git clone -b "${VERSION}" ${GIT_URL} /tmp/caminogo-${VERSION} find "/tmp/caminogo-${VERSION}" -cd /tmp/caminogo-${VERSION} +cd "/tmp/caminogo-${VERSION}" ./scripts/build.sh From a430d158bc18d74becc02d90fa715939033efe6d Mon Sep 17 00:00:00 2001 From: Mohamed Elmoslemany Date: Thu, 4 Jul 2024 11:00:01 +0200 Subject: [PATCH 4/9] fix lint issues --- scripts/tests.upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tests.upgrade.sh b/scripts/tests.upgrade.sh index 0bd1db28d027..f4d88f48a2ac 100755 --- a/scripts/tests.upgrade.sh +++ b/scripts/tests.upgrade.sh @@ -37,7 +37,7 @@ rm -rf "/tmp/caminogo-${VERSION}" rm -rf /tmp/caminogo-build echo "cloning caminogo tag ${VERSION}" -git clone -b "${VERSION}" ${GIT_URL} /tmp/caminogo-${VERSION} +git clone -b "${VERSION}" ${GIT_URL} "/tmp/caminogo-${VERSION}" find "/tmp/caminogo-${VERSION}" From 02bb3278ad1f76a16881c5e0bc42a9d9b2b87585 Mon Sep 17 00:00:00 2001 From: Mohamed Elmoslemany Date: Thu, 4 Jul 2024 11:19:42 +0200 Subject: [PATCH 5/9] fix tests upgrade run issues --- scripts/tests.upgrade.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/tests.upgrade.sh b/scripts/tests.upgrade.sh index f4d88f48a2ac..15d8b1d5d112 100755 --- a/scripts/tests.upgrade.sh +++ b/scripts/tests.upgrade.sh @@ -43,6 +43,7 @@ find "/tmp/caminogo-${VERSION}" cd "/tmp/caminogo-${VERSION}" ./scripts/build.sh +cd - # Sourcing constants.sh ensures that the necessary CGO flags are set to @@ -60,7 +61,7 @@ ACK_GINKGO_RC=true ginkgo build ./tests/upgrade ################################# # By default, it runs all upgrade test cases! -echo "running upgrade tests against the local cluster with ${CAMINOGO_BIN_PATH}" +echo "running upgrade tests against the local cluster with ${CAMINOGO_BIN_PATH}" ./tests/upgrade/upgrade.test \ --ginkgo.v \ --caminogo-path="/tmp/caminogo-${VERSION}/build/caminogo" \ From 1cb96179bb1c087221c4e82698c7dfee5dbd513b Mon Sep 17 00:00:00 2001 From: Mohamed Elmoslemany Date: Wed, 10 Jul 2024 00:30:52 +0200 Subject: [PATCH 6/9] set default tag to v1.1.20-rc0 --- scripts/tests.upgrade.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/tests.upgrade.sh b/scripts/tests.upgrade.sh index 15d8b1d5d112..44ab023a6501 100755 --- a/scripts/tests.upgrade.sh +++ b/scripts/tests.upgrade.sh @@ -16,7 +16,7 @@ fi # local network, this flag must be updated to the last compatible # version with the latest code. -DEFAULT_VERSION="v1.1.15-rc1" +DEFAULT_VERSION="v1.1.20-rc0" VERSION="${1:-${DEFAULT_VERSION}}" @@ -29,7 +29,7 @@ fi CAMINOGO_BIN_PATH="$(realpath "${CAMINOGO_BIN_PATH:-./build/caminogo}")" ################################# -# clone caminogo tag +# clone caminogo tag/branch # https://github.com/chain4travel/caminogo.git GIT_URL=https://github.com/chain4travel/caminogo.git From 11c5959cfacd7aaa58c4b5ede205d3a6b72d8e99 Mon Sep 17 00:00:00 2001 From: Mohamed Elmoslemany Date: Wed, 10 Jul 2024 10:50:31 +0200 Subject: [PATCH 7/9] remove caminogo_path variable --- scripts/build.sh | 2 +- scripts/constants.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 1e7023b6997c..d1010b305e2f 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -37,7 +37,7 @@ build_args="$race" "$CAMINO_PATH"/scripts/build_camino.sh $build_args # Exit build successfully if the CaminoGo binary is created successfully -if [[ -f "$caminogo_path" ]]; then +if [[ -f "$CAMINOGO_BIN_PATH" ]]; then echo "Build Successful" exit 0 else diff --git a/scripts/constants.sh b/scripts/constants.sh index e22eef0b3b5b..782b378c71e3 100755 --- a/scripts/constants.sh +++ b/scripts/constants.sh @@ -12,7 +12,6 @@ CAMINOGO_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) # Where CaminoGo binary goes build_dir="$CAMINOGO_PATH/build" -caminogo_path="$build_dir/caminogo" CAMINOGO_BIN_PATH="$build_dir/caminogo" camino_node_symlink_path="$build_dir/camino-node" plugin_dir="$build_dir/plugins" From c0d2e597c02fb29226e9a418c4eeb0b9f84b71bf Mon Sep 17 00:00:00 2001 From: Mohamed Elmoslemany Date: Wed, 10 Jul 2024 17:16:28 +0200 Subject: [PATCH 8/9] use github token for protobuf github action --- .github/workflows/buf-push.yml | 2 ++ .github/workflows/ci.yml | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/buf-push.yml b/.github/workflows/buf-push.yml index 69fbdfdf3241..359a02bbb342 100644 --- a/.github/workflows/buf-push.yml +++ b/.github/workflows/buf-push.yml @@ -9,6 +9,8 @@ jobs: steps: - uses: actions/checkout@v3 - uses: bufbuild/buf-setup-action@v1.34.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} - uses: bufbuild/buf-push-action@v1 with: input: "proto" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4253a843c740..8ac420638c2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -141,7 +141,7 @@ jobs: - uses: actions/checkout@v4 - uses: bufbuild/buf-setup-action@v1.34.0 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ github.token }} - uses: bufbuild/buf-lint-action@v1 with: input: "proto" @@ -155,6 +155,8 @@ jobs: go-version: ${{ env.go_version }} check-latest: true - uses: bufbuild/buf-setup-action@v1.34.0 + with: + github_token: ${{ github.token }} - shell: bash run: scripts/protobuf_codegen.sh - shell: bash From d9a50d3332d89276491ab0aa434cf498795a4084 Mon Sep 17 00:00:00 2001 From: Mohamed Elmoslemany Date: Wed, 10 Jul 2024 17:38:58 +0200 Subject: [PATCH 9/9] use github token for protobuf github action --- .github/workflows/buf-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buf-push.yml b/.github/workflows/buf-push.yml index 359a02bbb342..7ed99cf356f2 100644 --- a/.github/workflows/buf-push.yml +++ b/.github/workflows/buf-push.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v3 - uses: bufbuild/buf-setup-action@v1.34.0 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ github.token }} - uses: bufbuild/buf-push-action@v1 with: input: "proto"