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

Added support for NO_ANSI_COLORS=1 for github actions #92

Merged
merged 30 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7765a4a
Minor changes - update log format, add mainnet url check at startup
dmytrotkk Jan 30, 2024
bfe641c
Merge branch 'develop' of github.com:skalenetwork/ima-agent into upda…
dmytrotkk Jan 30, 2024
7938364
Update error handling in the main loop - replace console.error with l…
dmytrotkk Jan 30, 2024
8d8b83d
Merge pull request #71 from skalenetwork/update-logger-snb
dmytrotkk Jan 30, 2024
a148258
Added reference to latest IMA
sergiy-skalelabs Jan 31, 2024
313e79e
ticket-910 Hide sensitive data in agent log after start
sergiy-skalelabs Jan 31, 2024
fb7d71a
ticket-910 Hide sensitive data in agent log after start
sergiy-skalelabs Feb 1, 2024
48a7462
Merge pull request #79 from skalenetwork/ticket-910-hide-sensitive-da…
sergiy-skalelabs Feb 1, 2024
d34f9a9
ticket-1672 Fixed exception duping POW-mining
sergiy-skalelabs Feb 2, 2024
c6919a2
rollback un-needed changes in yml
sergiy-skalelabs Feb 2, 2024
c36b3b1
Merge remote-tracking branch 'origin/develop' into ticket-1672-except…
sergiy-skalelabs Feb 2, 2024
9a9a9d3
ticket-72 handle IMA-2-IMA http connection errors in express-based code
sergiy-skalelabs Feb 5, 2024
7a8b166
Merge pull request #82 from skalenetwork/ticket-1672-exception-duping…
DmytroNazarenko Feb 6, 2024
9f5770e
Date/time timestamp formatting fix
sergiy-skalelabs Feb 6, 2024
4f7966d
ticket-86 fixed timestamp formatting in logs
sergiy-skalelabs Feb 6, 2024
e1cd9fb
Merge pull request #87 from skalenetwork/ticket-85-fix-timestamp-format
sergiy-skalelabs Feb 7, 2024
42a4ee2
in-docker process exit logging
sergiy-skalelabs Feb 7, 2024
2d8ce1d
Merge remote-tracking branch 'origin/develop' into ticket-72-handle-i…
sergiy-skalelabs Feb 7, 2024
97ac69f
IMA docker container child process tracking improvements
sergiy-skalelabs Feb 7, 2024
c03188a
Update CODEOWNERS
DmytroNazarenko Feb 7, 2024
989ed90
Merge pull request #88 from skalenetwork/codeowners-update
DmytroNazarenko Feb 7, 2024
1ae0ff1
Update check URL function
dmytrotkk Feb 7, 2024
04ad70e
Merge branch 'develop' of github.com:skalenetwork/ima-agent into upda…
dmytrotkk Feb 7, 2024
8ce465e
Merge pull request #89 from skalenetwork/update-check-url-func
dmytrotkk Feb 8, 2024
505a23f
Auto restart each 1 hour
sergiy-skalelabs Feb 8, 2024
1538b4b
Merge pull request #83 from skalenetwork/ticket-72-handle-ima-2-ima-n…
sergiy-skalelabs Feb 8, 2024
071f095
Merge pull request #90 from skalenetwork/ticket-84-auto-restart-1hour
sergiy-skalelabs Feb 8, 2024
51b652d
Added support for NO_ANSI_COLORS=1 environment variable to suppress A…
sergiy-skalelabs Feb 9, 2024
8125dc2
Added support for NO_ANSI_COLORS=1 environment variable to suppress A…
sergiy-skalelabs Feb 9, 2024
e409c46
Merge remote-tracking branch 'origin/develop' into enhancement-NO_ANS…
sergiy-skalelabs Feb 9, 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
10 changes: 9 additions & 1 deletion .github/workflows/comprehensive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
cd cli-hh
export PATH=$PATH:$(dirname $(which npx))
yarn install
export NO_ANSI_COLORS=1
./clean.sh || true
./init.sh

Expand Down Expand Up @@ -134,14 +135,15 @@ jobs:
cd comprehensive-test
export DETECTED_UBUNTU_VERSION=$(lsb_release -r | cut -f2)
export TRYING_SKALED_AT_PATH=./app_cache/bin_$DETECTED_UBUNTU_VERSION/skaled
$TRYING_SKALED_AT_PATH --colors --version
$TRYING_SKALED_AT_PATH --version
$TRYING_SKALED_AT_PATH --help

- name: INIT - generate configuration files for S-Chain nodes
working-directory: ${{env.working-directory}}
run: |
export PATH=$PATH:$(dirname $(which npx))
cd comprehensive-test/s_chain_gen
export NO_ANSI_COLORS=1
./init.sh

- name: INIT - download Skale Manager
Expand Down Expand Up @@ -211,6 +213,7 @@ jobs:
working-directory: ${{env.working-directory}}
run: |
cd comprehensive-test/engine/create_pems
export NO_ANSI_COLORS=1
./create_pems.sh

- name: RUN - full test - everything up and running
Expand All @@ -225,6 +228,7 @@ jobs:
export PATH=$PATH:$(dirname $(which npx))
export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=0
export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=0
export NO_ANSI_COLORS=1
node ./index.js

- name: RUN - full test - one SKALED is down
Expand All @@ -239,6 +243,7 @@ jobs:
export PATH=$PATH:$(dirname $(which npx))
export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=1
export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=0
export NO_ANSI_COLORS=1
node ./index.js

- name: RUN - full test - one IMA Agent is down
Expand All @@ -253,6 +258,7 @@ jobs:
export PATH=$PATH:$(dirname $(which npx))
export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=0
export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=1
export NO_ANSI_COLORS=1
node ./index.js

- name: RUN - full test - one SKALED and one IMA Agent are down
Expand All @@ -267,6 +273,7 @@ jobs:
export PATH=$PATH:$(dirname $(which npx))
export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=1
export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=1
export NO_ANSI_COLORS=1
node ./index.js

- name: RUN - full test - Main Net connectivity problems testing
Expand All @@ -281,6 +288,7 @@ jobs:
export PATH=$PATH:$(dirname $(which npx))
export ENABLED_IMA_MAIN_NET_TUNNELLING=true
export ENABLED_IMA_MAIN_NET_CONNECTION_PROBLEMS=true
export NO_ANSI_COLORS=1
node ./index.js

- name: SHUTDOWN - stop SGX Wallet
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/container-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ jobs:
pwd
export PATH=$PATH:$(dirname $(which npx))
cd cli-hh
export NO_ANSI_COLORS=1
./clean.sh
./init.sh

Expand Down Expand Up @@ -148,7 +149,7 @@ jobs:
cd comprehensive-test
export DETECTED_UBUNTU_VERSION=$(lsb_release -r | cut -f2)
export TRYING_SKALED_AT_PATH=./app_cache/bin_$DETECTED_UBUNTU_VERSION/skaled
$TRYING_SKALED_AT_PATH --colors --version
$TRYING_SKALED_AT_PATH --version
$TRYING_SKALED_AT_PATH --help

- name: INIT - generate configuration files for S-Chain nodes
Expand All @@ -157,6 +158,7 @@ jobs:
export PATH=$PATH:$(dirname $(which npx))
cd comprehensive-test/s_chain_gen
yarn install
export NO_ANSI_COLORS=1
./clean.sh || true
./init.sh

Expand Down Expand Up @@ -282,6 +284,7 @@ jobs:
sudo rm -rf ./client.key || true
sudo rm -rf ./client.pem || true
sudo rm -rf ./client.crt || true
export NO_ANSI_COLORS=1
./create_pems.sh

- name: RUN - full test - everything up and running
Expand All @@ -292,7 +295,6 @@ jobs:
cd comprehensive-test/engine
export ALL_SKALE_TEST_CLOUD_RUN=1
export DISABLE_S2S_TESTS=1
#
export VERSION=13.13.13-test.13
echo "Docker image(will run) version is:" $VERSION
export NAME=ima
Expand All @@ -301,11 +303,11 @@ jobs:
export IMAGE_NAME=$REPO_NAME:$VERSION
export LATEST_IMAGE_NAME=$REPO_NAME:latest
echo "Docker image(will run) name for IMA Agent is:" $IMAGE_NAME
#
export SEPARATED_IMA_AGENT_MODE=1
export PATH=$PATH:$(dirname $(which npx))
export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=0
export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=0
export NO_ANSI_COLORS=1
node ./index.js

- name: RUN - full test - one SKALED is down
Expand All @@ -316,7 +318,6 @@ jobs:
cd comprehensive-test/engine
export ALL_SKALE_TEST_CLOUD_RUN=1
export DISABLE_S2S_TESTS=1
#
export VERSION=13.13.13-test.13
echo "Docker image(will run) version is:" $VERSION
export NAME=ima
Expand All @@ -325,11 +326,11 @@ jobs:
export IMAGE_NAME=$REPO_NAME:$VERSION
export LATEST_IMAGE_NAME=$REPO_NAME:latest
echo "Docker image(will run) name for IMA Agent is:" $IMAGE_NAME
#
export SEPARATED_IMA_AGENT_MODE=1
export PATH=$PATH:$(dirname $(which npx))
export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=1
export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=0
export NO_ANSI_COLORS=1
node ./index.js

- name: RUN - full test - one IMA Agent is down
Expand All @@ -340,7 +341,6 @@ jobs:
cd comprehensive-test/engine
export ALL_SKALE_TEST_CLOUD_RUN=1
export DISABLE_S2S_TESTS=1
#
export VERSION=13.13.13-test.13
echo "Docker image(will run) version is:" $VERSION
export NAME=ima
Expand All @@ -349,11 +349,11 @@ jobs:
export IMAGE_NAME=$REPO_NAME:$VERSION
export LATEST_IMAGE_NAME=$REPO_NAME:latest
echo "Docker image(will run) name for IMA Agent is:" $IMAGE_NAME
#
export SEPARATED_IMA_AGENT_MODE=1
export PATH=$PATH:$(dirname $(which npx))
export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=0
export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=1
export NO_ANSI_COLORS=1
node ./index.js

- name: RUN - full test - one SKALED and one IMA Agent are down
Expand All @@ -364,7 +364,6 @@ jobs:
cd comprehensive-test/engine
export ALL_SKALE_TEST_CLOUD_RUN=1
export DISABLE_S2S_TESTS=1
#
export VERSION=13.13.13-test.13
echo "Docker image(will run) version is:" $VERSION
export NAME=ima
Expand All @@ -373,11 +372,11 @@ jobs:
export IMAGE_NAME=$REPO_NAME:$VERSION
export LATEST_IMAGE_NAME=$REPO_NAME:latest
echo "Docker image(will run) name for IMA Agent is:" $IMAGE_NAME
#
export SEPARATED_IMA_AGENT_MODE=1
export PATH=$PATH:$(dirname $(which npx))
export COUNT_OF_SKALED_INSTANCES_TO_SKIP_START=1
export COUNT_OF_IMA_AGENT_INSTANCES_TO_SKIP_START=1
export NO_ANSI_COLORS=1
node ./index.js

- name: RUN - full test - one SKALED and one IMA Agent are down
Expand All @@ -388,7 +387,6 @@ jobs:
cd comprehensive-test/engine
export ALL_SKALE_TEST_CLOUD_RUN=1
export DISABLE_S2S_TESTS=1
#
export VERSION=13.13.13-test.13
echo "Docker image(will run) version is:" $VERSION
export NAME=ima
Expand All @@ -397,11 +395,11 @@ jobs:
export IMAGE_NAME=$REPO_NAME:$VERSION
export LATEST_IMAGE_NAME=$REPO_NAME:latest
echo "Docker image(will run) name for IMA Agent is:" $IMAGE_NAME
#
export SEPARATED_IMA_AGENT_MODE=1
export PATH=$PATH:$(dirname $(which npx))
export ENABLED_IMA_MAIN_NET_TUNNELLING=true
export ENABLED_IMA_MAIN_NET_CONNECTION_PROBLEMS=true
export NO_ANSI_COLORS=1
node ./index.js

- name: SHUTDOWN - stop SGX Wallet
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
- name: Run test (JS part)
working-directory: ./test
run: |
export NO_ANSI_COLORS=1
yarn test

- name: Prepare test (PY part)
Expand All @@ -95,4 +96,5 @@ jobs:
run: |
export URL_W3_ETHEREUM="http://127.0.0.1:8545"
export URL_W3_S_CHAIN="http://127.0.0.1:8545"
export NO_ANSI_COLORS=1
python3 test.py
2 changes: 1 addition & 1 deletion .github/workflows/network-browser-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:

- name: Run network-browser tests
working-directory: network-browser
run: bash run_tests.sh
run: bash run_tests.sh
5 changes: 5 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ jobs:
with:
python-version: 3.8

- name: Ensure deps are latest and build everything
run: |
yarn install
yarn rebuild

- name: Build and publish container
run: |
export BRANCH=${GITHUB_REF##*/}
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
* @sergiy-skalelabs @kladkogex @DmytroNazarenko
* @sergiy-skalelabs @dmytrotkk @DmytroNazarenko
*.md @skalenetwork/docowners
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ COPY package.json package.json

COPY runner runner
COPY src src
COPY src/pow src/build/pow
RUN mkdir IMA
COPY IMA/proxy IMA/proxy
COPY IMA/package.json IMA/package.json
Expand Down
20 changes: 11 additions & 9 deletions network-browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
getMainnetManagerAbi,
getMainnetProvider
} from './src/contracts'
import { delay, pingUrl, withTimeout } from './src/tools'
import { delay, getLoggerConfig, checkEndpoint, withTimeout } from './src/tools'
import { BrowserTimeoutError } from './src/errors'
import { browse } from './src/browser'
import {
Expand All @@ -37,14 +37,12 @@ import {
NETWORK_BROWSER_DELAY,
MULTICALL,
CONNECTED_ONLY,
SCHAIN_RPC_URL,
LOG_LEVEL,
LOG_PRETTY
SCHAIN_RPC_URL
} from './src/constants'

import { Logger, type ILogObj } from 'tslog'

const log = new Logger<ILogObj>({ minLevel: LOG_LEVEL, stylePrettyLogs: LOG_PRETTY })
const log = new Logger<ILogObj>(getLoggerConfig('loop'))

async function safeNetworkBrowserLoop() {
log.info(`Running network-browser...`)
Expand All @@ -55,24 +53,28 @@ async function safeNetworkBrowserLoop() {
log.info(`NETWORK_BROWSER_TIMEOUT: ${NETWORK_BROWSER_TIMEOUT}`)
log.info(`NETWORK_BROWSER_DELAY: ${NETWORK_BROWSER_DELAY}`)

log.info(`Trying to connect to the sChain RPC: ${SCHAIN_RPC_URL}`)
await checkEndpoint(SCHAIN_RPC_URL)
log.info(`Trying to connect to the mainnet RPC`)
await checkEndpoint(MAINNET_RPC_URL)

const provider = await getMainnetProvider(MAINNET_RPC_URL, MULTICALL)
const managerAbi = getMainnetManagerAbi()
const schainsInternal = schainsInternalContract(managerAbi, provider)
const nodes = nodesContract(managerAbi, provider)
log.info(`Trying to connect to the sChain RPC: ${SCHAIN_RPC_URL}`)
await pingUrl(SCHAIN_RPC_URL)

while (true) {
try {
await withTimeout(browse(schainsInternal, nodes), NETWORK_BROWSER_TIMEOUT)
await delay(NETWORK_BROWSER_DELAY)
} catch (error) {
if (error instanceof BrowserTimeoutError) {
console.error(
log.error(
`A timeout (${NETWORK_BROWSER_TIMEOUT} ms) error occurred:`,
error.message
)
} else {
console.error('An error occurred in browse:', error)
log.error('An error occurred in browse:', error)
}
await delay(POST_ERROR_DELAY)
}
Expand Down
6 changes: 3 additions & 3 deletions network-browser/src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import {
filterConnectedHashes
} from './schains'
import { getNodesGroups } from './nodes'
import { CONNECTED_ONLY, IMA_NETWORK_BROWSER_DATA_PATH, LOG_LEVEL, LOG_PRETTY } from './constants'
import { writeJson, currentTimestamp, chainIdInt } from './tools'
import { CONNECTED_ONLY, IMA_NETWORK_BROWSER_DATA_PATH } from './constants'
import { writeJson, currentTimestamp, chainIdInt, getLoggerConfig } from './tools'

const log = new Logger<ILogObj>({ minLevel: LOG_LEVEL, stylePrettyLogs: LOG_PRETTY })
const log = new Logger<ILogObj>(getLoggerConfig('browser'))

export async function browse(schainsInternal: Contract, nodes: Contract): Promise<void> {
log.info('Browse iteration started, collecting chains')
Expand Down
3 changes: 3 additions & 0 deletions network-browser/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ export const NETWORK_BROWSER_TIMEOUT = secondsEnv(process.env.NETWORK_BROWSER_TI

export const LOG_LEVEL = optionalEnvNumber('NETWORK_BROWSER_LOG_LEVEL', 1)
export const LOG_PRETTY = booleanEnv('NETWORK_BROWSER_LOG_PRETTY', false)
export const LOG_FORMAT =
'{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}\t{{logLevelName}}\t{{name}}\t'
export const LOG_PREFIX = 'snb::'
Loading
Loading