Skip to content

Commit

Permalink
fix: fixed genesis-network.json file lock issue (#1074)
Browse files Browse the repository at this point in the history
Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>
  • Loading branch information
jeromy-cannon authored Dec 31, 2024
1 parent b9f2e1c commit e590516
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 29 deletions.
37 changes: 33 additions & 4 deletions HelperTasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ vars:
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)")
solo_chart_file:
sh: (echo "/tmp/solo-chart-$(date +%Y%m%d%H%M%S)")
solo_consensus_file:
sh: (echo "/tmp/solo-consensus-$(date +%Y%m%d%H%M%S)")

env:
SOLO_CLUSTER_SETUP_NAMESPACE: solo-setup
Expand Down Expand Up @@ -47,8 +51,6 @@ tasks:
- node_list_internal
- node_identifiers
- run_build_file
- SOLO_CHART_VERSION
- CONSENSUS_NODE_VERSION
- SOLO_NAMESPACE
- SOLO_CLUSTER_SETUP_NAMESPACE
- SOLO_CLUSTER_RELEASE_NAME
Expand Down Expand Up @@ -158,8 +160,15 @@ tasks:
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
if [[ "${SOLO_CHART_VERSION}" != "" ]]; then
export SOLO_CHART_FLAG='--solo-chart-version ${SOLO_CHART_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_FLAG} ${VALUES_FLAG} ${SETTINGS_FLAG} ${LOG4J2_FLAG} ${APPLICATION_PROPERTIES_FLAG} -q
- |
if [[ "${CONSENSUS_NODE_VERSION}" != "" ]]; then
export CONSENSUS_NODE_FLAG='--release-tag ${CONSENSUS_NODE_VERSION}'
fi
SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- node setup --namespace "${SOLO_NAMESPACE}" --node-aliases-unparsed {{.node_identifiers}} ${CONSENSUS_NODE_FLAG} ${LOCAL_BUILD_FLAG} -q
solo:network:destroy:
internal: true
Expand Down Expand Up @@ -211,24 +220,30 @@ tasks:
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- relay destroy -n "${SOLO_NAMESPACE}" -i node1 -q

solo:cache:remove:
silent: true
internal: true
status:
- test [[ ! -d {{ .solo_cache_dir }} ]]
cmds:
- echo "Removing solo cache directory..."
- rm -rf {{ .solo_cache_dir }}

solo:logs:remove:
silent: true
internal: true
status:
- test [[ ! -d {{ .solo_logs_dir }} ]]
cmds:
- echo "Removing solo logs directory..."
- rm -rf {{ .solo_logs_dir }}

solo:config:remove:
silent: true
internal: true
status:
- test [[ ! -f {{ .solo_user_dir }}/solo.yaml ]]
cmds:
- echo "Removing solo config..."
- rm -rf {{ .solo_user_dir }}/solo.yaml

cluster:create:
Expand All @@ -250,7 +265,9 @@ tasks:
- kind delete cluster --name "${SOLO_CLUSTER_NAME}"

clean:port-forward:
silent: true
cmds:
- echo "Cleaning up port forwards..."
- |
if [[ "{{ .use_port_forwards }}" == "true" ]];then
pkill -f "kubectl port-forward -n {{ .SOLO_NAMESPACE }}" | grep -w ${UID} || true
Expand Down Expand Up @@ -384,3 +401,15 @@ tasks:
- task: "clean:logs"
- task: "solo:config:remove"
- task: "clean:port-forward"
- task: "clean:tmp"

clean:tmp:
desc: remove temporary files
silent: true
cmds:
- echo "Cleaning up temporary files..."
- rm -f /tmp/run-build-*
- rm -f /tmp/var-check-*
- rm -f /tmp/minio-flag-*
- rm -f /tmp/solo-chart-*
- rm -f /tmp/solo-consensus-*
4 changes: 2 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ includes:
env:
SOLO_NETWORK_SIZE: 2
SOLO_NAMESPACE: solo-e2e
SOLO_CHART_VERSION: 0.36.3
CONSENSUS_NODE_VERSION: v0.58.0
# SOLO_CHART_VERSION: 0.39.0
# CONSENSUS_NODE_VERSION: v0.58.0
vars:
use_port_forwards: "true"

Expand Down
4 changes: 2 additions & 2 deletions examples/custom-network-config/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ includes:
env:
SOLO_NETWORK_SIZE: 10
SOLO_NAMESPACE: solo-alex-kuzmin-n4
SOLO_CHART_VERSION: 0.36.3
CONSENSUS_NODE_VERSION: v0.58.0
# SOLO_CHART_VERSION: 0.39.0
# CONSENSUS_NODE_VERSION: v0.58.0
VALUES_FLAG: "--values-file {{.USER_WORKING_DIR}}/init-containers-values.yaml"
SETTINGS_FLAG: "--settings-txt {{.USER_WORKING_DIR}}/settings.txt"
SOLO_HOME: "/Users/user/.solo-alex-kuzmin-n4"
Expand Down
6 changes: 3 additions & 3 deletions examples/performance-tuning/Latitude/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ vars:
solo_home_override_dir: "%HOME%/.solo"
env:
SOLO_NETWORK_SIZE: 10
SOLO_NAMESPACE: %SOLO_NAMESPACE%
SOLO_CHART_VERSION: 0.36.3
CONSENSUS_NODE_VERSION: 0.0.0
SOLO_NAMESPACE: "{{.SOLO_NAMESPACE}}"
# SOLO_CHART_VERSION: 0.39.0
# CONSENSUS_NODE_VERSION: 0.0.0
VALUES_FLAG: "--values-file {{.USER_WORKING_DIR}}/init-containers-values.yaml"
SETTINGS_FLAG: "--settings-txt {{.USER_WORKING_DIR}}/settings.txt"
SOLO_HOME: "{{.solo_home_override_dir}}"
Expand Down
4 changes: 2 additions & 2 deletions examples/performance-tuning/solo-perf-test/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ includes:
env:
SOLO_NETWORK_SIZE: 7
SOLO_NAMESPACE: solo-perf-test
SOLO_CHART_VERSION: 0.36.3
CONSENSUS_NODE_VERSION: v0.58.0
# SOLO_CHART_VERSION: 0.39.0
# CONSENSUS_NODE_VERSION: v0.58.0
VALUES_FLAG: "--values-file {{.USER_WORKING_DIR}}/init-containers-values.yaml"
SETTINGS_FLAG: "--settings-txt {{.USER_WORKING_DIR}}/settings.txt"
SOLO_HOME: "/Users/user/.solo-perf-test"
Expand Down
4 changes: 2 additions & 2 deletions examples/solo-gke-test/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ vars:
env:
SOLO_NETWORK_SIZE: 5
SOLO_NAMESPACE: solo-gke-test
SOLO_CHART_VERSION: 0.36.3
CONSENSUS_NODE_VERSION: v0.58.0
# SOLO_CHART_VERSION: 0.39.0
# CONSENSUS_NODE_VERSION: v0.58.0
VALUES_FLAG: "--values-file {{.USER_WORKING_DIR}}/init-containers-values.yaml"
SETTINGS_FLAG: "--settings-txt {{.USER_WORKING_DIR}}/settings.txt"
SOLO_HOME: "{{.solo_home_override_dir}}"
Expand Down
4 changes: 2 additions & 2 deletions src/commands/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,9 @@ export class Flags {
return await Flags.promptText(
task,
input,
'v0.42.5',
version.HEDERA_PLATFORM_VERSION,
'Enter release version: ',
'release tag cannot be empty',
undefined,
Flags.releaseTag.name,
);
},
Expand Down
6 changes: 4 additions & 2 deletions src/core/profile_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import type {GenesisNetworkDataConstructor} from './genesis_network_models/genes
import type {Optional} from '../types/index.js';
import {inject, injectable} from 'tsyringe-neo';
import {patchInject} from './container_helper.js';
import {HEDERA_PLATFORM_VERSION} from '../../version.js';

const consensusSidecars = [
'recordStreamUploader',
Expand Down Expand Up @@ -486,16 +487,17 @@ export class ProfileManager {
namespace: string,
nodeAccountMap: Map<NodeAlias, string>,
destPath: string,
releaseTag: string,
releaseTagOverride: string,
appName = constants.HEDERA_APP_NAME,
chainId = constants.HEDERA_CHAIN_ID,
genesisNetworkData?: GenesisNetworkDataConstructor,
) {
let releaseTag = releaseTagOverride;
if (!nodeAccountMap || nodeAccountMap.size === 0) {
throw new MissingArgumentError('nodeAccountMap the map of node IDs to account IDs is required');
}

if (!releaseTag) throw new MissingArgumentError('release tag is required');
if (!releaseTag) releaseTag = HEDERA_PLATFORM_VERSION;

if (!fs.existsSync(destPath)) {
throw new IllegalArgumentError(`config destPath does not exist: ${destPath}`, destPath);
Expand Down
6 changes: 4 additions & 2 deletions src/core/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type {IP, NodeAlias, NodeId, PodName} from '../types/aliases.js';
import {GrpcProxyTlsEnums} from './enumerations.js';
import {type ContextClusterStructure} from '../types/config_types.js';
import type {Cluster, Context, Namespace} from './config/remote/types.js';
import {HEDERA_PLATFORM_VERSION} from '../../version.js';

export class Templates {
public static renderNetworkPodName(nodeAlias: NodeAlias): PodName {
Expand Down Expand Up @@ -119,13 +120,14 @@ export class Templates {
return new x509.Name(`CN=${nodeAlias},ST=${state},L=${locality},O=${org},OU=${orgUnit},C=${country}`);
}

public static renderStagingDir(cacheDir: string, releaseTag: string): string {
public static renderStagingDir(cacheDir: string, releaseTagOverride: string): string {
let releaseTag = releaseTagOverride;
if (!cacheDir) {
throw new IllegalArgumentError('cacheDir cannot be empty');
}

if (!releaseTag) {
throw new IllegalArgumentError('releaseTag cannot be empty');
releaseTag = HEDERA_PLATFORM_VERSION;
}

const releasePrefix = this.prepareReleasePrefix(releaseTag);
Expand Down
8 changes: 0 additions & 8 deletions test/unit/core/profile_manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,6 @@ describe('ProfileManager', () => {
);
});

it('should fail when no releaseTag is provided', () => {
const nodeAccountMap = new Map<NodeAlias, string>();
nodeAccountMap.set('node1', '0.0.3');
expect(() => profileManager.prepareConfigTxt('', nodeAccountMap, '', undefined)).to.throw(
'release tag is required',
);
});

it('should fail when destPath does not exist', () => {
const nodeAccountMap = new Map<NodeAlias, string>();
nodeAccountMap.set('node1', '0.0.3');
Expand Down

0 comments on commit e590516

Please sign in to comment.