Skip to content

Commit

Permalink
Merge branch 'main' into 01033-production-readiness-enable-blockstrea…
Browse files Browse the repository at this point in the history
…ms-and-uploader

Signed-off-by: Jeromy Cannon <[email protected]>
  • Loading branch information
jeromy-cannon committed Jan 9, 2025
2 parents abe1ee2 + c27d1d6 commit fb89e5a
Show file tree
Hide file tree
Showing 71 changed files with 2,458 additions and 1,530 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/flow-deploy-release-artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ jobs:
npm run build
- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli@f0a84f35b0e0bd21838c5fb3e6788072d6540d13 # v4.5.5
uses: jfrog/setup-jfrog-cli@f748a0599171a192a2668afee8d0497f7c1069df # v4.5.6
env:
JF_URL: ${{ vars.JF_URL }}
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}
Expand Down
113 changes: 113 additions & 0 deletions .github/workflows/flow-gcs-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
##
# Copyright (C) 2023-2024 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##

name: "Test GCS as bucket storage"

on:
workflow_dispatch:
workflow_call:

defaults:
run:
shell: bash

permissions:
id-token: write
contents: read
actions: read

jobs:
gcs-storage-test:
timeout-minutes: 20
runs-on: solo-linux-large
strategy:
matrix:
storageType: ["gcs_only", "gcs_and_minio"]
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Authenticate to Google Cloud
id: google-auth
uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f # v2.1.7
with:
workload_identity_provider: "projects/652966097426/locations/global/workloadIdentityPools/solo-bucket-dev-pool/providers/gh-provider"
service_account: "solo-bucket-reader-writer@solo-bucket-dev.iam.gserviceaccount.com"

- name: Setup Google Cloud SDK
uses: google-github-actions/setup-gcloud@6189d56e4096ee891640bb02ac264be376592d6a # v2.1.2

- name: Get Current Job Log URL
uses: Tiryoh/gha-jobid-action@v1
id: jobs
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
job_name: "gcs-storage-test (${{ matrix.storageType }})"

- name: Create GCS bucket
# create a new bucket and use job runner id as prefix
run: |
export BUCKET_NAME=${{ steps.jobs.outputs.job_id }}-solo-streams
gcloud storage buckets create gs://${BUCKET_NAME} --project=${{ vars.GCP_S3_PROJECT_ID }}
echo "BUCKET_NAME=${BUCKET_NAME}" >> $GITHUB_ENV
- name: Setup Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20
cache: npm

- name: Setup Helm
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
with:
version: "v3.12.3" # helm version

- name: Setup Kind
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
with:
install_only: true
node_image: kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72
version: v0.21.0
kubectl_version: v1.28.6
verbosity: 3
wait: 120s

- name: Install Dependencies
id: npm-deps
run: |
npm ci
npm install -g @hashgraph/solo
- name: Compile Project
run: npm run build

- name: Run GCS Test Script for type ${{ matrix.channel }}
env:
GCS_ACCESS_KEY: ${{ secrets.GCP_S3_ACCESS_KEY }}
GCS_SECRET_KEY: ${{ secrets.GCP_S3_SECRET_KEY }}
BUCKET_NAME: ${{ env.BUCKET_NAME }}
STORAGE_TYPE: ${{ matrix.storageType }}
run: |
.github/workflows/script/gcs_test.sh
- name: Delete Bucket after Test
run: |
gcloud storage rm --recursive gs://${BUCKET_NAME} --project=${{ vars.GCP_S3_PROJECT_ID }}
7 changes: 0 additions & 7 deletions .github/workflows/flow-task-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ jobs:
verbosity: 3
wait: 120s

- name: Install Dependencies
id: npm-deps
run: npm ci

- name: Compile Project
run: npm run build

- name: Run Example Task File Test
run: |
task default-with-relay
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/script/gcs_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash
set -eo pipefail

source .github/workflows/script/helper.sh

if [ -z "${GCS_ACCESS_KEY}" ]; then
echo "GCS_ACCESS_KEY is not set. Exiting..."
exit 1
fi

if [ -z "${GCS_SECRET_KEY}" ]; then
echo "GCS_SECRET_KEY is not set. Exiting..."
exit 1
fi

if [ -z "${BUCKET_NAME}" ]; then
streamBucket="solo-ci-test-streams"
else
streamBucket=${BUCKET_NAME}
fi

if [ -z "${STORAGE_TYPE}" ]; then
storageType="gcs_and_minio"
else
storageType=${STORAGE_TYPE}
fi

echo "Using bucket name: ${streamBucket}"
echo "Test storage type: ${storageType}"

SOLO_CLUSTER_NAME=solo-e2e
SOLO_NAMESPACE=solo-e2e
SOLO_CLUSTER_SETUP_NAMESPACE=solo-setup

kind delete cluster -n "${SOLO_CLUSTER_NAME}"
kind create cluster -n "${SOLO_CLUSTER_NAME}"
npm run solo-test -- init
npm run solo-test -- cluster setup \
-s "${SOLO_CLUSTER_SETUP_NAMESPACE}"
npm run solo-test -- node keys --gossip-keys --tls-keys -i node1
npm run solo-test -- network deploy -i node1 -n "${SOLO_NAMESPACE}" \
--storage-endpoint "https://storage.googleapis.com" \
--storage-access-key "${GCS_ACCESS_KEY}" --storage-secrets "${GCS_SECRET_KEY}" \
--storage-type "${storageType}" --storage-bucket "${streamBucket}"

npm run solo-test -- node setup -i node1 -n "${SOLO_NAMESPACE}"
npm run solo-test -- node start -i node1 -n "${SOLO_NAMESPACE}"
npm run solo-test -- mirror-node deploy --namespace "${SOLO_NAMESPACE}" \
--storage-endpoint "https://storage.googleapis.com" \
--storage-access-key "${GCS_ACCESS_KEY}" --storage-secrets "${GCS_SECRET_KEY}" \
--storage-type "${storageType}" --storage-bucket "${streamBucket}"

kubectl port-forward -n "${SOLO_NAMESPACE}" svc/haproxy-node1-svc 50211:50211 > /dev/null 2>&1 &
kubectl port-forward -n "${SOLO_NAMESPACE}" svc/hedera-explorer 8080:80 > /dev/null 2>&1 &

cd ..; create_test_account ; cd -

node examples/create-topic.js

npm run solo-test -- node stop -i node1 -n "${SOLO_NAMESPACE}"
37 changes: 37 additions & 0 deletions .github/workflows/script/helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
set -eo pipefail

function create_test_account ()
{
echo "Create test account with solo network"
cd solo

# create new account and extract account id
npm run solo-test -- account create -n solo-e2e --hbar-amount 100 --generate-ecdsa-key --set-alias > test.log
export OPERATOR_ID=$(grep "accountId" test.log | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')
echo "OPERATOR_ID=${OPERATOR_ID}"
rm test.log

# get private key of the account
npm run solo-test -- account get -n solo-e2e --account-id ${OPERATOR_ID} --private-key > test.log
export OPERATOR_KEY=$(grep "privateKey" test.log | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')
export CONTRACT_TEST_KEY_ONE=0x$(grep "privateKeyRaw" test.log | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')
echo "CONTRACT_TEST_KEY_ONE=${CONTRACT_TEST_KEY_ONE}"
rm test.log

npm run solo-test -- account create -n solo-e2e --hbar-amount 100 --generate-ecdsa-key --set-alias > test.log
export SECOND_KEY=$(grep "accountId" test.log | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')
npm run solo-test -- account get -n solo-e2e --account-id ${SECOND_KEY} --private-key > test.log
export CONTRACT_TEST_KEY_TWO=0x$(grep "privateKeyRaw" test.log | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')
echo "CONTRACT_TEST_KEY_TWO=${CONTRACT_TEST_KEY_TWO}"
rm test.log

export CONTRACT_TEST_KEYS=${CONTRACT_TEST_KEY_ONE},$'\n'${CONTRACT_TEST_KEY_TWO}
export HEDERA_NETWORK="local-node"

echo "OPERATOR_KEY=${OPERATOR_KEY}"
echo "HEDERA_NETWORK=${HEDERA_NETWORK}"
echo "CONTRACT_TEST_KEYS=${CONTRACT_TEST_KEYS}"

cd -
}
37 changes: 1 addition & 36 deletions .github/workflows/script/solo_smoke_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -eo pipefail
# Then run smart contract test, and also javascript sdk sample test to interact with solo network
#

function_name=""
source .github/workflows/script/helper.sh

function enable_port_forward ()
{
Expand Down Expand Up @@ -73,41 +73,6 @@ function start_contract_test ()
return $result
}

function create_test_account ()
{
echo "Create test account with solo network"
cd solo

# create new account and extract account id
npm run solo-test -- account create -n solo-e2e --hbar-amount 100 --generate-ecdsa-key --set-alias > test.log
export OPERATOR_ID=$(grep "accountId" test.log | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')
echo "OPERATOR_ID=${OPERATOR_ID}"
rm test.log

# get private key of the account
npm run solo-test -- account get -n solo-e2e --account-id ${OPERATOR_ID} --private-key > test.log
export OPERATOR_KEY=$(grep "privateKey" test.log | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')
export CONTRACT_TEST_KEY_ONE=0x$(grep "privateKeyRaw" test.log | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')
echo "CONTRACT_TEST_KEY_ONE=${CONTRACT_TEST_KEY_ONE}"
rm test.log

npm run solo-test -- account create -n solo-e2e --hbar-amount 100 --generate-ecdsa-key --set-alias > test.log
export SECOND_KEY=$(grep "accountId" test.log | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')
npm run solo-test -- account get -n solo-e2e --account-id ${SECOND_KEY} --private-key > test.log
export CONTRACT_TEST_KEY_TWO=0x$(grep "privateKeyRaw" test.log | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')
echo "CONTRACT_TEST_KEY_TWO=${CONTRACT_TEST_KEY_TWO}"
rm test.log

export CONTRACT_TEST_KEYS=${CONTRACT_TEST_KEY_ONE},$'\n'${CONTRACT_TEST_KEY_TWO}
export HEDERA_NETWORK="local-node"

echo "OPERATOR_KEY=${OPERATOR_KEY}"
echo "HEDERA_NETWORK=${HEDERA_NETWORK}"
echo "CONTRACT_TEST_KEYS=${CONTRACT_TEST_KEYS}"

cd -
}

function start_sdk_test ()
{
cd solo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zxc-update-readme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ jobs:
if : ${{ github.event.inputs.dry-run-enabled != 'true' && !cancelled() && !failure() && inputs.commit-changes }}
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # v5.0.1
with:
commit_message: "auto update docs/content/User/StepByStepGuide.md [skip ci]"
commit_message: "chore: auto update docs/content/User/StepByStepGuide.md"
commit_options: '--no-verify --signoff'
add_options: '-u'
file_pattern: 'docs/content/User/StepByStepGuide.md'
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"bracketSpacing": false,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid"
"arrowParens": "avoid",
"printWidth": 120
}
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,22 @@ To run a three-node network, you will need to set up Docker Desktop with at leas

## Setup

* Install [Node](https://nodejs.org/en/download). You may also use [nvm](https://github.com/nvm-sh/nvm) to manage different Node versions locally:
* Install [Node](https://nodejs.org/en/download). You may also use [nvm](https://github.com/nvm-sh/nvm) to manage different Node versions locally, some examples:

```
nvm install lts/hydrogen
nvm use lts/hydrogen
# install specific nodejs version
# nvm install <version>
# install nodejs version 20.18.0
nvm install v20.18.0
# lists available node versions already installed
nvm ls
# swith to selected node version
# nvm use <version>
nvm use v20.18.0
```

* Useful tools:
Expand Down Expand Up @@ -63,4 +74,4 @@ expected to uphold this code of conduct.

## License

[Apache License 2.0](LICENSE)
[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)
Loading

0 comments on commit fb89e5a

Please sign in to comment.