@suffolklitlab/alkiln 5.12.0 → 5.13.0-logs2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +29 -0
- package/.github/workflows/github_server.yml +59 -12
- package/.github/workflows/playground.yml +11 -4
- package/CHANGELOG.md +41 -1
- package/CONTRIBUTING.md +98 -83
- package/README.md +1 -1
- package/action.yml +69 -29
- package/action_for_github_server/action.yml +65 -31
- package/docs/decisions/006_which_log_level_to_pick_2024_09_5.md +46 -0
- package/docs/decisions/adopt_architectural_decision_records.md +58 -0
- package/docs/decisions/detect_sign_in.md +124 -0
- package/docs/decisions/pdfjs_version_2024_08_08.md +18 -0
- package/docs/decisions/reports_and_logs_2024_08_11.md +141 -0
- package/docs/decisions/update_puppeteer_2024_07_28.md +62 -0
- package/docs/story_tables.md +1 -1
- package/lib/docassemble/docassemble_api_REST.js +67 -1
- package/lib/docassemble/docassemble_api_interface.js +225 -18
- package/lib/docassemble/server_install.js +23 -9
- package/lib/docassemble/setup.js +33 -20
- package/lib/docassemble/takedown.js +27 -7
- package/lib/run_cucumber.js +83 -33
- package/lib/scope.js +222 -82
- package/lib/steps.js +206 -62
- package/lib/utils/files.js +8 -6
- package/lib/utils/log.js +477 -84
- package/lib/utils/reports.js +14 -5
- package/lib/utils/session_vars.js +25 -18
- package/lib/utils/time.js +44 -0
- package/npm-shrinkwrap.json +635 -193
- package/package.json +8 -8
- package/setup.py +1 -1
- package/tests/log_codes/check_codes.sh +163 -108
- package/tests/log_codes/log_code_expected_instances.txt +213 -0
- package/tests/unit_tests/getAllFields.test.js +5 -0
- package/tests/unit_tests/getMatchingRows.test.js +5 -0
- package/tests/unit_tests/log.test.js +20 -0
- package/tests/unit_tests/normalizeTable.test.js +5 -0
- package/tests/log_codes/deleted_codes.json +0 -8
package/action.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: "ALKiln: Automated docassemble tests"
|
|
2
|
-
description: "Automatically test any docassemble interview in a any branch on your GitHub repository whenever you commit or push. See https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/
|
|
2
|
+
description: "Automatically test any docassemble interview in a any branch on your GitHub repository whenever you commit or push. See https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/alkiln/setup/#types."
|
|
3
3
|
|
|
4
4
|
inputs:
|
|
5
5
|
SERVER_URL:
|
|
@@ -41,6 +41,9 @@ outputs:
|
|
|
41
41
|
PATH_TO_REPORT_FILE:
|
|
42
42
|
description: 'An empty string ("") or the path to report.txt. Remember to check for the existence of the file before using it.'
|
|
43
43
|
value: ${{ steps.alkiln_outputs.outputs.PATH_TO_REPORT_FILE }}
|
|
44
|
+
PATH_TO_REPORT_LOG_FILE:
|
|
45
|
+
description: 'An empty string ("") or the path to report_log.txt. Remember to check for the existence of the file before using it.'
|
|
46
|
+
value: ${{ steps.alkiln_outputs.outputs.PATH_TO_REPORT_LOG_FILE }}
|
|
44
47
|
PATH_TO_UNEXPECTED_RESULTS_FILE:
|
|
45
48
|
description: 'An empty string ("") or the path to unexpected_results.txt. Remember to check for the existence of the file before using it.'
|
|
46
49
|
value: ${{ steps.alkiln_outputs.outputs.PATH_TO_UNEXPECTED_RESULTS_FILE }}
|
|
@@ -67,9 +70,18 @@ runs:
|
|
|
67
70
|
DOCASSEMBLECLI_VERSION: ${{ inputs.DOCASSEMBLECLI_VERSION }}
|
|
68
71
|
shell: bash
|
|
69
72
|
run: |
|
|
70
|
-
|
|
73
|
+
log="💡 ALK0023 INFO: Set environment variables"
|
|
74
|
+
|
|
71
75
|
# Human-readable date/time: https://www.shell-tips.com/linux/how-to-format-date-and-time-in-linux-macos-and-bash/#how-to-format-a-date-in-bash
|
|
72
|
-
|
|
76
|
+
timestamp="$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)"
|
|
77
|
+
artifact_folder="alkiln-${timestamp}UTC"
|
|
78
|
+
echo "ARTIFACT_FOLDER=$artifact_folder" >> $GITHUB_ENV
|
|
79
|
+
debug_path="${artifact_folder}/debug_log.txt"
|
|
80
|
+
echo "DEBUG_PATH=$debug_path" >> $GITHUB_ENV
|
|
81
|
+
|
|
82
|
+
mkdir -p "$artifact_path"
|
|
83
|
+
echo "$log" >> "$debug_path"
|
|
84
|
+
|
|
73
85
|
echo "REPO_URL=${{ github.server_url }}/${{ github.repository }}" >> $GITHUB_ENV
|
|
74
86
|
echo "BRANCH_PATH=$BRANCH_PATH" >> $GITHUB_ENV
|
|
75
87
|
# Workflow inputs
|
|
@@ -84,18 +96,21 @@ runs:
|
|
|
84
96
|
- name: "💡 ALK0024 INFO: Confirm environment variables"
|
|
85
97
|
shell: bash
|
|
86
98
|
run: |
|
|
87
|
-
|
|
88
|
-
echo -e "\
|
|
99
|
+
log="💡 ALK0024 INFO: Confirm environment variables"
|
|
100
|
+
echo -e "\n$log" >> "$DEBUG_PATH"
|
|
101
|
+
vars_log="\nALKiln version is $ALKILN_VERSION\nRepo is $REPO_URL\nBranch ref is $BRANCH_PATH\nMAX_SECONDS_FOR_SETUP is $MAX_SECONDS_FOR_SETUP\nSERVER_RELOAD_TIMEOUT_SECONDS is $SERVER_RELOAD_TIMEOUT_SECONDS\n"
|
|
102
|
+
echo -e "$vars_log" >> "$DEBUG_PATH" && echo -e "$vars_log"
|
|
89
103
|
|
|
90
104
|
# Install
|
|
91
|
-
- name: "💡 ALK0025 INFO:
|
|
105
|
+
- name: "💡 ALK0025 INFO: Set up node"
|
|
92
106
|
uses: actions/setup-node@v4
|
|
93
107
|
with:
|
|
94
108
|
node-version: "18"
|
|
95
109
|
- name: "💡 ALK0026 INFO: Install ALKiln directly from npm"
|
|
96
110
|
shell: bash
|
|
97
111
|
run: |
|
|
98
|
-
|
|
112
|
+
log="💡 ALK0026 INFO: Install ALKiln directly from npm"
|
|
113
|
+
echo -e "\n$log" >> "$DEBUG_PATH"
|
|
99
114
|
npm install -g "@suffolklitlab/alkiln@$ALKILN_VERSION"
|
|
100
115
|
|
|
101
116
|
# Install on playground
|
|
@@ -109,26 +124,32 @@ runs:
|
|
|
109
124
|
if: ${{ inputs.INSTALL_METHOD == 'playground' }}
|
|
110
125
|
shell: bash
|
|
111
126
|
run: |
|
|
112
|
-
|
|
127
|
+
log="💡 ALK0027 INFO: Create a Project and install the package from GitHub"
|
|
128
|
+
echo -e "\n$log" >> "$DEBUG_PATH"
|
|
113
129
|
pip install "docassemblecli==$DOCASSEMBLECLI_VERSION"
|
|
114
|
-
alkiln-setup
|
|
115
|
-
- name: "
|
|
130
|
+
alkiln-setup --path="$ARTIFACT_FOLDER"
|
|
131
|
+
- name: "🤕 ALK0028 ERROR: Unable to create a Project"
|
|
116
132
|
if: ${{ inputs.INSTALL_METHOD == 'playground' && failure() }}
|
|
117
133
|
shell: bash
|
|
118
134
|
run: |
|
|
119
|
-
#
|
|
120
|
-
|
|
135
|
+
# "🤕 ALK0028 ERROR: Unable to create a Project"
|
|
136
|
+
long_log="\n\n―――\n🤕 ALK0028 ERROR: Unable to create a Project on your server's testing account or pull your package into it. Check the messages above this line.\n\n"
|
|
137
|
+
echo -e "$long_log" >> "$DEBUG_PATH" && echo -e "$long_log"
|
|
121
138
|
|
|
122
139
|
# Server installations - find folders and save session vars
|
|
123
140
|
- name: "💡 ALK0029 INFO: Install the GitHub package onto the server"
|
|
124
141
|
if: ${{ inputs.INSTALL_METHOD == 'server' }}
|
|
125
142
|
shell: bash
|
|
126
|
-
run:
|
|
127
|
-
|
|
143
|
+
run: |
|
|
144
|
+
log="💡 ALK0029 INFO: Install the GitHub package onto the server"
|
|
145
|
+
echo -e "\n$log" >> "$DEBUG_PATH"
|
|
146
|
+
alkiln-server-install --path="$ARTIFACT_FOLDER"
|
|
147
|
+
- name: "🤕 ALK0030 ERROR: Unable to install the package"
|
|
128
148
|
if: ${{ inputs.INSTALL_METHOD == 'server' && failure() }}
|
|
129
149
|
shell: bash
|
|
130
150
|
run: |
|
|
131
|
-
|
|
151
|
+
log="\n\n―――\n🤕 ALK0030 ERROR: Unable to install the package on the temporary GitHub docassemble server. Check the steps above this line.\n\n"
|
|
152
|
+
echo -e "$log" >> "$DEBUG_PATH" && echo -e "$log"
|
|
132
153
|
|
|
133
154
|
# run tests
|
|
134
155
|
- name: "💡 ALK0031 INFO: Run tests"
|
|
@@ -136,20 +157,26 @@ runs:
|
|
|
136
157
|
env:
|
|
137
158
|
ALKILN_TAG_EXPRESSION: ${{ inputs.ALKILN_TAG_EXPRESSION || github.event.inputs.tags && format('{0}', github.event.inputs.tags) }}
|
|
138
159
|
shell: bash
|
|
139
|
-
run:
|
|
160
|
+
run: |
|
|
161
|
+
log="💡 ALK0031 INFO: Run tests"
|
|
162
|
+
echo -e "\n$log" >> "$DEBUG_PATH"
|
|
163
|
+
alkiln-run "$ALKILN_TAG_EXPRESSION" --path="$ARTIFACT_FOLDER"
|
|
140
164
|
|
|
141
165
|
# on playground, delete project
|
|
142
166
|
- name: "💡 ALK0032 INFO: Delete the Project from the Playground"
|
|
143
167
|
if: ${{ always() && inputs.INSTALL_METHOD == 'playground' }}
|
|
144
|
-
run: alkiln-takedown
|
|
145
168
|
shell: bash
|
|
169
|
+
run: |
|
|
170
|
+
log="💡 ALK0032 INFO: Delete the Project from the Playground"
|
|
171
|
+
echo -e "\n$log" >> "$DEBUG_PATH"
|
|
172
|
+
alkiln-takedown --path="$ARTIFACT_FOLDER"
|
|
146
173
|
|
|
147
174
|
# Upload artifacts that subscribers can download on the Actions summary page
|
|
148
175
|
- name: "💡 ALK0033 INFO: Upload artifacts folder"
|
|
149
176
|
if: ${{ always() }}
|
|
150
177
|
uses: actions/upload-artifact@v4
|
|
151
178
|
with:
|
|
152
|
-
name: ${{ env.
|
|
179
|
+
name: ${{ env.ARTIFACT_FOLDER }}
|
|
153
180
|
path: ./alkiln-*
|
|
154
181
|
|
|
155
182
|
# Download artifacts folder internally to create action output
|
|
@@ -157,45 +184,56 @@ runs:
|
|
|
157
184
|
if: ${{ always() }}
|
|
158
185
|
uses: actions/download-artifact@v4
|
|
159
186
|
with:
|
|
160
|
-
name: ${{ env.
|
|
187
|
+
name: ${{ env.ARTIFACT_FOLDER }}
|
|
161
188
|
|
|
162
189
|
- name: "💡 ALK0184 INFO: Prepare ALKiln output file paths"
|
|
163
190
|
if: ${{ always() }}
|
|
164
191
|
id: alkiln_outputs
|
|
165
192
|
shell: bash
|
|
166
193
|
run: |
|
|
167
|
-
|
|
194
|
+
log="💡 ALK0184 INFO: Prepare ALKiln output file paths"
|
|
195
|
+
echo -e "\n$log" >> "$DEBUG_PATH" && echo "$log"
|
|
168
196
|
|
|
169
197
|
FOLDER=$(ls -d */ | grep -E '^alkiln-*' || true)
|
|
170
198
|
|
|
171
|
-
|
|
199
|
+
log_folder="Test results artifacts folder is $FOLDER"
|
|
200
|
+
echo -e "\n$log_folder" >> "$DEBUG_PATH" && echo "$log_folder"
|
|
172
201
|
|
|
173
202
|
if [[ "$FOLDER" = "" ]]; then
|
|
174
|
-
|
|
203
|
+
log_missing="Artifacts folder is missing. The path is an empty string: '$FOLDER'"
|
|
204
|
+
echo -e "\n$log_missing" >> "$DEBUG_PATH" && echo "$log_missing"
|
|
175
205
|
|
|
176
206
|
else
|
|
177
207
|
REPORT_PATH="${FOLDER}report.txt"
|
|
208
|
+
REPORT_LOG_PATH="${FOLDER}report_log.txt"
|
|
178
209
|
UNEXPECTED_RESULTS_PATH="${FOLDER}unexpected_results.txt"
|
|
179
210
|
DEBUG_LOG_PATH="${FOLDER}debug_log.txt"
|
|
180
211
|
|
|
181
212
|
if [ -f "$REPORT_PATH" ]; then
|
|
182
|
-
echo "$REPORT_PATH exists"
|
|
213
|
+
echo -e "\n$REPORT_PATH exists" >> "$DEBUG_PATH" && echo "$REPORT_PATH exists"
|
|
183
214
|
else
|
|
184
|
-
echo "$REPORT_PATH is missing"
|
|
215
|
+
echo -e "\n$REPORT_PATH is missing" >> "$DEBUG_PATH" && echo "$REPORT_PATH is missing"
|
|
185
216
|
REPORT_PATH=""
|
|
186
217
|
fi
|
|
187
218
|
|
|
219
|
+
if [ -f "$REPORT_LOG_PATH" ]; then
|
|
220
|
+
echo -e "\n$REPORT_LOG_PATH exists" >> "$DEBUG_PATH" && echo "$REPORT_LOG_PATH exists"
|
|
221
|
+
else
|
|
222
|
+
echo -e "\n$REPORT_LOG_PATH is missing" >> "$DEBUG_PATH" && echo "$REPORT_LOG_PATH is missing"
|
|
223
|
+
REPORT_LOG_PATH=""
|
|
224
|
+
fi
|
|
225
|
+
|
|
188
226
|
if [ -f "$UNEXPECTED_RESULTS_PATH" ]; then
|
|
189
|
-
echo "$UNEXPECTED_RESULTS_PATH exists"
|
|
227
|
+
echo -e "\n$UNEXPECTED_RESULTS_PATH exists" >> "$DEBUG_PATH" && echo "$UNEXPECTED_RESULTS_PATH exists"
|
|
190
228
|
else
|
|
191
|
-
echo "$UNEXPECTED_RESULTS_PATH is missing"
|
|
229
|
+
echo -e "\n$UNEXPECTED_RESULTS_PATH is missing" >> "$DEBUG_PATH" && echo "$UNEXPECTED_RESULTS_PATH is missing"
|
|
192
230
|
UNEXPECTED_RESULTS_PATH=""
|
|
193
231
|
fi
|
|
194
232
|
|
|
195
233
|
if [ -f "$DEBUG_LOG_PATH" ]; then
|
|
196
|
-
echo "$DEBUG_LOG_PATH exists"
|
|
234
|
+
echo -e "\n$DEBUG_LOG_PATH exists" >> "$DEBUG_PATH" && echo "$DEBUG_LOG_PATH exists"
|
|
197
235
|
else
|
|
198
|
-
echo "$DEBUG_LOG_PATH is missing"
|
|
236
|
+
echo -e "\n$DEBUG_LOG_PATH is missing" >> "$DEBUG_PATH" && echo "$DEBUG_LOG_PATH is missing"
|
|
199
237
|
DEBUG_LOG_PATH=""
|
|
200
238
|
fi
|
|
201
239
|
|
|
@@ -203,6 +241,7 @@ runs:
|
|
|
203
241
|
|
|
204
242
|
echo "PATH_TO_ARTIFACTS=$FOLDER" >> "$GITHUB_OUTPUT"
|
|
205
243
|
echo "PATH_TO_REPORT_FILE=$REPORT_PATH" >> "$GITHUB_OUTPUT"
|
|
244
|
+
echo "PATH_TO_REPORT_LOG_FILE=$REPORT_LOG_PATH" >> "$GITHUB_OUTPUT"
|
|
206
245
|
echo "PATH_TO_UNEXPECTED_RESULTS_FILE=$UNEXPECTED_RESULTS_PATH" >> "$GITHUB_OUTPUT"
|
|
207
246
|
echo "PATH_TO_DEBUG_LOG_FILE=$DEBUG_LOG_PATH" >> "$GITHUB_OUTPUT"
|
|
208
247
|
|
|
@@ -212,4 +251,5 @@ runs:
|
|
|
212
251
|
- shell: bash
|
|
213
252
|
if: ${{ always() }}
|
|
214
253
|
run: |
|
|
215
|
-
|
|
254
|
+
log="💡 ALK0034 INFO: ALkiln finished running tests. See above for more details."
|
|
255
|
+
echo -e "\n$log" >> "$DEBUG_PATH" && echo "$log"
|
|
@@ -47,12 +47,31 @@ runs:
|
|
|
47
47
|
# Place the root directory in this branch
|
|
48
48
|
- uses: actions/checkout@v4
|
|
49
49
|
|
|
50
|
+
- shell: bash
|
|
51
|
+
if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
|
|
52
|
+
name: "💡 ALK0018 INFO: Create artifact paths with date and time"
|
|
53
|
+
run: |
|
|
54
|
+
log="💡 ALK0018 INFO: Get path names with date and time"
|
|
55
|
+
timestamp="$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)"
|
|
56
|
+
debug_dir="/tmp"
|
|
57
|
+
debug_path="$debug_dir/alkiln_docker_logs-${timestamp}UTC.txt"
|
|
58
|
+
artifact_path="alkiln_github_server-${timestamp}UTC"
|
|
59
|
+
|
|
60
|
+
mkdir -p "$debug_dir"
|
|
61
|
+
mkdir -p "$artifact_path"
|
|
62
|
+
echo -e "$log" >> "$debug_path"
|
|
63
|
+
|
|
64
|
+
echo "DEBUG_PATH=$debug_path" >> "$GITHUB_ENV"
|
|
65
|
+
echo "GITHUB_SERVER_ARTIFACT_NAME=$artifact_path" >> "$GITHUB_ENV"
|
|
66
|
+
|
|
50
67
|
- shell: bash
|
|
51
68
|
env:
|
|
52
69
|
MAX_SECONDS_FOR_DOCKER: ${{ inputs.MAX_SECONDS_FOR_DOCKER }}
|
|
53
70
|
DOCASSEMBLECLI_VERSION: ${{ inputs.DOCASSEMBLECLI_VERSION }}
|
|
54
71
|
run: |
|
|
55
|
-
|
|
72
|
+
log="💡ALK0001 INFO: Set environment variables"
|
|
73
|
+
echo -e "\n$log" >> "$DEBUG_PATH" && echo "$log"
|
|
74
|
+
|
|
56
75
|
echo "MAX_SECONDS_FOR_DOCKER=$MAX_SECONDS_FOR_DOCKER" >> $GITHUB_ENV
|
|
57
76
|
echo "DOCASSEMBLECLI_VERSION=$DOCASSEMBLECLI_VERSION" >> $GITHUB_ENV
|
|
58
77
|
echo "DA_ADMIN_API_KEY=abcd1234abcd1234abcd5678abdc5678" >> $GITHUB_ENV
|
|
@@ -63,7 +82,8 @@ runs:
|
|
|
63
82
|
id: api_key_output_step
|
|
64
83
|
shell: bash
|
|
65
84
|
run: |
|
|
66
|
-
|
|
85
|
+
log="💡 ALK0002 INFO: Create GitHub step output variables"
|
|
86
|
+
echo -e "\n$log" >> "$DEBUG_PATH"
|
|
67
87
|
echo "DOCASSEMBLE_DEVELOPER_API_KEY=$DA_ADMIN_API_KEY" >> "$GITHUB_OUTPUT"
|
|
68
88
|
echo "DA_ADMIN_EMAIL=$DA_ADMIN_EMAIL" >> "$GITHUB_OUTPUT"
|
|
69
89
|
echo "DA_ADMIN_PASSWORD=$DA_ADMIN_PASSWORD" >> "$GITHUB_OUTPUT"
|
|
@@ -73,16 +93,20 @@ runs:
|
|
|
73
93
|
CONFIG: ${{ inputs.CONFIG_CONTENTS }}
|
|
74
94
|
shell: bash
|
|
75
95
|
run: |
|
|
76
|
-
|
|
96
|
+
log="💡 ALK0003 INFO: Get config"
|
|
97
|
+
echo -e "\n$log" >> "$DEBUG_PATH"
|
|
98
|
+
|
|
77
99
|
mkdir /tmp/config
|
|
78
100
|
# Worth making this silent by defining a variable with > /dev/null...?
|
|
79
101
|
if [ -n "$CONFIG" ]
|
|
80
102
|
then
|
|
81
|
-
|
|
103
|
+
log2="💡 ALK0004 INFO: The developer did provide a custom docassemble config file as an input into this action."
|
|
104
|
+
echo -e "\n$log2" >> "$DEBUG_PATH" echo "$log2"
|
|
82
105
|
echo "$CONFIG" > /tmp/config/myconfig.yml
|
|
83
106
|
echo "CONFIG_ARGS=--env DA_CONFIG=/tmp/config/myconfig.yml --volume /tmp/config:/tmp/config " >> $GITHUB_ENV
|
|
84
107
|
else
|
|
85
|
-
|
|
108
|
+
log3="💡 ALK0005 INFO: The developer did NOT provide a custom docassemble config file as an input into this action. Docassemble will use its default config."
|
|
109
|
+
echo -e "\n$log3" >> "$DEBUG_PATH" echo "$log3"
|
|
86
110
|
echo "CONFIG_ARGS=" >> $GITHUB_ENV
|
|
87
111
|
fi
|
|
88
112
|
|
|
@@ -97,11 +121,14 @@ runs:
|
|
|
97
121
|
SHOW_DOCKER_OUTPUT: ${{ inputs.SHOW_DOCKER_OUTPUT }}
|
|
98
122
|
shell: bash
|
|
99
123
|
run: |
|
|
100
|
-
|
|
124
|
+
log="💡 ALK0006 INFO: Determine docker logs visibility"
|
|
125
|
+
echo -e "\n$log" >> "$DEBUG_PATH"
|
|
101
126
|
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
|
102
127
|
echo "OUTPUT_DOCKER=$SHOW_DOCKER_OUTPUT" >> $GITHUB_ENV
|
|
128
|
+
echo -e "\n$SHOW_DOCKER_OUTPUT" >> "$DEBUG_PATH"
|
|
103
129
|
else
|
|
104
130
|
echo "OUTPUT_DOCKER=false" >> $GITHUB_ENV
|
|
131
|
+
echo -e "\nfalse" >> "$DEBUG_PATH"
|
|
105
132
|
fi
|
|
106
133
|
|
|
107
134
|
# Messages about output
|
|
@@ -110,13 +137,15 @@ runs:
|
|
|
110
137
|
shell: bash
|
|
111
138
|
run: |
|
|
112
139
|
# 💡 ALK0007 INFO: ALKiln will now hide docker output
|
|
113
|
-
|
|
140
|
+
log="===\n💡 ALK0007 INFO: ALKiln will now hide docker output to avoid possibly showing details about your config. If you want to get output to see more of what is going on, use \"with:\" and set the input \"SHOW_DOCKER_OUTPUT\" to \"true\". This output will only be visible to those who can already see the action output, like people with admin or write permissions.\n==="
|
|
141
|
+
echo -e "\n$log" >> "$DEBUG_PATH" && echo -e "$log"
|
|
114
142
|
- name: "💡 ALK0008 INFO: ALKiln will show docker output"
|
|
115
143
|
if: ${{ env.OUTPUT_DOCKER == 'true' }}
|
|
116
144
|
shell: bash
|
|
117
145
|
run: |
|
|
118
146
|
# 💡 ALK0008 INFO: ALKiln will show docker output
|
|
119
|
-
|
|
147
|
+
log="===\n💡 ALK0008 INFO: ALKiln will show docker output. ALKiln cannot control this output. If you want to prevent output, use \"with:\" and set the input \"SHOW_DOCKER_OUTPUT\" to \"false\". This output will only be visible to those who can already see the action output, like people with admin or write permissions.\n==="
|
|
148
|
+
echo -e "\n$log" >> "$DEBUG_PATH" && echo -e "$log"
|
|
120
149
|
|
|
121
150
|
# TODO: Reduce these to 1 block by putting ` > /dev/null 2>&1` into an env var
|
|
122
151
|
# No docker output
|
|
@@ -126,13 +155,14 @@ runs:
|
|
|
126
155
|
CONFIG_ARGS: ${{ env.CONFIG_ARGS }}
|
|
127
156
|
shell: bash
|
|
128
157
|
run: |
|
|
129
|
-
|
|
158
|
+
log="💡 ALK0009 INFO: Download and start docker silently"
|
|
159
|
+
echo -e "\n$log" >> "$DEBUG_PATH"
|
|
130
160
|
docker pull jhpyle/docassemble > /dev/null 2>&1
|
|
131
161
|
docker run --name docassemble_container \
|
|
132
162
|
--env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \
|
|
133
163
|
--env DA_ADMIN_PASSWORD="$DA_ADMIN_PASSWORD" \
|
|
134
164
|
--env DA_ADMIN_API_KEY="$DA_ADMIN_API_KEY" \
|
|
135
|
-
$CONFIG_ARGS \
|
|
165
|
+
"$CONFIG_ARGS" \
|
|
136
166
|
--cap-add SYS_PTRACE \
|
|
137
167
|
--memory="4gb" -d -p 80:80 jhpyle/docassemble > /dev/null 2>&1
|
|
138
168
|
# With output
|
|
@@ -142,13 +172,14 @@ runs:
|
|
|
142
172
|
CONFIG_ARGS: ${{ env.CONFIG_ARGS }}
|
|
143
173
|
shell: bash
|
|
144
174
|
run: |
|
|
145
|
-
|
|
175
|
+
log="💡 ALK0010 INFO: Download and start docker"
|
|
176
|
+
echo -e "\n$log" >> "$DEBUG_PATH"
|
|
146
177
|
docker pull jhpyle/docassemble
|
|
147
178
|
docker run --name docassemble_container \
|
|
148
179
|
--env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \
|
|
149
180
|
--env DA_ADMIN_PASSWORD="$DA_ADMIN_PASSWORD" \
|
|
150
181
|
--env DA_ADMIN_API_KEY="$DA_ADMIN_API_KEY" \
|
|
151
|
-
$CONFIG_ARGS \
|
|
182
|
+
"$CONFIG_ARGS" \
|
|
152
183
|
--cap-add SYS_PTRACE \
|
|
153
184
|
--memory="4gb" -d -p 80:80 jhpyle/docassemble
|
|
154
185
|
|
|
@@ -159,12 +190,14 @@ runs:
|
|
|
159
190
|
shell: bash
|
|
160
191
|
run: |
|
|
161
192
|
# 💡 ALK0011 INFO: The following messages are not docker output
|
|
162
|
-
|
|
193
|
+
log="💡 ALK0011 INFO: The following messages are NOT docker output, just ALKiln waiting for the server to start"
|
|
194
|
+
echo -e "\n$log" >> "$DEBUG_PATH" && echo -e "$log"
|
|
163
195
|
|
|
164
196
|
- name: "💡 ALK0012 INFO: Waiting for server to start"
|
|
165
197
|
shell: bash
|
|
166
198
|
run: |
|
|
167
|
-
|
|
199
|
+
log="💡 ALK0012 INFO: Waiting for server to start"
|
|
200
|
+
echo -e "\n$log" >> "$DEBUG_PATH"
|
|
168
201
|
|
|
169
202
|
# Reset the SECONDS variable
|
|
170
203
|
SECONDS=0
|
|
@@ -173,23 +206,28 @@ runs:
|
|
|
173
206
|
|
|
174
207
|
response="start"
|
|
175
208
|
while [[ $response != *"200"* ]]; do
|
|
176
|
-
|
|
209
|
+
log2="💡 ALK0013 INFO: Time elapsed: $SECONDS seconds"
|
|
210
|
+
echo -e "\n$log2" >> "$DEBUG_PATH" && echo -e "$log2"
|
|
177
211
|
|
|
178
212
|
# Check if max seconds till loading has passed
|
|
179
213
|
if [[ $SECONDS -ge $MAX_SECONDS_FOR_DOCKER ]]; then
|
|
180
|
-
|
|
214
|
+
log3="🤕 ALK0014 ERROR: Timed out waiting for docker container to serve the site. If you want to give your docker container more timem to install, set the MAX_SECONDS_FOR_DOCKER input for this action."
|
|
215
|
+
echo -e "\n$log3" >> "$DEBUG_PATH" && echo -e "$log3"
|
|
181
216
|
exit 1
|
|
182
217
|
fi
|
|
183
218
|
|
|
184
219
|
# Set the variable to a new string value in each iteration
|
|
185
220
|
response=$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:80/health_check?ready=1)
|
|
186
|
-
|
|
221
|
+
log4="💡 ALK0015 INFO: Response is $response"
|
|
222
|
+
echo -e "\n$log4" >> "$DEBUG_PATH" && echo -e "$log4"
|
|
187
223
|
|
|
188
224
|
# Check if the string includes the desired text
|
|
189
225
|
if [[ $response == *"200"* ]]; then
|
|
190
|
-
|
|
226
|
+
log5="💡 ALK0016 SUCCESS: Success! The docker container is ready!"
|
|
227
|
+
echo -e "\n$log5" >> "$DEBUG_PATH" && echo -e "$log5"
|
|
191
228
|
else
|
|
192
|
-
|
|
229
|
+
log6="💡 ALK0017 INFO: The docker container is not ready yet. Will check again in 30 seconds."
|
|
230
|
+
echo -e "\n$log6" >> "$DEBUG_PATH" && echo -e "$log6"
|
|
193
231
|
sleep 30
|
|
194
232
|
fi
|
|
195
233
|
|
|
@@ -219,32 +257,28 @@ runs:
|
|
|
219
257
|
|
|
220
258
|
# Upload artifacts that devs can download on the Actions summary page
|
|
221
259
|
# Only if the developer wants to get that info, though
|
|
222
|
-
- name: "💡 ALK0018 INFO: Get path names with date and time"
|
|
223
|
-
if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
|
|
224
|
-
shell: bash
|
|
225
|
-
run: |
|
|
226
|
-
# 💡 ALK0018 INFO: Get path names with date and time
|
|
227
|
-
echo "GITHUB_SERVER_LOG_FILE_NAME=/tmp/alkiln_docker_logs-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC.txt" >> $GITHUB_ENV
|
|
228
|
-
echo "GITHUB_SERVER_ARTIFACT_NAME=alkiln_github_server-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
|
|
229
260
|
- name: "💡 ALK0019 INFO: Create docker artifact data"
|
|
230
261
|
if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
|
|
231
262
|
shell: bash
|
|
232
263
|
run: |
|
|
233
|
-
|
|
234
|
-
echo "$
|
|
264
|
+
log="💡 ALK0019 INFO: Create docker artifact data"
|
|
265
|
+
echo -e "\n$log" >> "$DEBUG_PATH"
|
|
266
|
+
echo "$(docker output docassemble_container)" >> "${{ env.DEBUG_PATH }}"
|
|
235
267
|
- name: "💡 ALK0020 INFO: Upload artifacts folder"
|
|
236
268
|
if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
|
|
237
269
|
uses: actions/upload-artifact@v4
|
|
238
270
|
with:
|
|
239
271
|
name: ${{ env.GITHUB_SERVER_ARTIFACT_NAME }}
|
|
240
|
-
path: ${{ env.
|
|
272
|
+
path: ${{ env.DEBUG_PATH }}
|
|
241
273
|
|
|
242
274
|
- shell: bash
|
|
243
275
|
if: ${{ success() }}
|
|
244
276
|
run: |
|
|
245
|
-
|
|
277
|
+
log="💡 ALK0021 SUCCESS: ALKiln created the docker container and started the server!"
|
|
278
|
+
echo -e "\n$log" >> "$DEBUG_PATH" && echo -e "$log"
|
|
246
279
|
|
|
247
280
|
- shell: bash
|
|
248
281
|
if: ${{ failure() }}
|
|
249
282
|
run: |
|
|
250
|
-
|
|
283
|
+
log="🤕 ALK0022 ERROR: Something went wrong. See above for more details."
|
|
284
|
+
echo -e "\n$log" >> "$DEBUG_PATH" && echo -e "$log"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Which log levels to pick
|
|
2
|
+
|
|
3
|
+
## Context and Problem Statement
|
|
4
|
+
|
|
5
|
+
The log levels we're giving access to in Log are `success` (`info` with a special icon), `info`, `warn`, and `throw` (`error` and throw the error). Sometimes, like in the log file itself, we hard-code the icons and such. Those places have access to other levels, like `error`.
|
|
6
|
+
|
|
7
|
+
We want to avoid distracting our users by logging errors everywhere, even when an error is what triggered the log. Does that hold true in the debug log? Successes can also be misleading about whether tests have passed or not.
|
|
8
|
+
|
|
9
|
+
When picking the log level for a log, how do we know which level to choose?
|
|
10
|
+
|
|
11
|
+
## Considered Options
|
|
12
|
+
|
|
13
|
+
- Stay as true to technical behavior as possible.
|
|
14
|
+
- Stay as clear to users as possible - use levels that will help users pay attention to what affects them.
|
|
15
|
+
|
|
16
|
+
For example:
|
|
17
|
+
|
|
18
|
+
`success`:
|
|
19
|
+
- Use whenever anything completes successfully.
|
|
20
|
+
- Only use for success of major operations.
|
|
21
|
+
- Use for every test success.
|
|
22
|
+
- Use for success of all the tests.
|
|
23
|
+
`error`:
|
|
24
|
+
- Always use `error` when an error happens.
|
|
25
|
+
- Use `error` when an unexpected error happens.
|
|
26
|
+
- Only use `error` for user-relevant errors.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Decision Outcome
|
|
30
|
+
|
|
31
|
+
Distract the user as little as possible everywhere.
|
|
32
|
+
|
|
33
|
+
`success`:
|
|
34
|
+
- Only log success once for success of all tests.
|
|
35
|
+
- Include the `success` icon in the Scenario "Passed" section of the report.
|
|
36
|
+
`throw`:
|
|
37
|
+
- Use this level to throw errors for the user's tests (or our own internal tests).
|
|
38
|
+
- Use this if ALKiln itself needs to abort a test or the test suite.
|
|
39
|
+
`error`:
|
|
40
|
+
- Avoid using `error` explicitly. Only the debug logs should use the `error` level, and only to record critical errors that come in with `throw`.
|
|
41
|
+
`info`:
|
|
42
|
+
- Log expected errors as `info`. For example, the aborted promises when awaiting navigation.
|
|
43
|
+
`warn`:
|
|
44
|
+
- Avoid using the word "error" in warnings if possible.
|
|
45
|
+
- Use `warn` in the console for messages the user should investigate.
|
|
46
|
+
- Use `warn` in the debug log for messages ALKiln devs might investigate if necessary. If the warning comes from non-critical unexpected behavior, do try to be clear about what happened, but also try to avoid using the word "error" if possible. E.g. "Skipped creating metadata for the logs" instead of "Error while creating metadata for the logs".
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Document decisions
|
|
2
|
+
|
|
3
|
+
## Context and Problem Statement
|
|
4
|
+
|
|
5
|
+
What is a good way to avoid re-hashing old decisions, or to at least know why those decisions were made?
|
|
6
|
+
|
|
7
|
+
## Considered Options
|
|
8
|
+
|
|
9
|
+
- GitHub issues
|
|
10
|
+
- GitHub discussions
|
|
11
|
+
- Actual files in the repo
|
|
12
|
+
|
|
13
|
+
Formats:
|
|
14
|
+
- https://adr.github.io/madr
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Decision Outcome
|
|
18
|
+
|
|
19
|
+
Use in-repo .md files using the https://adr.github.io/madr format. We found keeping the data within the repo to be the most compelling factor.
|
|
20
|
+
|
|
21
|
+
## Pros and Cons of the Options
|
|
22
|
+
|
|
23
|
+
### GitHub issues
|
|
24
|
+
|
|
25
|
+
Pros:
|
|
26
|
+
|
|
27
|
+
- Easy to search.
|
|
28
|
+
- Can add labels and such.
|
|
29
|
+
- In one of the most common places to search.
|
|
30
|
+
- Allows comments
|
|
31
|
+
|
|
32
|
+
Cons:
|
|
33
|
+
|
|
34
|
+
- Not actually in the repository, so any forks or clones would lose that info.
|
|
35
|
+
- Comments can get confusing and hard to read.
|
|
36
|
+
|
|
37
|
+
### GitHub discussions
|
|
38
|
+
|
|
39
|
+
Pros:
|
|
40
|
+
|
|
41
|
+
- Labels and such.
|
|
42
|
+
- Probably easy to search?
|
|
43
|
+
|
|
44
|
+
Cons:
|
|
45
|
+
|
|
46
|
+
- A separate place from issues. Not everyone even knows those exist.
|
|
47
|
+
- All the cons of GitHub issues
|
|
48
|
+
|
|
49
|
+
### Actual files in the repo
|
|
50
|
+
|
|
51
|
+
Pros:
|
|
52
|
+
|
|
53
|
+
- They go everywhere the repo goes.
|
|
54
|
+
|
|
55
|
+
Cons:
|
|
56
|
+
|
|
57
|
+
- Probably not as searchable, though maybe we could institute a way to "label"/tag them.
|
|
58
|
+
- Not very visible.
|