diff --git a/.github/workflows/comprehensive.yml b/.github/workflows/comprehensive.yml index d5d4d324c..d35d46307 100644 --- a/.github/workflows/comprehensive.yml +++ b/.github/workflows/comprehensive.yml @@ -86,22 +86,21 @@ jobs: echo ------------ lscpu lscpu || true - - name: UPDATE - system deps and install libc6, net-tools, btrfs-progs, zip, unzip, bash, procps + - name: UPDATE - system deps and install libc6, net-tools, btrfs-progs, zip, unzip, bash, procps, curl run: | sudo apt-get update sudo apt-get install libc6 net-tools btrfs-progs zip unzip sudo apt-get install bash sudo apt-get install procps + sudo apt-get install curl - - name: INIT - install docker with compose + - name: INIT - install docker run: | - echo " --------------------------- remove old packages ------------------------------------------------------------------------------------------------------ " sudo apt-get remove docker* containerd* || true - echo " --------------------------- install containerd.io ---------------------------------------------------------------------------------------------------- " - sudo apt-get install containerd.io - echo " --------------------------- install docker.io -------------------------------------------------------------------------------------------------------- " - echo " --------------------------- install docker-compose --------------------------------------------------------------------------------------------------- " - sudo apt-get install docker-compose + curl -fsSL https://get.docker.com -o install-docker.sh + sudo sh install-docker.sh + docker --version + docker-compose --version - name: INIT - reconfigure docker and restart its daemon run: | diff --git a/.github/workflows/container-test.yml b/.github/workflows/container-test.yml index 9b401417d..94fe0ffa9 100644 --- a/.github/workflows/container-test.yml +++ b/.github/workflows/container-test.yml @@ -86,22 +86,21 @@ jobs: echo ------------ lscpu lscpu || true - - name: UPDATE - system deps and install libc6, net-tools, btrfs-progs, zip, unzip, bash, procps + - name: UPDATE - system deps and install libc6, net-tools, btrfs-progs, zip, unzip, bash, procps, curl run: | sudo apt-get update sudo apt-get install libc6 net-tools btrfs-progs zip unzip sudo apt-get install bash sudo apt-get install procps + sudo apt-get install curl - - name: INIT - install docker with compose + - name: INIT - install docker run: | - echo " --------------------------- remove old packages ------------------------------------------------------------------------------------------------------ " sudo apt-get remove docker* containerd* || true - echo " --------------------------- install containerd.io ---------------------------------------------------------------------------------------------------- " - sudo apt-get install containerd.io - echo " --------------------------- install docker.io -------------------------------------------------------------------------------------------------------- " - echo " --------------------------- install docker-compose --------------------------------------------------------------------------------------------------- " - sudo apt-get install docker-compose + curl -fsSL https://get.docker.com -o install-docker.sh + sudo sh install-docker.sh + docker --version + docker-compose --version - name: INIT - reconfigure docker and restart its daemon run: | diff --git a/agent/loop.mjs b/agent/loop.mjs index 957d28337..0aaeaacef 100644 --- a/agent/loop.mjs +++ b/agent/loop.mjs @@ -408,6 +408,14 @@ async function singleTransferLoopPartS2S( optsLoop, strLogPrefix ) { return b3; } +function printLoopPartSkippedWarning( strLoopPartName ) { + if( log.verboseGet() >= log.verboseReversed().warning ) { + log.write( strLogPrefix + cc.warning( "Skipped " ) + cc.notice( strLoopPartName ) + + cc.warning( " transfer loop part due to other single " + + "transfer loop is in progress right now" ) + "\n" ); + } +} + export async function singleTransferLoop( optsLoop ) { const imaState = state.get(); const strLogPrefix = cc.attention( "Single Loop in " ) + @@ -415,32 +423,58 @@ export async function singleTransferLoop( optsLoop ) { try { if( log.verboseGet() >= log.verboseReversed().debug ) log.write( strLogPrefix + cc.debug( imaHelperAPIs.longSeparator ) + "\n" ); - if( ( optsLoop.enableStepOracle && imaState.loopState.oracle.isInProgress ) || - ( optsLoop.enableStepM2S && imaState.loopState.m2s.isInProgress ) || - ( optsLoop.enableStepS2M && imaState.loopState.s2m.isInProgress ) || - ( optsLoop.enableStepS2S && imaState.loopState.s2s.isInProgress ) - ) { - imaState.loopState.oracle.wasInProgress = false; - imaState.loopState.m2s.wasInProgress = false; - imaState.loopState.s2m.wasInProgress = false; - imaState.loopState.s2s.wasInProgress = false; - if( log.verboseGet() >= log.verboseReversed().warning ) { - log.write( strLogPrefix + cc.warning( "Skipped due to other single " + - "transfer loop is in progress right now" ) + "\n" ); - } - return true; - } - const b0 = await singleTransferLoopPartOracle( optsLoop, strLogPrefix ); - const b1 = await singleTransferLoopPartM2S( optsLoop, strLogPrefix ); - const b2 = await singleTransferLoopPartS2M( optsLoop, strLogPrefix ); - const b3 = await singleTransferLoopPartS2S( optsLoop, strLogPrefix ); + let b0 = false, b1 = false, b2 = false, b3 = false; + // Oracle loop part: + if( optsLoop.enableStepOracle ) { + if( imaState.loopState.oracle.isInProgress ) { + imaState.loopState.oracle.wasInProgress = false; + printLoopPartSkippedWarning( "Oracle" ); + b0 = true; + } else + b0 = await singleTransferLoopPartOracle( optsLoop, strLogPrefix ); + } else + b0 = true; + // M2S loop part: + if( optsLoop.enableStepM2S ) { + if( imaState.loopState.m2s.isInProgress ) { + imaState.loopState.m2s.wasInProgress = false; + printLoopPartSkippedWarning( "M2S" ); + b1 = true; + } else + b1 = await singleTransferLoopPartM2S( optsLoop, strLogPrefix ); + } else + b1 = true; + // S2M loop part: + if( optsLoop.enableStepS2M ) { + if( imaState.loopState.s2m.isInProgress ) { + imaState.loopState.s2m.wasInProgress = false; + printLoopPartSkippedWarning( "S2M" ); + b2 = true; + } else + b2 = await singleTransferLoopPartS2M( optsLoop, strLogPrefix ); + } else + b2 = true; + // S2S loop part: + if( optsLoop.enableStepS2S ) { + if( imaState.loopState.s2s.isInProgress ) { + imaState.loopState.s2s.wasInProgress = false; + printLoopPartSkippedWarning( "S2S" ); + b3 = true; + } else + b3 = await singleTransferLoopPartS2S( optsLoop, strLogPrefix ); + } else + b3 = true; + // Final status check loop part: const bResult = b0 && b1 && b2 && b3; - if( log.verboseGet() >= log.verboseReversed().notice ) - log.write( strLogPrefix + cc.debug( "Completed: " ) + cc.tf( bResult ) + "\n" ); + if( log.verboseGet() >= log.verboseReversed().notice ) { + log.write( strLogPrefix + + cc.debug( "Final completion status for all performed transfer loop parts is " ) + + cc.tf( bResult ) + "\n" ); + } return bResult; } catch ( err ) { if( log.verboseGet() >= log.verboseReversed().error ) { - log.write( strLogPrefix + cc.fatal( "Exception in single transfer loop: " ) + + log.write( strLogPrefix + cc.fatal( "Exception in transfer loop: " ) + cc.warning( owaspUtils.extractErrorMessage( err ) ) + cc.error( ", stack is: " ) + "\n" + cc.stack( err.stack ) + "\n" ); }