adjusting intervals
Some checks failed
Build and Release to Staging / Build Vision Start (push) Successful in 7s
Build and Release / build (push) Successful in 8s
Build and Release to Staging / Build Vision Start Image (push) Successful in 1m2s
Build and Release / virus-total-check (push) Failing after 37s
Build and Release / release (push) Has been skipped
Build and Release / Build Vision Start Image (push) Has been skipped
Build and Release / Deploy Vision Start (production) (push) Has been skipped
Build and Release to Staging / Deploy Vision Start (staging) (push) Successful in 3s
Some checks failed
Build and Release to Staging / Build Vision Start (push) Successful in 7s
Build and Release / build (push) Successful in 8s
Build and Release to Staging / Build Vision Start Image (push) Successful in 1m2s
Build and Release / virus-total-check (push) Failing after 37s
Build and Release / release (push) Has been skipped
Build and Release / Build Vision Start Image (push) Has been skipped
Build and Release / Deploy Vision Start (production) (push) Has been skipped
Build and Release to Staging / Deploy Vision Start (staging) (push) Successful in 3s
This commit is contained in:
@@ -59,8 +59,9 @@ jobs:
|
|||||||
virustotal_apikey: ${{ secrets.VIRUSTOTAL_APIKEY }}
|
virustotal_apikey: ${{ secrets.VIRUSTOTAL_APIKEY }}
|
||||||
VIRUS_TOTAL_FILE: vision-start-${{ gitea.ref_name }}.zip
|
VIRUS_TOTAL_FILE: vision-start-${{ gitea.ref_name }}.zip
|
||||||
run: |
|
run: |
|
||||||
# Run the VirusTotal check script and capture output
|
# Run the VirusTotal check script and capture output in real-time
|
||||||
bash scripts/check_virustotal.sh > vt_output.txt 2>&1
|
set -o pipefail
|
||||||
|
bash scripts/check_virustotal.sh 2>&1 | tee vt_output.txt
|
||||||
|
|
||||||
# Extract analysis URL and detection ratio from output
|
# Extract analysis URL and detection ratio from output
|
||||||
ANALYSIS_URL=$(grep "Analysis URL:" vt_output.txt | cut -d' ' -f3- || echo "Not available")
|
ANALYSIS_URL=$(grep "Analysis URL:" vt_output.txt | cut -d' ' -f3- || echo "Not available")
|
||||||
@@ -70,9 +71,6 @@ jobs:
|
|||||||
echo "analysis-url=$ANALYSIS_URL" >> $GITEA_OUTPUT
|
echo "analysis-url=$ANALYSIS_URL" >> $GITEA_OUTPUT
|
||||||
echo "detection-ratio=$DETECTION_RATIO" >> $GITEA_OUTPUT
|
echo "detection-ratio=$DETECTION_RATIO" >> $GITEA_OUTPUT
|
||||||
|
|
||||||
# Display the full output
|
|
||||||
cat vt_output.txt
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build, virus-total-check]
|
needs: [build, virus-total-check]
|
||||||
|
|||||||
@@ -55,34 +55,34 @@ echo "File uploaded successfully. Scan ID: $SCAN_ID"
|
|||||||
echo "Waiting for analysis to complete..."
|
echo "Waiting for analysis to complete..."
|
||||||
|
|
||||||
# Wait for analysis to complete and get results
|
# Wait for analysis to complete and get results
|
||||||
MAX_ATTEMPTS=30
|
MAX_ATTEMPTS=60
|
||||||
ATTEMPT=0
|
ATTEMPT=0
|
||||||
SLEEP_INTERVAL=10
|
SLEEP_INTERVAL=10
|
||||||
|
|
||||||
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
|
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
|
||||||
echo "Checking analysis status (attempt $((ATTEMPT + 1))/$MAX_ATTEMPTS)..."
|
echo "Checking analysis status (attempt $((ATTEMPT + 1))/$MAX_ATTEMPTS)..."
|
||||||
|
|
||||||
# Get scan report
|
# Get scan report
|
||||||
REPORT_RESPONSE=$(curl -s -X POST \
|
REPORT_RESPONSE=$(curl -s -X POST \
|
||||||
-d "apikey=$API_KEY" \
|
-d "apikey=$API_KEY" \
|
||||||
-d "resource=$SCAN_ID" \
|
-d "resource=$SCAN_ID" \
|
||||||
"$BASE_URL/file/report")
|
"$BASE_URL/file/report")
|
||||||
|
|
||||||
# Check if analysis is complete
|
# Check if analysis is complete
|
||||||
RESPONSE_CODE=$(echo "$REPORT_RESPONSE" | jq -r '.response_code')
|
RESPONSE_CODE=$(echo "$REPORT_RESPONSE" | jq -r '.response_code')
|
||||||
|
|
||||||
if [ "$RESPONSE_CODE" == "1" ]; then
|
if [ "$RESPONSE_CODE" == "1" ]; then
|
||||||
# Analysis complete
|
# Analysis complete
|
||||||
echo "Analysis completed!"
|
echo "Analysis completed!"
|
||||||
|
|
||||||
# Extract results
|
# Extract results
|
||||||
POSITIVES=$(echo "$REPORT_RESPONSE" | jq -r '.positives')
|
POSITIVES=$(echo "$REPORT_RESPONSE" | jq -r '.positives')
|
||||||
TOTAL=$(echo "$REPORT_RESPONSE" | jq -r '.total')
|
TOTAL=$(echo "$REPORT_RESPONSE" | jq -r '.total')
|
||||||
PERMALINK=$(echo "$REPORT_RESPONSE" | jq -r '.permalink')
|
PERMALINK=$(echo "$REPORT_RESPONSE" | jq -r '.permalink')
|
||||||
|
|
||||||
echo "Analysis URL: $PERMALINK"
|
echo "Analysis URL: $PERMALINK"
|
||||||
echo "Detection ratio: $POSITIVES/$TOTAL"
|
echo "Detection ratio: $POSITIVES/$TOTAL"
|
||||||
|
|
||||||
# Check if file is safe
|
# Check if file is safe
|
||||||
if [ "$POSITIVES" -eq 0 ]; then
|
if [ "$POSITIVES" -eq 0 ]; then
|
||||||
echo "✅ File is clean (no threats detected)"
|
echo "✅ File is clean (no threats detected)"
|
||||||
@@ -102,7 +102,7 @@ while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
|
|||||||
echo "Response: $REPORT_RESPONSE"
|
echo "Response: $REPORT_RESPONSE"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ATTEMPT=$((ATTEMPT + 1))
|
ATTEMPT=$((ATTEMPT + 1))
|
||||||
if [ $ATTEMPT -lt $MAX_ATTEMPTS ]; then
|
if [ $ATTEMPT -lt $MAX_ATTEMPTS ]; then
|
||||||
sleep $SLEEP_INTERVAL
|
sleep $SLEEP_INTERVAL
|
||||||
|
|||||||
Reference in New Issue
Block a user