Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: refactored Taskfiles, fixed bugs with taskfile, lease interval, sdk node client connection, and commands missing quiet flag #978

Merged
merged 46 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
bede370
squashed commits
jeromy-cannon Dec 18, 2024
937a13e
bumped version to 0.57.3 for hedera platform
jeromy-cannon Dec 18, 2024
a3c63ea
renamed namespace in test
jeromy-cannon Dec 18, 2024
1221a19
renamed one of the taskfiles to prevent accidentally picking up a dif…
jeromy-cannon Dec 18, 2024
7396911
switched to use exec container instead of port forward against networ…
jeromy-cannon Dec 18, 2024
2d83dac
for port forward, if haproxy load balancer ip is set, use it and test…
jeromy-cannon Dec 18, 2024
6ced2fb
moved and updated readme for examples that use task
jeromy-cannon Dec 18, 2024
d90d27b
removed todo
jeromy-cannon Dec 18, 2024
8f54e4d
removed duplicate
jeromy-cannon Dec 18, 2024
b0973d4
updated readme
jeromy-cannon Dec 18, 2024
85bacfd
updated task doc
jeromy-cannon Dec 18, 2024
ae54e63
final version
jeromy-cannon Dec 18, 2024
dad5dd7
removed todo
jeromy-cannon Dec 18, 2024
3d9a4b7
add prints to help debug
jeromy-cannon Dec 19, 2024
cf1c537
fix miss when switching to flat taskfile include
jeromy-cannon Dec 19, 2024
4c11e79
fixed network.test.ts
jeromy-cannon Dec 19, 2024
6cd9977
fix test_util.ts
jeromy-cannon Dec 19, 2024
a37658f
fix node_upgrade.test.ts
jeromy-cannon Dec 19, 2024
a7a9908
fix node_upgrade.test.ts
jeromy-cannon Dec 19, 2024
bbf4d41
fix lint issues in example README.md
jeromy-cannon Dec 19, 2024
1500524
fix node_upgrade.test.ts test
jeromy-cannon Dec 19, 2024
26effd1
use helm binary from Solo
jeromy-cannon Dec 19, 2024
a03aacf
update to latest version of platform
jeromy-cannon Dec 19, 2024
83bf765
removed version check logic that would leverage ubinit with java 17, …
jeromy-cannon Dec 19, 2024
d4cf82b
full match on pkill
jeromy-cannon Dec 19, 2024
155e1cd
updating logs for interval_lease.ts to help troubleshoot
jeromy-cannon Dec 19, 2024
83264b8
added debug message to interval_lease.ts
jeromy-cannon Dec 19, 2024
3b517bb
removed no longer needed if check for version less than 40
jeromy-cannon Dec 19, 2024
e036a35
don't set the release tag if the local build path is used
jeromy-cannon Dec 19, 2024
48a78c2
enhance debugging error message
jeromy-cannon Dec 19, 2024
b5119c4
set new lease holder for acquire
jeromy-cannon Dec 19, 2024
8c75230
set new lease holder for acquire
jeromy-cannon Dec 20, 2024
459d43a
reverted checkExpiration to static after no longer needing debug log …
jeromy-cannon Dec 20, 2024
ad1e3fa
correct usage of taskfile var usage
jeromy-cannon Dec 20, 2024
2f08380
reduce number of nodes running for CICD
jeromy-cannon Dec 20, 2024
13d0681
fixed node local hedera test and made grpc client connection more res…
jeromy-cannon Dec 20, 2024
7d04b0d
fixed bug where client.isClientShutDown could be null
jeromy-cannon Dec 20, 2024
0ee8cff
fixed tsdoc
jeromy-cannon Dec 20, 2024
4f5f75c
removed test that was no longer needed
jeromy-cannon Dec 20, 2024
17e7e9c
removed test that was no longer needed
jeromy-cannon Dec 20, 2024
db61cc1
removed comment that is out of context
jeromy-cannon Dec 20, 2024
cafbc7e
make parameter optional
jeromy-cannon Dec 20, 2024
b863bc5
removed unused import
jeromy-cannon Dec 20, 2024
d58e133
incorrect optional parameter syntax
jeromy-cannon Dec 20, 2024
ee718b2
missed some locations for shouldLoadNodeClient
jeromy-cannon Dec 20, 2024
0973c00
got test cases working
jeromy-cannon Dec 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/script/solo_smoke_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function start_sdk_test ()
}

echo "Restart port-forward"
task helper:clean:port-forward
task clean:port-forward
enable_port_forward


Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zxc-e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ jobs:
if: ${{ runner.os == 'linux' && (inputs.npm-test-script == 'test-e2e-node-local-hedera' || inputs.npm-test-script == 'test-e2e-node-local-ptt' || inputs.npm-test-script == 'test-e2e-node-add-local') && !cancelled() && !failure() }}
run: |
cd ..
git clone https://github.com/hashgraph/hedera-services.git --depth 1 --branch v0.56.0
git clone https://github.com/hashgraph/hedera-services.git --depth 1 --branch v0.57.3
cd hedera-services
ls -ltr
${{ env.CG_EXEC }} ./gradlew assemble --stacktrace --info
Expand Down
284 changes: 243 additions & 41 deletions HelperTasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,72 @@ vars:
node_list_internal: "{{range $idx, $n := .nodes }}node{{add $n 1}},{{end}}"
node_identifiers: "{{ .node_list_internal | trimSuffix \",\" }}"

solo_user_dir: "{{ env \"HOME\" }}/.solo"
solo_user_dir: "{{ .solo_home_override_dir | default (printf \"%s/.solo\" (env \"HOME\")) }}"
solo_cache_dir: "{{ .solo_user_dir }}/cache"
solo_logs_dir: "{{ .solo_user_dir }}/logs"
solo_keys_dir: "{{ .solo_cache_dir }}/keys"
solo_bin_dir: "{{ .solo_user_dir }}/bin"
run_build_file:
sh: (echo "/tmp/run-build-$(date +%Y%m%d%H%M%S)")
var_check_file:
sh: (echo "/tmp/var-check-$(date +%Y%m%d%H%M%S)")
minio_flag_file:
sh: (echo "/tmp/minio-flag-$(date +%Y%m%d%H%M%S)")

env:
SOLO_CLUSTER_SETUP_NAMESPACE: solo-setup
SOLO_CLUSTER_RELEASE_NAME: solo-cluster-setup
SOLO_CLUSTER_NAME: solo-cluster
MIRROR_RELEASE_NAME: mirror

tasks:
init:
cmds:
- task: "var:check"
- task: "run:build"

var:check:
silent: true
status:
- test -f {{ .var_check_file }}
requires:
vars:
- solo_user_dir
- solo_cache_dir
- solo_logs_dir
- solo_keys_dir
- solo_bin_dir
- nodes
- node_list_internal
- node_identifiers
- run_build_file
- SOLO_CHART_VERSION
- CONSENSUS_NODE_VERSION
- SOLO_NAMESPACE
- SOLO_CLUSTER_SETUP_NAMESPACE
- SOLO_CLUSTER_RELEASE_NAME
- SOLO_NETWORK_SIZE
- SOLO_CLUSTER_NAME
- MIRROR_RELEASE_NAME
cmds:
- echo "Checking variables..."
- echo "solo_user_dir={{ .solo_user_dir }}"
- echo "SOLO_HOME=${SOLO_HOME}"
- echo "SOLO_NETWORK_SIZE=${SOLO_NETWORK_SIZE}"
- echo "SOLO_CHART_VERSION=${SOLO_CHART_VERSION}"
- echo "CONSENSUS_NODE_VERSION=${CONSENSUS_NODE_VERSION}"
- echo "SOLO_NAMESPACE=${SOLO_NAMESPACE}"
- echo "SOLO_CLUSTER_RELEASE_NAME=${SOLO_CLUSTER_RELEASE_NAME}"
- echo "nodes={{ .nodes }}"
- echo "node_identifiers={{ .node_identifiers }}"
- echo "use_port_forwards={{ .use_port_forwards }}"
- echo "VALUES_FLAG=${VALUES_FLAG}"
- echo "SETTINGS_FLAG=${SETTINGS_FLAG}"
- echo "LOG4J2_FLAG=${LOG4J2_FLAG}"
- echo "APPLICATION_PROPERTIES_FLAG=${APPLICATION_PROPERTIES_FLAG}"
- echo "LOCAL_BUILD_FLAG=${LOCAL_BUILD_FLAG}"
- touch {{ .var_check_file }}

readme:
silent: true
cmds:
Expand All @@ -31,12 +90,9 @@ tasks:

install:solo:
internal: true
status:
- command -v solo
cmds:
- npm install -g @hashgraph/solo
- cd ../..
- npm link
- cd ..
- npm install

install:kubectl:darwin:
internal: true
Expand All @@ -61,6 +117,9 @@ tasks:

solo:init:
internal: true
silent: true
deps:
- task: "init"
status:
- test -f {{ .solo_bin_dir }}/helm
- test -f {{ .solo_cache_dir }}/profiles/custom-spec.yaml
Expand All @@ -72,8 +131,7 @@ tasks:
#- test "$(yq -r '.flags."node-ids"' < {{ .solo_user_dir }}/solo.yaml)" == "{{ .node_identifiers }}"
- test "$(jq -r '.flags."node-ids"' < {{ .solo_user_dir }}/solo.config)" == "{{ .node_identifiers }}"
cmds:
- npm run build
- solo init
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- init

solo:keys:
internal: true
Expand All @@ -85,57 +143,72 @@ tasks:
test -f {{ .solo_keys_dir }}/s-public-node${n}.pem
test -f {{ .solo_keys_dir }}/s-private-node${n}.pem
done
deps:
- task: "init"
cmds:
- npm run build
- solo node keys --gossip-keys --tls-keys --node-aliases-unparsed {{.node_identifiers}}
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- node keys --gossip-keys --tls-keys --node-aliases-unparsed {{.node_identifiers}} -q

solo:network:deploy:
internal: true
deps:
- task: "init"
cmds:
- npm run build
- solo network deploy --namespace "${SOLO_NAMESPACE}" --node-aliases-unparsed {{.node_identifiers}} --release-tag "${CONSENSUS_NODE_VERSION}" --solo-chart-version "${SOLO_CHART_VERSION}"
- solo node setup --namespace "${SOLO_NAMESPACE}" --node-aliases-unparsed {{.node_identifiers}} --release-tag "${CONSENSUS_NODE_VERSION}"
- |
unset RELEASE_FLAG
if [[ "${LOCAL_BUILD_FLAG}" == "" ]]; then
export RELEASE_FLAG='--release-tag {{.CONSENSUS_NODE_VERSION}}'
fi
SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- network deploy --namespace "${SOLO_NAMESPACE}" --node-aliases-unparsed {{.node_identifiers}} ${RELEASE_FLAG} --solo-chart-version "${SOLO_CHART_VERSION}" ${VALUES_FLAG} ${SETTINGS_FLAG} ${LOG4J2_FLAG} ${APPLICATION_PROPERTIES_FLAG} -q
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- node setup --namespace "${SOLO_NAMESPACE}" --node-aliases-unparsed {{.node_identifiers}} --release-tag "${CONSENSUS_NODE_VERSION}" ${LOCAL_BUILD_FLAG} -q

solo:network:destroy:
internal: true
deps:
- task: "init"
cmds:
- npm run build
- solo network destroy --namespace "${SOLO_NAMESPACE}" --delete-pvcs --delete-secrets --force
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- network destroy --namespace "${SOLO_NAMESPACE}" --delete-pvcs --delete-secrets --force -q

solo:node:start:
internal: true
deps:
- task: "init"
cmds:
- npm run build
- solo node start --namespace "${SOLO_NAMESPACE}" --node-aliases-unparsed {{.node_identifiers}} {{ .CLI_ARGS }}
- kubectl port-forward -n "${SOLO_NAMESPACE}" svc/haproxy-node1-svc 50211:50211 &
- task: "sleep_after_port_forward"
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- node start --namespace "${SOLO_NAMESPACE}" --node-aliases-unparsed {{.node_identifiers}} -q {{ .CLI_ARGS }}
- |
if [[ "{{ .use_port_forwards }}" == "true" ]];then
echo "Enable port forwarding for Hedera Node"
kubectl port-forward -n "${SOLO_NAMESPACE}" svc/haproxy-node1-svc 50211:50211 &
sleep 4
fi

solo:node:stop:
internal: true
ignore_error: true
deps:
- task: "init"
cmds:
- npm run build
- solo node stop --namespace "${SOLO_NAMESPACE}" --node-aliases-unparsed {{.node_identifiers}} {{ .CLI_ARGS }}

solo:node:addresses:
internal: true
cmds:
- kubectl get svc -n "${SOLO_NAMESPACE}" -l "solo.hedera.com/type=network-node-svc"
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- node stop --namespace "${SOLO_NAMESPACE}" --node-aliases-unparsed {{.node_identifiers}} -q {{ .CLI_ARGS }}

solo:relay:
deps:
- task: "init"
cmds:
- npm run build
- solo relay deploy -n "${SOLO_NAMESPACE}" -i node1
- echo "Enable port forwarding for Hedera JSON RPC Relay"
- kubectl port-forward -n "${SOLO_NAMESPACE}" svc/relay-node1-hedera-json-rpc-relay 7546:7546 &
- task: "sleep_after_port_forward"
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- relay deploy -n "${SOLO_NAMESPACE}" -i node1 -q
- |
if [[ "{{ .use_port_forwards }}" == "true" ]];then
echo "Enable port forwarding for Hedera JSON RPC Relay"
kubectl port-forward -n "${SOLO_NAMESPACE}" svc/relay-node1-hedera-json-rpc-relay 7546:7546 &
sleep 4
fi

solo:destroy-relay:
status:
- helm list -n "${SOLO_NAMESPACE}" | grep -vqz relay-node1
- |
{{.solo_bin_dir}}/helm list -n "${SOLO_NAMESPACE}" | grep -vqz relay-node1
deps:
- task: "init"
cmds:
- npm run build
- solo relay destroy -n "${SOLO_NAMESPACE}" -i node1
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- relay destroy -n "${SOLO_NAMESPACE}" -i node1 -q

solo:cache:remove:
internal: true
Expand Down Expand Up @@ -163,22 +236,151 @@ tasks:
- kind get clusters | grep -q "${SOLO_CLUSTER_NAME}"
cmds:
- kind create cluster -n "${SOLO_CLUSTER_NAME}" --image "${KIND_IMAGE}"
- sleep 10 # wait for control plane to come up
- kubectl config set-context kind-${SOLO_CLUSTER_NAME}

cluster:setup:
deps:
- task: "init"
cmds:
- npm run build
- solo cluster setup --cluster-setup-namespace "${SOLO_CLUSTER_SETUP_NAMESPACE}"
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- cluster setup --cluster-setup-namespace "${SOLO_CLUSTER_SETUP_NAMESPACE}" -q

cluster:destroy:
cmds:
- kind delete cluster --name "${SOLO_CLUSTER_NAME}"

clean:port-forward:
cmds:
- pkill -f "kubectl port-forward -n {{ .SOLO_NAMESPACE }}" || true
- |
if [[ "{{ .use_port_forwards }}" == "true" ]];then
pkill -f "kubectl port-forward -n {{ .SOLO_NAMESPACE }}" | grep -w ${UID} || true
fi

run:build:
silent: true
status:
- test -f {{ .run_build_file }}
cmds:
- npm run build
- touch {{ .run_build_file }}

solo:cluster:minio:
internal: true
silent: true
cmds:
- |
if ! kubectl get svc -l app.kubernetes.io/instance=minio-operator --all-namespaces --no-headers | grep -q . ; then
echo "No services found with label app.kubernetes.io/name=operator app.kubernetes.io/instance=minio-operator"
echo "--minio" > {{ .minio_flag_file }}
else
echo "--no-minio" > {{ .minio_flag_file }}
fi

solo:cluster:setup:
silent: true
deps:
- task: "init"
- task: "solo:cluster:minio"
status:
- |
{{.solo_bin_dir}}/helm list --all-namespaces | grep -qz "${SOLO_CLUSTER_RELEASE_NAME}"
cmds:
- |
export MINIO_FLAG=$(cat {{ .minio_flag_file }})
SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- cluster setup --cluster-setup-namespace "${SOLO_CLUSTER_SETUP_NAMESPACE}" ${MINIO_FLAG} -q

solo:node:addresses:
internal: true
silent: true
cmds:
- |
echo "External IPs of the network nodes:"
export IP_LIST_TEMPLATE_FILE={{ .TASKFILE_DIR }}/list-external-ips.gotemplate
kubectl get svc -n "${SOLO_NAMESPACE}" -l "solo.hedera.com/type=network-node-svc" --output=go-template-file=${IP_LIST_TEMPLATE_FILE}

start:
desc: solo node start
deps:
- task: "init"
cmds:
- task: "solo:node:start"

stop:
desc: solo node stop
deps:
- task: "init"
cmds:
- task: "solo:node:stop"

show:ips:
deps:
- task: "init"
cmds:
- task: "solo:node:addresses"

clean:cache:
desc: remove solo cache directory
deps:
- task: "init"
cmds:
- task: "solo:cache:remove"

clean:logs:
desc: remove solo logs director
deps:
- task: "init"
cmds:
- task: "solo:logs:remove"


default-with-mirror:
desc: in addition to the defaults, also deploy the mirror node
deps:
- task: "init"
cmds:
- task: "default"
- task: "solo:mirror-node"

default-with-relay:
desc: in addition to default-with-mirror, deploy the JSON RPC relay
deps:
- task: "init"
cmds:
- task: "default"
- task: "solo:mirror-node"
- task: "solo:relay"

solo:mirror-node:
desc: solo mirror-node deploy with port forward on explorer
deps:
- task: "init"
cmds:
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- mirror-node deploy --namespace "${SOLO_NAMESPACE}" -q
- |
if [[ "{{ .use_port_forwards }}" == "true" ]];then
echo "Enable port forwarding for Hedera Explorer & Mirror Node Network"
kubectl port-forward -n "${SOLO_NAMESPACE}" svc/hedera-explorer 8080:80 &
kubectl port-forward svc/mirror-grpc -n "${SOLO_NAMESPACE}" 5600:5600 &
sleep 4
fi

solo:destroy-mirror-node:
desc: solo mirror-node destroy
status:
- |
{{.solo_bin_dir}}/helm list -n "${SOLO_NAMESPACE}" | grep -vqz "${MIRROR_RELEASE_NAME}"
deps:
- task: "init"
cmds:
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- mirror-node destroy --namespace "${SOLO_NAMESPACE}" --force -q || true

sleep_after_port_forward:
clean:
desc: destroy, then remove cache directory, logs directory, config, and port forwards
deps:
- task: "init"
cmds:
# somehow without the sleep, when port-forward is the last command of a series of tasks, port-forward
# prematurely killed when task is exiting
- sleep 4
- task: "destroy"
- task: "clean:cache"
- task: "clean:logs"
- task: "solo:config:remove"
- task: "clean:port-forward"
Loading
Loading