@suffolklitlab/alkiln 5.13.2 ā 5.13.4
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/.github/workflows/github_server.yml +7 -7
- package/.github/workflows/playground.yml +1 -1
- package/CHANGELOG.md +32 -1
- package/action.yml +70 -28
- package/action_for_github_server/action.yml +61 -29
- package/docs/4_environments.md +243 -0
- package/docs/artifacts_folder_name.md +135 -0
- package/docs/constrained_random_tests.md +347 -0
- package/docs/decisions/006_which_log_level_to_pick_2024_09_5.md +70 -0
- package/docs/decisions/007_getting_and_storing_logs.md +179 -0
- package/docs/decisions/move_runtime_config_to_sources_folder.md +3 -0
- package/docs/decisions/reports_and_logs_2024_08_11.md +161 -0
- package/docs/kinds_of_errors.md +26 -0
- package/docs/prioritize_constrained_random_tests.md +101 -0
- package/docs/seprate_file_generation_GitHub_action.md +11 -0
- package/lib/docassemble/docassemble_api_interface.js +77 -51
- package/lib/docassemble/server_install.js +32 -9
- package/lib/docassemble/setup.js +40 -25
- package/lib/docassemble/takedown.js +33 -10
- package/lib/parse.js +36 -0
- package/lib/run_cucumber.js +115 -36
- package/lib/scope.js +69 -77
- package/lib/steps.js +70 -42
- package/lib/utils/Log.js +982 -0
- package/lib/utils/files.js +18 -11
- package/lib/utils/get_sources_paths.js +162 -0
- package/lib/utils/parse.js +1 -0
- package/lib/utils/proccess_command_line_args.js +267 -0
- package/lib/utils/reports.js +64 -17
- package/lib/utils/session_vars.js +34 -21
- package/lib/utils/time.js +44 -0
- package/package.json +1 -1
- package/tests/log_codes/check_codes.sh +2 -1
- package/tests/log_codes/log_code_expected_instances.txt +33 -9
- 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 +581 -0
- package/tests/unit_tests/normalizeTable.test.js +5 -0
- package/lib/utils/log.js +0 -96
|
@@ -45,15 +45,15 @@ jobs:
|
|
|
45
45
|
#### keyword or values at all. See
|
|
46
46
|
#### https://assemblyline.suffolklitlab.org/docs/alkiln/writing#env-vars
|
|
47
47
|
env:
|
|
48
|
-
SECRET_VAR1: secret-var1-value
|
|
49
|
-
SECRET_VAR2: secret-var2-value
|
|
50
|
-
SECRET_FOR_MISSING_FIELD: secret for missing field
|
|
51
|
-
INVALID_API_KEY: invalidAPIkey
|
|
52
|
-
EMPTY_STRING: ""
|
|
53
48
|
NORMAL_USER_EMAIL: alkiln@example.com
|
|
54
49
|
NORMAL_USER_PASSWORD: User123^
|
|
55
50
|
WRONG_EMAIL: wrong_email@example.com
|
|
56
51
|
WRONG_PASSWORD: wrong_password
|
|
52
|
+
INVALID_API_KEY: invalidAPIkey
|
|
53
|
+
EMPTY_STRING: ""
|
|
54
|
+
SECRET_VAR1: secret-var1-value
|
|
55
|
+
SECRET_VAR2: secret-var2-value
|
|
56
|
+
SECRET_FOR_MISSING_FIELD: secret for missing field
|
|
57
57
|
|
|
58
58
|
steps:
|
|
59
59
|
# Place the root directory in this branch to access
|
|
@@ -160,7 +160,7 @@ jobs:
|
|
|
160
160
|
#### Developer note: You can probably leave the rest out
|
|
161
161
|
#### To learn more, see https://assemblyline.suffolklitlab.org/docs/alkiln/writing/#optional-inputs
|
|
162
162
|
ALKILN_TAG_EXPRESSION: "${{ env.ALKILN_TAG_EXPRESSION }}"
|
|
163
|
-
ALKILN_VERSION:
|
|
163
|
+
# ALKILN_VERSION: logs
|
|
164
164
|
|
|
165
165
|
#### Developer note: Example of making an issue when tests fail
|
|
166
166
|
#### that includes the text of the failure output file
|
|
@@ -169,7 +169,7 @@ jobs:
|
|
|
169
169
|
if: ${{ failure() }}
|
|
170
170
|
env:
|
|
171
171
|
GH_TOKEN: ${{ github.token }}
|
|
172
|
-
|
|
172
|
+
PATH_TO_REPORT_LOG_FILE: "${{ steps.alkiln.outputs.PATH_TO_REPORT_LOG_FILE }}"
|
|
173
173
|
PATH_TO_UNEXPECTED_RESULTS_FILE: "${{ steps.alkiln.outputs.PATH_TO_UNEXPECTED_RESULTS_FILE }}"
|
|
174
174
|
PATH_TO_DEBUG_LOG_FILE: "${{ steps.alkiln.outputs.PATH_TO_DEBUG_LOG_FILE }}"
|
|
175
175
|
run: |
|
package/CHANGELOG.md
CHANGED
|
@@ -43,11 +43,36 @@ Format:
|
|
|
43
43
|
-
|
|
44
44
|
-->
|
|
45
45
|
|
|
46
|
-
## [Unreleased]
|
|
46
|
+
<!-- ## [Unreleased] -->
|
|
47
|
+
|
|
48
|
+
## [5.13.4] - 2025-01-11
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
|
|
52
|
+
- Removed an extraneous log
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
- Final error showed an undefined var instead of a more useful error message
|
|
57
|
+
|
|
58
|
+
### Internal
|
|
59
|
+
|
|
60
|
+
- Refactored `log` into a class that works with ALKiln's 4 possible environments
|
|
61
|
+
- Refactored `Log` class to handle throwing errors
|
|
62
|
+
- Now store debug information in debug log instead of printing it live
|
|
63
|
+
- Removed debug flag so debug logs always get stored
|
|
64
|
+
- Added decision/design docs
|
|
65
|
+
|
|
66
|
+
## [5.13.3] - 2025-01-05
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- Updates to latest docassemble HTML. See [#960](https://github.com/SuffolkLITLab/ALKiln/issues/960). Changes all appearances of `fieldset` to keep the code consistent.
|
|
47
71
|
|
|
48
72
|
## [5.13.2] - 2024-11-23
|
|
49
73
|
|
|
50
74
|
### Fixed
|
|
75
|
+
|
|
51
76
|
- Fixes download Step unable to use a partial filename match. The Step needed the whole name, including the extension. See [#725](https://github.com/SuffolkLITLab/ALKiln/issues/725).
|
|
52
77
|
|
|
53
78
|
## [5.13.1] - 2024-10-23
|
|
@@ -59,6 +84,8 @@ Format:
|
|
|
59
84
|
### Fixed
|
|
60
85
|
|
|
61
86
|
- Detects failed sign in. Closes [#918](https://github.com/SuffolkLITLab/ALKiln/issues/918).
|
|
87
|
+
- Fixes undefined `errors` var in `After()`
|
|
88
|
+
- Closes [#924](https://github.com/SuffolkLITLab/ALKiln/issues/924), remove extra interview url print
|
|
62
89
|
|
|
63
90
|
### Internal
|
|
64
91
|
|
|
@@ -69,6 +96,10 @@ Format:
|
|
|
69
96
|
- Adds decision docs
|
|
70
97
|
- Updated CONTRIBUTING.md
|
|
71
98
|
- Added example.env, closes [#374](https://github.com/SuffolkLITLab/ALKiln/issues/374)
|
|
99
|
+
- Closes [#805](https://github.com/SuffolkLITLab/ALKiln/issues/805), create verbose-type log
|
|
100
|
+
- Closes [#659](https://github.com/SuffolkLITLab/ALKiln/issues/659), abstract adding to debug_log
|
|
101
|
+
- Closes [#925](https://github.com/SuffolkLITLab/ALKiln/issues/925), allow a `Log` to throw an error
|
|
102
|
+
- Addresses [#461](https://github.com/SuffolkLITLab/ALKiln/issues/461), setup and takedown reports
|
|
72
103
|
- Updates pdfjs-dist for node v20 and v22. See [#952](https://github.com/SuffolkLITLab/ALKiln/issues/952).
|
|
73
104
|
|
|
74
105
|
## [5.13.0] - 2024-07-11
|
package/action.yml
CHANGED
|
@@ -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,20 @@ runs:
|
|
|
67
70
|
DOCASSEMBLECLI_VERSION: ${{ inputs.DOCASSEMBLECLI_VERSION }}
|
|
68
71
|
shell: bash
|
|
69
72
|
run: |
|
|
70
|
-
|
|
73
|
+
log="š” ALK0023 INFO: Set environment variables and create artifacts folder"
|
|
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
|
+
debug_path="${artifact_folder}/debug_log.txt"
|
|
79
|
+
mkdir -p "$artifact_folder"
|
|
80
|
+
echo "$log" >> "$debug_path"
|
|
81
|
+
|
|
82
|
+
# Action-specific vars
|
|
83
|
+
echo "ARTIFACT_FOLDER=$artifact_folder" >> $GITHUB_ENV
|
|
84
|
+
echo "DEBUG_PATH=$debug_path" >> $GITHUB_ENV
|
|
85
|
+
|
|
86
|
+
# Required for all tests
|
|
73
87
|
echo "REPO_URL=${{ github.server_url }}/${{ github.repository }}" >> $GITHUB_ENV
|
|
74
88
|
echo "BRANCH_PATH=$BRANCH_PATH" >> $GITHUB_ENV
|
|
75
89
|
# Workflow inputs
|
|
@@ -84,18 +98,21 @@ runs:
|
|
|
84
98
|
- name: "š” ALK0024 INFO: Confirm environment variables"
|
|
85
99
|
shell: bash
|
|
86
100
|
run: |
|
|
87
|
-
|
|
88
|
-
echo -e "\
|
|
101
|
+
log="š” ALK0024 INFO: Confirm environment variables"
|
|
102
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
103
|
+
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"
|
|
104
|
+
echo -e "$vars_log" >> "${{ env.DEBUG_PATH }}" && echo -e "$vars_log"
|
|
89
105
|
|
|
90
106
|
# Install
|
|
91
|
-
- name: "š” ALK0025 INFO:
|
|
107
|
+
- name: "š” ALK0025 INFO: Set up node"
|
|
92
108
|
uses: actions/setup-node@v4
|
|
93
109
|
with:
|
|
94
110
|
node-version: "18"
|
|
95
111
|
- name: "š” ALK0026 INFO: Install ALKiln directly from npm"
|
|
96
112
|
shell: bash
|
|
97
113
|
run: |
|
|
98
|
-
|
|
114
|
+
log="š” ALK0026 INFO: Install ALKiln directly from npm"
|
|
115
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
99
116
|
npm install -g "@suffolklitlab/alkiln@$ALKILN_VERSION"
|
|
100
117
|
|
|
101
118
|
# Install on playground
|
|
@@ -109,26 +126,32 @@ runs:
|
|
|
109
126
|
if: ${{ inputs.INSTALL_METHOD == 'playground' }}
|
|
110
127
|
shell: bash
|
|
111
128
|
run: |
|
|
112
|
-
|
|
129
|
+
log="š” ALK0027 INFO: Create a Project and install the package from GitHub"
|
|
130
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
113
131
|
pip install "docassemblecli==$DOCASSEMBLECLI_VERSION"
|
|
114
|
-
alkiln-setup
|
|
115
|
-
- name: "
|
|
132
|
+
alkiln-setup --path="${{ env.ARTIFACT_FOLDER }}"
|
|
133
|
+
- name: "š¤ ALK0028 ERROR: Unable to create a Project"
|
|
116
134
|
if: ${{ inputs.INSTALL_METHOD == 'playground' && failure() }}
|
|
117
135
|
shell: bash
|
|
118
136
|
run: |
|
|
119
|
-
#
|
|
120
|
-
|
|
137
|
+
# "š¤ ALK0028 ERROR: Unable to create a Project"
|
|
138
|
+
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"
|
|
139
|
+
echo -e "$long_log" >> "${{ env.DEBUG_PATH }}" && echo -e "$long_log"
|
|
121
140
|
|
|
122
141
|
# Server installations - find folders and save session vars
|
|
123
142
|
- name: "š” ALK0029 INFO: Install the GitHub package onto the server"
|
|
124
143
|
if: ${{ inputs.INSTALL_METHOD == 'server' }}
|
|
125
144
|
shell: bash
|
|
126
|
-
run:
|
|
127
|
-
|
|
145
|
+
run: |
|
|
146
|
+
log="š” ALK0029 INFO: Install the GitHub package onto the server"
|
|
147
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
148
|
+
alkiln-server-install --path="${{ env.ARTIFACT_FOLDER }}"
|
|
149
|
+
- name: "š¤ ALK0030 ERROR: Unable to install the package"
|
|
128
150
|
if: ${{ inputs.INSTALL_METHOD == 'server' && failure() }}
|
|
129
151
|
shell: bash
|
|
130
152
|
run: |
|
|
131
|
-
|
|
153
|
+
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"
|
|
154
|
+
echo -e "$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"
|
|
132
155
|
|
|
133
156
|
# run tests
|
|
134
157
|
- name: "š” ALK0031 INFO: Run tests"
|
|
@@ -136,20 +159,26 @@ runs:
|
|
|
136
159
|
env:
|
|
137
160
|
ALKILN_TAG_EXPRESSION: ${{ inputs.ALKILN_TAG_EXPRESSION || github.event.inputs.tags && format('{0}', github.event.inputs.tags) }}
|
|
138
161
|
shell: bash
|
|
139
|
-
run:
|
|
162
|
+
run: |
|
|
163
|
+
log="š” ALK0031 INFO: Run tests"
|
|
164
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
165
|
+
alkiln-run "$ALKILN_TAG_EXPRESSION" --path="${{ env.ARTIFACT_FOLDER }}"
|
|
140
166
|
|
|
141
167
|
# on playground, delete project
|
|
142
168
|
- name: "š” ALK0032 INFO: Delete the Project from the Playground"
|
|
143
169
|
if: ${{ always() && inputs.INSTALL_METHOD == 'playground' }}
|
|
144
|
-
run: alkiln-takedown
|
|
145
170
|
shell: bash
|
|
171
|
+
run: |
|
|
172
|
+
log="š” ALK0032 INFO: Delete the Project from the Playground"
|
|
173
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
174
|
+
alkiln-takedown --path="${{ env.ARTIFACT_FOLDER }}"
|
|
146
175
|
|
|
147
176
|
# Upload artifacts that subscribers can download on the Actions summary page
|
|
148
177
|
- name: "š” ALK0033 INFO: Upload artifacts folder"
|
|
149
178
|
if: ${{ always() }}
|
|
150
179
|
uses: actions/upload-artifact@v4
|
|
151
180
|
with:
|
|
152
|
-
name: ${{ env.
|
|
181
|
+
name: ${{ env.ARTIFACT_FOLDER }}
|
|
153
182
|
path: ./alkiln-*
|
|
154
183
|
|
|
155
184
|
# Download artifacts folder internally to create action output
|
|
@@ -157,45 +186,56 @@ runs:
|
|
|
157
186
|
if: ${{ always() }}
|
|
158
187
|
uses: actions/download-artifact@v4
|
|
159
188
|
with:
|
|
160
|
-
name: ${{ env.
|
|
189
|
+
name: ${{ env.ARTIFACT_FOLDER }}
|
|
161
190
|
|
|
162
191
|
- name: "š” ALK0184 INFO: Prepare ALKiln output file paths"
|
|
163
192
|
if: ${{ always() }}
|
|
164
193
|
id: alkiln_outputs
|
|
165
194
|
shell: bash
|
|
166
195
|
run: |
|
|
167
|
-
|
|
196
|
+
log="š” ALK0184 INFO: Prepare ALKiln output file paths"
|
|
197
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo "$log"
|
|
168
198
|
|
|
169
199
|
FOLDER=$(ls -d */ | grep -E '^alkiln-*' || true)
|
|
170
200
|
|
|
171
|
-
|
|
201
|
+
log_folder="Test results artifacts folder is $FOLDER"
|
|
202
|
+
echo -e "\n$log_folder" >> "${{ env.DEBUG_PATH }}" && echo "$log_folder"
|
|
172
203
|
|
|
173
204
|
if [[ "$FOLDER" = "" ]]; then
|
|
174
|
-
|
|
205
|
+
log_missing="Artifacts folder is missing. The path is an empty string: '$FOLDER'"
|
|
206
|
+
echo -e "\n$log_missing" >> "${{ env.DEBUG_PATH }}" && echo "$log_missing"
|
|
175
207
|
|
|
176
208
|
else
|
|
177
209
|
REPORT_PATH="${FOLDER}report.txt"
|
|
210
|
+
REPORT_LOG_PATH="${FOLDER}report_log.txt"
|
|
178
211
|
UNEXPECTED_RESULTS_PATH="${FOLDER}unexpected_results.txt"
|
|
179
212
|
DEBUG_LOG_PATH="${FOLDER}debug_log.txt"
|
|
180
213
|
|
|
181
214
|
if [ -f "$REPORT_PATH" ]; then
|
|
182
|
-
echo "$REPORT_PATH exists"
|
|
215
|
+
echo -e "\n$REPORT_PATH exists" >> "${{ env.DEBUG_PATH }}" && echo "$REPORT_PATH exists"
|
|
183
216
|
else
|
|
184
|
-
echo "$REPORT_PATH is missing"
|
|
217
|
+
echo -e "\n$REPORT_PATH is missing" >> "${{ env.DEBUG_PATH }}" && echo "$REPORT_PATH is missing"
|
|
185
218
|
REPORT_PATH=""
|
|
186
219
|
fi
|
|
187
220
|
|
|
221
|
+
if [ -f "$REPORT_LOG_PATH" ]; then
|
|
222
|
+
echo -e "\n$REPORT_LOG_PATH exists" >> "${{ env.DEBUG_PATH }}" && echo "$REPORT_LOG_PATH exists"
|
|
223
|
+
else
|
|
224
|
+
echo -e "\n$REPORT_LOG_PATH is missing" >> "${{ env.DEBUG_PATH }}" && echo "$REPORT_LOG_PATH is missing"
|
|
225
|
+
REPORT_LOG_PATH=""
|
|
226
|
+
fi
|
|
227
|
+
|
|
188
228
|
if [ -f "$UNEXPECTED_RESULTS_PATH" ]; then
|
|
189
|
-
echo "$UNEXPECTED_RESULTS_PATH exists"
|
|
229
|
+
echo -e "\n$UNEXPECTED_RESULTS_PATH exists" >> "${{ env.DEBUG_PATH }}" && echo "$UNEXPECTED_RESULTS_PATH exists"
|
|
190
230
|
else
|
|
191
|
-
echo "$UNEXPECTED_RESULTS_PATH is missing"
|
|
231
|
+
echo -e "\n$UNEXPECTED_RESULTS_PATH is missing" >> "${{ env.DEBUG_PATH }}" && echo "$UNEXPECTED_RESULTS_PATH is missing"
|
|
192
232
|
UNEXPECTED_RESULTS_PATH=""
|
|
193
233
|
fi
|
|
194
234
|
|
|
195
235
|
if [ -f "$DEBUG_LOG_PATH" ]; then
|
|
196
|
-
echo "$DEBUG_LOG_PATH exists"
|
|
236
|
+
echo -e "\n$DEBUG_LOG_PATH exists" >> "${{ env.DEBUG_PATH }}" && echo "$DEBUG_LOG_PATH exists"
|
|
197
237
|
else
|
|
198
|
-
echo "$DEBUG_LOG_PATH is missing"
|
|
238
|
+
echo -e "\n$DEBUG_LOG_PATH is missing" >> "${{ env.DEBUG_PATH }}" && echo "$DEBUG_LOG_PATH is missing"
|
|
199
239
|
DEBUG_LOG_PATH=""
|
|
200
240
|
fi
|
|
201
241
|
|
|
@@ -203,6 +243,7 @@ runs:
|
|
|
203
243
|
|
|
204
244
|
echo "PATH_TO_ARTIFACTS=$FOLDER" >> "$GITHUB_OUTPUT"
|
|
205
245
|
echo "PATH_TO_REPORT_FILE=$REPORT_PATH" >> "$GITHUB_OUTPUT"
|
|
246
|
+
echo "PATH_TO_REPORT_LOG_FILE=$REPORT_LOG_PATH" >> "$GITHUB_OUTPUT"
|
|
206
247
|
echo "PATH_TO_UNEXPECTED_RESULTS_FILE=$UNEXPECTED_RESULTS_PATH" >> "$GITHUB_OUTPUT"
|
|
207
248
|
echo "PATH_TO_DEBUG_LOG_FILE=$DEBUG_LOG_PATH" >> "$GITHUB_OUTPUT"
|
|
208
249
|
|
|
@@ -212,4 +253,5 @@ runs:
|
|
|
212
253
|
- shell: bash
|
|
213
254
|
if: ${{ always() }}
|
|
214
255
|
run: |
|
|
215
|
-
|
|
256
|
+
log="š” ALK0034 INFO: ALkiln finished running tests. See above for more details."
|
|
257
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo "$log"
|
|
@@ -47,12 +47,29 @@ runs:
|
|
|
47
47
|
# Place the root directory in this branch
|
|
48
48
|
- uses: actions/checkout@v4
|
|
49
49
|
|
|
50
|
+
- shell: bash
|
|
51
|
+
run: |
|
|
52
|
+
log="š” ALK0018 INFO: Get path names with date and time"
|
|
53
|
+
timestamp="$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)"
|
|
54
|
+
debug_dir="/tmp"
|
|
55
|
+
debug_path="$debug_dir/alkiln_docker_logs-${timestamp}UTC.txt"
|
|
56
|
+
artifact_folder="alkiln_github_server-${timestamp}UTC"
|
|
57
|
+
|
|
58
|
+
mkdir -p "$debug_dir"
|
|
59
|
+
mkdir -p "$artifact_folder"
|
|
60
|
+
echo -e "$log" >> "$debug_path"
|
|
61
|
+
|
|
62
|
+
echo "DEBUG_PATH=$debug_path" >> $GITHUB_ENV
|
|
63
|
+
echo "GITHUB_SERVER_ARTIFACT_NAME=$artifact_folder" >> $GITHUB_ENV
|
|
64
|
+
|
|
50
65
|
- shell: bash
|
|
51
66
|
env:
|
|
52
67
|
MAX_SECONDS_FOR_DOCKER: ${{ inputs.MAX_SECONDS_FOR_DOCKER }}
|
|
53
68
|
DOCASSEMBLECLI_VERSION: ${{ inputs.DOCASSEMBLECLI_VERSION }}
|
|
54
69
|
run: |
|
|
55
|
-
|
|
70
|
+
log="š” ALK0001 INFO: Set environment variables"
|
|
71
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
72
|
+
|
|
56
73
|
echo "MAX_SECONDS_FOR_DOCKER=$MAX_SECONDS_FOR_DOCKER" >> $GITHUB_ENV
|
|
57
74
|
echo "DOCASSEMBLECLI_VERSION=$DOCASSEMBLECLI_VERSION" >> $GITHUB_ENV
|
|
58
75
|
echo "DA_ADMIN_API_KEY=abcd1234abcd1234abcd5678abdc5678" >> $GITHUB_ENV
|
|
@@ -63,7 +80,8 @@ runs:
|
|
|
63
80
|
id: api_key_output_step
|
|
64
81
|
shell: bash
|
|
65
82
|
run: |
|
|
66
|
-
|
|
83
|
+
log="š” ALK0002 INFO: Create GitHub step output variables"
|
|
84
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
67
85
|
echo "DOCASSEMBLE_DEVELOPER_API_KEY=$DA_ADMIN_API_KEY" >> "$GITHUB_OUTPUT"
|
|
68
86
|
echo "DA_ADMIN_EMAIL=$DA_ADMIN_EMAIL" >> "$GITHUB_OUTPUT"
|
|
69
87
|
echo "DA_ADMIN_PASSWORD=$DA_ADMIN_PASSWORD" >> "$GITHUB_OUTPUT"
|
|
@@ -73,16 +91,20 @@ runs:
|
|
|
73
91
|
CONFIG: ${{ inputs.CONFIG_CONTENTS }}
|
|
74
92
|
shell: bash
|
|
75
93
|
run: |
|
|
76
|
-
|
|
94
|
+
log="š” ALK0003 INFO: Get config"
|
|
95
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
96
|
+
|
|
77
97
|
mkdir /tmp/config
|
|
78
98
|
# Worth making this silent by defining a variable with > /dev/null...?
|
|
79
99
|
if [ -n "$CONFIG" ]
|
|
80
100
|
then
|
|
81
|
-
|
|
101
|
+
log2="š” ALK0004 INFO: The developer did provide a custom docassemble config file as an input into this action."
|
|
102
|
+
echo -e "\n$log2" >> "${{ env.DEBUG_PATH }}" echo "$log2"
|
|
82
103
|
echo "$CONFIG" > /tmp/config/myconfig.yml
|
|
83
104
|
echo "CONFIG_ARGS=--env DA_CONFIG=/tmp/config/myconfig.yml --volume /tmp/config:/tmp/config " >> $GITHUB_ENV
|
|
84
105
|
else
|
|
85
|
-
|
|
106
|
+
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."
|
|
107
|
+
echo -e "\n$log3" >> "${{ env.DEBUG_PATH }}" echo "$log3"
|
|
86
108
|
echo "CONFIG_ARGS=" >> $GITHUB_ENV
|
|
87
109
|
fi
|
|
88
110
|
|
|
@@ -97,11 +119,14 @@ runs:
|
|
|
97
119
|
SHOW_DOCKER_OUTPUT: ${{ inputs.SHOW_DOCKER_OUTPUT }}
|
|
98
120
|
shell: bash
|
|
99
121
|
run: |
|
|
100
|
-
|
|
122
|
+
log="š” ALK0006 INFO: Determine docker logs visibility"
|
|
123
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
101
124
|
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
|
102
125
|
echo "OUTPUT_DOCKER=$SHOW_DOCKER_OUTPUT" >> $GITHUB_ENV
|
|
126
|
+
echo -e "\n$SHOW_DOCKER_OUTPUT" >> "${{ env.DEBUG_PATH }}"
|
|
103
127
|
else
|
|
104
128
|
echo "OUTPUT_DOCKER=false" >> $GITHUB_ENV
|
|
129
|
+
echo -e "\nfalse" >> "${{ env.DEBUG_PATH }}"
|
|
105
130
|
fi
|
|
106
131
|
|
|
107
132
|
# Messages about output
|
|
@@ -110,13 +135,15 @@ runs:
|
|
|
110
135
|
shell: bash
|
|
111
136
|
run: |
|
|
112
137
|
# š” ALK0007 INFO: ALKiln will now hide docker output
|
|
113
|
-
|
|
138
|
+
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==="
|
|
139
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"
|
|
114
140
|
- name: "š” ALK0008 INFO: ALKiln will show docker output"
|
|
115
141
|
if: ${{ env.OUTPUT_DOCKER == 'true' }}
|
|
116
142
|
shell: bash
|
|
117
143
|
run: |
|
|
118
144
|
# š” ALK0008 INFO: ALKiln will show docker output
|
|
119
|
-
|
|
145
|
+
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==="
|
|
146
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"
|
|
120
147
|
|
|
121
148
|
# TODO: Reduce these to 1 block by putting ` > /dev/null 2>&1` into an env var
|
|
122
149
|
# No docker output
|
|
@@ -126,7 +153,8 @@ runs:
|
|
|
126
153
|
CONFIG_ARGS: ${{ env.CONFIG_ARGS }}
|
|
127
154
|
shell: bash
|
|
128
155
|
run: |
|
|
129
|
-
|
|
156
|
+
log="š” ALK0009 INFO: Download and start docker silently"
|
|
157
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
130
158
|
docker pull jhpyle/docassemble > /dev/null 2>&1
|
|
131
159
|
docker run --name docassemble_container \
|
|
132
160
|
--env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \
|
|
@@ -142,7 +170,8 @@ runs:
|
|
|
142
170
|
CONFIG_ARGS: ${{ env.CONFIG_ARGS }}
|
|
143
171
|
shell: bash
|
|
144
172
|
run: |
|
|
145
|
-
|
|
173
|
+
log="š” ALK0010 INFO: Download and start docker"
|
|
174
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
146
175
|
docker pull jhpyle/docassemble
|
|
147
176
|
docker run --name docassemble_container \
|
|
148
177
|
--env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \
|
|
@@ -159,12 +188,14 @@ runs:
|
|
|
159
188
|
shell: bash
|
|
160
189
|
run: |
|
|
161
190
|
# š” ALK0011 INFO: The following messages are not docker output
|
|
162
|
-
|
|
191
|
+
log="š” ALK0011 INFO: The following messages are NOT docker output, just ALKiln waiting for the server to start"
|
|
192
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"
|
|
163
193
|
|
|
164
194
|
- name: "š” ALK0012 INFO: Waiting for server to start"
|
|
165
195
|
shell: bash
|
|
166
196
|
run: |
|
|
167
|
-
|
|
197
|
+
log="š” ALK0012 INFO: Waiting for server to start"
|
|
198
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
168
199
|
|
|
169
200
|
# Reset the SECONDS variable
|
|
170
201
|
SECONDS=0
|
|
@@ -173,23 +204,28 @@ runs:
|
|
|
173
204
|
|
|
174
205
|
response="start"
|
|
175
206
|
while [[ $response != *"200"* ]]; do
|
|
176
|
-
|
|
207
|
+
log2="š” ALK0013 INFO: Time elapsed: $SECONDS seconds"
|
|
208
|
+
echo -e "\n$log2" >> "${{ env.DEBUG_PATH }}" && echo -e "$log2"
|
|
177
209
|
|
|
178
210
|
# Check if max seconds till loading has passed
|
|
179
211
|
if [[ $SECONDS -ge $MAX_SECONDS_FOR_DOCKER ]]; then
|
|
180
|
-
|
|
212
|
+
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."
|
|
213
|
+
echo -e "\n$log3" >> "${{ env.DEBUG_PATH }}" && echo -e "$log3"
|
|
181
214
|
exit 1
|
|
182
215
|
fi
|
|
183
216
|
|
|
184
217
|
# Set the variable to a new string value in each iteration
|
|
185
218
|
response=$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:80/health_check?ready=1)
|
|
186
|
-
|
|
219
|
+
log4="š” ALK0015 INFO: Response is $response"
|
|
220
|
+
echo -e "\n$log4" >> "${{ env.DEBUG_PATH }}" && echo -e "$log4"
|
|
187
221
|
|
|
188
222
|
# Check if the string includes the desired text
|
|
189
223
|
if [[ $response == *"200"* ]]; then
|
|
190
|
-
|
|
224
|
+
log5="š” ALK0016 SUCCESS: Success! The docker container is ready!"
|
|
225
|
+
echo -e "\n$log5" >> "${{ env.DEBUG_PATH }}" && echo -e "$log5"
|
|
191
226
|
else
|
|
192
|
-
|
|
227
|
+
log6="š” ALK0017 INFO: The docker container is not ready yet. Will check again in 30 seconds."
|
|
228
|
+
echo -e "\n$log6" >> "${{ env.DEBUG_PATH }}" && echo -e "$log6"
|
|
193
229
|
sleep 30
|
|
194
230
|
fi
|
|
195
231
|
|
|
@@ -219,32 +255,28 @@ runs:
|
|
|
219
255
|
|
|
220
256
|
# Upload artifacts that devs can download on the Actions summary page
|
|
221
257
|
# 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
258
|
- name: "š” ALK0019 INFO: Create docker artifact data"
|
|
230
259
|
if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
|
|
231
260
|
shell: bash
|
|
232
261
|
run: |
|
|
233
|
-
|
|
234
|
-
echo "$
|
|
262
|
+
log="š” ALK0019 INFO: Create docker artifact data"
|
|
263
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
264
|
+
echo "$(docker output docassemble_container)" >> "${{ env.DEBUG_PATH }}"
|
|
235
265
|
- name: "š” ALK0020 INFO: Upload artifacts folder"
|
|
236
266
|
if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
|
|
237
267
|
uses: actions/upload-artifact@v4
|
|
238
268
|
with:
|
|
239
269
|
name: ${{ env.GITHUB_SERVER_ARTIFACT_NAME }}
|
|
240
|
-
path: ${{ env.
|
|
270
|
+
path: ${{ env.DEBUG_PATH }}
|
|
241
271
|
|
|
242
272
|
- shell: bash
|
|
243
273
|
if: ${{ success() }}
|
|
244
274
|
run: |
|
|
245
|
-
|
|
275
|
+
log="š” ALK0021 SUCCESS: ALKiln created the docker container and started the server!"
|
|
276
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"
|
|
246
277
|
|
|
247
278
|
- shell: bash
|
|
248
279
|
if: ${{ failure() }}
|
|
249
280
|
run: |
|
|
250
|
-
|
|
281
|
+
log="š¤ ALK0022 ERROR: Something went wrong. See above for more details."
|
|
282
|
+
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"
|