@@ -62,46 +62,71 @@ jobs:
62
62
id : run-install
63
63
continue-on-error : true
64
64
run : |
65
- set +e
66
- #run for each files in /ct
67
- for FILE in ${{ env.ALL_FILES }}; do
68
- STRIPPED_NAME=$(basename "$FILE" | sed 's/-install//' | sed 's/\.sh$//')
69
- echo "Running Test for: $STRIPPED_NAME"
70
- if [[ $FILE =~ ^install/.*-install\.sh$ ]]; then
71
- CT_SCRIPT="ct/$STRIPPED_NAME.sh"
72
- echo $CT_SCRIPT
73
- if [[ ! -f $CT_SCRIPT ]]; then
74
- echo "No CT script found for $STRIPPED_NAME"
75
- ERROR_MSG="No CT script found for $FILE"
76
- RUN=false
65
+ set +e
66
+ #run for each files in /ct
67
+ for FILE in ${{ env.ALL_FILES }}; do
68
+ STRIPPED_NAME=$(basename "$FILE" | sed 's/-install//' | sed 's/\.sh$//')
69
+ echo "Running Test for: $STRIPPED_NAME"
70
+ if grep -E -q 'read\s+-r\s+-p\s+".*"\s+\w+' "$FILE"; then
71
+ echo "The script contains an interactive prompt. Skipping execution."
72
+ continue
77
73
fi
78
- echo "Found CT script for $STRIPPED_NAME"
79
- chmod +x "$CT_SCRIPT"
80
- RUNNING_FILE=$CT_SCRIPT
81
- elif [[ $FILE =~ ^ct/.*\.sh$ ]]; then
82
- INSTALL_SCRIPT="install/$STRIPPED_NAME-install.sh"
83
- if [[ ! -f $INSTALL_SCRIPT ]]; then
84
- echo "No install script found for $STRIPPED_NAME"
85
- ERROR_MSG="No install script found for $FILE"
86
- RUN=false
87
- fi
88
- echo "Found install script for $STRIPPED_NAME"
89
- chmod +x "$INSTALL_SCRIPT"
90
- RUNNING_FILE=$FILE
91
- fi
92
- if [[ $RUN != "false" ]]; then
74
+ if [[ $FILE =~ ^install/.*-install\.sh$ ]]; then
75
+ CT_SCRIPT="ct/$STRIPPED_NAME.sh"
76
+ if [[ ! -f $CT_SCRIPT ]]; then
77
+ echo "No CT script found for $STRIPPED_NAME"
78
+ ERROR_MSG="No CT script found for $FILE"
79
+ echo "$ERROR_MSG" > result_$STRIPPED_NAME.log
80
+ continue
81
+ fi
82
+ if grep -E -q 'read\s+-r\s+-p\s+".*"\s+\w+' "install/$STRIPPED_NAME-install.sh"; then
83
+ echo "The script contains an interactive prompt. Skipping execution."
84
+ continue
85
+ fi
86
+ echo "Found CT script for $STRIPPED_NAME"
87
+ chmod +x "$CT_SCRIPT"
88
+ RUNNING_FILE=$CT_SCRIPT
89
+ elif [[ $FILE =~ ^ct/.*\.sh$ ]]; then
90
+ INSTALL_SCRIPT="install/$STRIPPED_NAME-install.sh"
91
+ if [[ ! -f $INSTALL_SCRIPT ]]; then
92
+ echo "No install script found for $STRIPPED_NAME"
93
+ ERROR_MSG="No install script found for $FILE"
94
+ echo "$ERROR_MSG" > result_$STRIPPED_NAME.log
95
+ continue
96
+ fi
97
+ echo "Found install script for $STRIPPED_NAME"
98
+ chmod +x "$INSTALL_SCRIPT"
99
+ RUNNING_FILE=$FILE
100
+ if grep -E -q 'read\s+-r\s+-p\s+".*"\s+\w+' "ct/$STRIPPED_NAME.sh"; then
101
+ echo "The script contains an interactive prompt. Skipping execution."
102
+ continue
103
+ fi
104
+ fi
105
+ git remote add community-scripts https://github.com/community-scripts/ProxmoxVE.git
106
+ git fetch community-scripts
107
+ rm -f .github/workflows/scripts/app-test/pr-build.func || true
108
+ rm -f .github/workflows/scripts/app-test/pr-install.func || true
109
+ rm -f .github/workflows/scripts/app-test/pr-alpine-install.func || true
110
+ rm -f .github/workflows/scripts/app-test/pr-create-lxc.sh || true
111
+ git checkout community-scripts/main -- .github/workflows/scripts/app-test/pr-build.func
112
+ git checkout community-scripts/main -- .github/workflows/scripts/app-test/pr-install.func
113
+ git checkout community-scripts/main -- .github/workflows/scripts/app-test/pr-alpine-install.func
114
+ git checkout community-scripts/main -- .github/workflows/scripts/app-test/pr-create-lxc.sh
93
115
chmod +x $RUNNING_FILE
94
- sed -i 's|source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)|source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/.github/workflows/scripts/app-test/pr-build.func)|g' "$RUNNING_FILE"
116
+ chmod +x .github/workflows/scripts/app-test/pr-create-lxc.sh
117
+ chmod +x .github/workflows/scripts/app-test/pr-install.func
118
+ chmod +x .github/workflows/scripts/app-test/pr-alpine-install.func
119
+ chmod +x .github/workflows/scripts/app-test/pr-build.func
120
+ sed -i 's|source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)|source .github/workflows/scripts/app-test/pr-build.func|g' "$RUNNING_FILE"
95
121
echo "Executing $RUNNING_FILE"
96
122
ERROR_MSG=$(./$RUNNING_FILE 2>&1 > /dev/null)
97
123
echo "Finished running $FILE"
98
- fi
99
- if [ -n "$ERROR_MSG" ]; then
100
- echo "ERROR in $STRIPPED_NAME: $ERROR_MSG"
101
- echo "$ERROR_MSG" > result_$STRIPPED_NAME.log
102
- fi
103
- done
104
- set -e # Restore exit-on-error
124
+ if [ -n "$ERROR_MSG" ]; then
125
+ echo "ERROR in $STRIPPED_NAME: $ERROR_MSG"
126
+ echo "$ERROR_MSG" > result_$STRIPPED_NAME.log
127
+ fi
128
+ done
129
+ set -e # Restore exit-on-error
105
130
106
131
- name : Cleanup PVE Node
107
132
run : |
0 commit comments