Skip to content

Commit 2b049ec

Browse files
committed
increase screenshot timeout
1 parent d448e01 commit 2b049ec

2 files changed

Lines changed: 88 additions & 87 deletions

File tree

Jenkinsfile

Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pipeline {
3333
CI_PORT = '3001'
3434
CI_SSL = 'true'
3535
CI_DELAY = '120'
36+
CI_WEB_SCREENSHOT_DELAY = '30'
3637
CI_DOCKERENV = 'TZ=US/Pacific'
3738
CI_AUTH = 'user:password'
3839
CI_WEBPATH = ''
@@ -75,6 +76,7 @@ pipeline {
7576
'''
7677
script{
7778
env.EXIT_STATUS = ''
79+
env.CI_TEST_ATTEMPTED = ''
7880
env.LS_RELEASE = sh(
7981
script: '''docker run --rm quay.io/skopeo/stable:v1 inspect docker://ghcr.io/${LS_USER}/${CONTAINER_NAME}:arch-i3 2>/dev/null | jq -r '.Labels.build_version' | awk '{print $3}' | grep '\\-ls' || : ''',
8082
returnStdout: true).trim()
@@ -808,6 +810,7 @@ pipeline {
808810
script{
809811
env.CI_URL = 'https://ci-tests.linuxserver.io/' + env.IMAGE + '/' + env.META_TAG + '/index.html'
810812
env.CI_JSON_URL = 'https://ci-tests.linuxserver.io/' + env.IMAGE + '/' + env.META_TAG + '/report.json'
813+
env.CI_TEST_ATTEMPTED = 'true'
811814
}
812815
sh '''#! /bin/bash
813816
set -e
@@ -828,6 +831,7 @@ pipeline {
828831
--shm-size=1gb \
829832
-v /var/run/docker.sock:/var/run/docker.sock \
830833
-e IMAGE=\"${IMAGE}\" \
834+
-e WEB_SCREENSHOT_DELAY=\"${CI_WEB_SCREENSHOT_DELAY}\" \
831835
-e DOCKER_LOGS_TIMEOUT=\"${CI_DELAY}\" \
832836
-e TAGS=\"${CI_TAGS}\" \
833837
-e META_TAG=\"${META_TAG}\" \
@@ -1010,98 +1014,13 @@ EOF
10101014
) '''
10111015
}
10121016
}
1013-
// If this is a Pull request send the CI link as a comment on it
1014-
stage('Pull Request Comment') {
1015-
when {
1016-
not {environment name: 'CHANGE_ID', value: ''}
1017-
environment name: 'EXIT_STATUS', value: ''
1018-
}
1019-
steps {
1020-
sh '''#! /bin/bash
1021-
# Function to retrieve JSON data from URL
1022-
get_json() {
1023-
local url="$1"
1024-
local response=$(curl -s "$url")
1025-
if [ $? -ne 0 ]; then
1026-
echo "Failed to retrieve JSON data from $url"
1027-
return 1
1028-
fi
1029-
local json=$(echo "$response" | jq .)
1030-
if [ $? -ne 0 ]; then
1031-
echo "Failed to parse JSON data from $url"
1032-
return 1
1033-
fi
1034-
echo "$json"
1035-
}
1036-
1037-
build_table() {
1038-
local data="$1"
1039-
1040-
# Get the keys in the JSON data
1041-
local keys=$(echo "$data" | jq -r 'to_entries | map(.key) | .[]')
1042-
1043-
# Check if keys are empty
1044-
if [ -z "$keys" ]; then
1045-
echo "JSON report data does not contain any keys or the report does not exist."
1046-
return 1
1047-
fi
1048-
1049-
# Build table header
1050-
local header="| Tag | Passed |\\n| --- | --- |\\n"
1051-
1052-
# Loop through the JSON data to build the table rows
1053-
local rows=""
1054-
for build in $keys; do
1055-
local status=$(echo "$data" | jq -r ".[\\"$build\\"].test_success")
1056-
if [ "$status" = "true" ]; then
1057-
status="✅"
1058-
else
1059-
status="❌"
1060-
fi
1061-
local row="| "$build" | "$status" |\\n"
1062-
rows="${rows}${row}"
1063-
done
1064-
1065-
local table="${header}${rows}"
1066-
local escaped_table=$(echo "$table" | sed 's/\"/\\\\"/g')
1067-
echo "$escaped_table"
1068-
}
1069-
1070-
if [[ "${CI}" = "true" ]]; then
1071-
# Retrieve JSON data from URL
1072-
data=$(get_json "$CI_JSON_URL")
1073-
# Create table from JSON data
1074-
table=$(build_table "$data")
1075-
echo -e "$table"
1076-
1077-
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
1078-
-H "Accept: application/vnd.github.v3+json" \
1079-
"https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \
1080-
-d "{\\"body\\": \\"I am a bot, here are the test results for this PR: \\n${CI_URL}\\n${SHELLCHECK_URL}\\n${table}\\"}"
1081-
else
1082-
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
1083-
-H "Accept: application/vnd.github.v3+json" \
1084-
"https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \
1085-
-d "{\\"body\\": \\"I am a bot, here is the pushed image/manifest for this PR: \\n\\n\\`${GITHUBIMAGE}:${META_TAG}\\`\\"}"
1086-
fi
1087-
'''
1088-
1089-
}
1090-
}
10911017
}
10921018
/* ######################
1093-
Send status to Discord
1019+
Comment on PR and Send status to Discord
10941020
###################### */
10951021
post {
10961022
always {
1097-
sh '''#!/bin/bash
1098-
rm -rf /config/.ssh/id_sign
1099-
rm -rf /config/.ssh/id_sign.pub
1100-
git config --global --unset gpg.format
1101-
git config --global --unset user.signingkey
1102-
git config --global --unset commit.gpgsign
1103-
'''
1104-
script{
1023+
script {
11051024
env.JOB_DATE = sh(
11061025
script: '''date '+%Y-%m-%dT%H:%M:%S%:z' ''',
11071026
returnStdout: true).trim()
@@ -1144,6 +1063,87 @@ EOF
11441063
"username": "Jenkins"}' ${BUILDS_DISCORD} '''
11451064
}
11461065
}
1066+
script {
1067+
if (env.GITHUBIMAGE =~ /lspipepr/){
1068+
if (env.CI_TEST_ATTEMPTED == "true"){
1069+
sh '''#! /bin/bash
1070+
# Function to retrieve JSON data from URL
1071+
get_json() {
1072+
local url="$1"
1073+
local response=$(curl -s "$url")
1074+
if [ $? -ne 0 ]; then
1075+
echo "Failed to retrieve JSON data from $url"
1076+
return 1
1077+
fi
1078+
local json=$(echo "$response" | jq .)
1079+
if [ $? -ne 0 ]; then
1080+
echo "Failed to parse JSON data from $url"
1081+
return 1
1082+
fi
1083+
echo "$json"
1084+
}
1085+
1086+
build_table() {
1087+
local data="$1"
1088+
1089+
# Get the keys in the JSON data
1090+
local keys=$(echo "$data" | jq -r 'to_entries | map(.key) | .[]')
1091+
1092+
# Check if keys are empty
1093+
if [ -z "$keys" ]; then
1094+
echo "JSON report data does not contain any keys or the report does not exist."
1095+
return 1
1096+
fi
1097+
1098+
# Build table header
1099+
local header="| Tag | Passed |\\n| --- | --- |\\n"
1100+
1101+
# Loop through the JSON data to build the table rows
1102+
local rows=""
1103+
for build in $keys; do
1104+
local status=$(echo "$data" | jq -r ".[\\"$build\\"].test_success")
1105+
if [ "$status" = "true" ]; then
1106+
status="✅"
1107+
else
1108+
status="❌"
1109+
fi
1110+
local row="| "$build" | "$status" |\\n"
1111+
rows="${rows}${row}"
1112+
done
1113+
1114+
local table="${header}${rows}"
1115+
local escaped_table=$(echo "$table" | sed 's/\"/\\\\"/g')
1116+
echo "$escaped_table"
1117+
}
1118+
1119+
if [[ "${CI}" = "true" ]]; then
1120+
# Retrieve JSON data from URL
1121+
data=$(get_json "$CI_JSON_URL")
1122+
# Create table from JSON data
1123+
table=$(build_table "$data")
1124+
echo -e "$table"
1125+
1126+
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
1127+
-H "Accept: application/vnd.github.v3+json" \
1128+
"https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \
1129+
-d "{\\"body\\": \\"I am a bot, here are the test results for this PR: \\n${CI_URL}\\n${SHELLCHECK_URL}\\n${table}\\"}"
1130+
else
1131+
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
1132+
-H "Accept: application/vnd.github.v3+json" \
1133+
"https://api.github.com/repos/$LS_USER/$LS_REPO/issues/$PULL_REQUEST/comments" \
1134+
-d "{\\"body\\": \\"I am a bot, here is the pushed image/manifest for this PR: \\n\\n\\`${GITHUBIMAGE}:${META_TAG}\\`\\"}"
1135+
fi
1136+
'''
1137+
}
1138+
}
1139+
}
1140+
sh '''#!/bin/bash
1141+
rm -rf /config/.ssh/id_sign
1142+
rm -rf /config/.ssh/id_sign.pub
1143+
git config --global --unset gpg.format
1144+
git config --global --unset user.signingkey
1145+
git config --global --unset commit.gpgsign
1146+
'''
11471147
}
11481148
cleanup {
11491149
sh '''#! /bin/bash

jenkins-vars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ repo_vars:
2323
- CI_PORT = '3001'
2424
- CI_SSL = 'true'
2525
- CI_DELAY = '120'
26+
- CI_WEB_SCREENSHOT_DELAY = '30'
2627
- CI_DOCKERENV = 'TZ=US/Pacific'
2728
- CI_AUTH = 'user:password'
2829
- CI_WEBPATH = ''

0 commit comments

Comments
 (0)