@suffolklitlab/alkiln 5.5.0 → 5.6.0

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.
@@ -7,6 +7,12 @@ on:
7
7
  tags:
8
8
  required: False
9
9
  description: 'Optional. Use a "tag expression" specify which tagged tests to run (https://cucumber.io/docs/cucumber/api/#tag-expressions)'
10
+ show_docker_output:
11
+ required: false
12
+ default: false
13
+ type: boolean
14
+ description: 'Show the docker logs while building the GitHub server container. It will also save the docker log artifact. This might show sensitive config information.'
15
+ #### Developer note: You probably don't need this
10
16
  enable_tmate:
11
17
  type: boolean
12
18
  description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
@@ -30,24 +36,36 @@ jobs:
30
36
  # Place the root directory in this branch
31
37
  - uses: actions/checkout@v3
32
38
 
33
- - name: Run ALKiln - Start the temporary GitHub server
39
+ - name: ALKiln - Start the isolated temporary docassemble server on GitHub
34
40
  id: github_server
41
+ #### Developer note: you'll need to replace `.` with the path to
42
+ #### the repo and branch. For example:
43
+ #### suffolkLITLab/ALKiln@v5/action_for_github_server
35
44
  uses: ./action_for_github_server
36
45
  with:
37
46
  CONFIG_CONTENTS: "${{ secrets.CONFIG_CONTENTS }}"
47
+ #### Developer note: Set this to True to show docker logs and
48
+ #### allow ALKiln to create the docker logs output artifact.
49
+ SHOW_DOCKER_OUTPUT: "${{ github.event.inputs.show_docker_output }}"
38
50
  - run: echo "ALKiln finished starting the isolated GitHub docassemble server"
51
+ shell: bash
39
52
 
40
- # Debugging on failure to explore things like config issues
41
- - name: Run ALKiln - Docker failure tmate session
42
- if: ${{ failure() }}
53
+ #### Developer note: You probably don't need this
54
+ # Optional debugging to explore things like config issues
55
+ - name: Docker debug tmate session
56
+ if: ${{ github.event.inputs.enable_tmate }}
43
57
  uses: mxschmitt/action-tmate@v3
44
58
 
45
- - name: Run ALKiln - Env vars from server output
59
+ #### Developer note: You probably don't need this
60
+ - name: Run ALKiln - Env vars for our own tests from server output
46
61
  run: |
47
62
  echo "USER1_EMAIL=${{ steps.github_server.outputs.DA_ADMIN_EMAIL }}" >> $GITHUB_ENV
48
63
  echo "USER1_PASSWORD=${{ steps.github_server.outputs.DA_ADMIN_PASSWORD }}" >> $GITHUB_ENV
49
- ## Example of working with the docker container after it's been started
50
- ## For example, you can make more users with different permissions and passwords
64
+
65
+ #### Developer note:
66
+ #### Example of working with the docker container after it's been
67
+ #### started. For example, you can make more users with different
68
+ #### permissions and passwords
51
69
  #- name: Work with docker
52
70
  # run: |
53
71
  # container_name=$(docker ps --format '{{.Names}}' | head -n 1)
@@ -55,14 +73,17 @@ jobs:
55
73
 
56
74
  - name: "Run ALKiln tests"
57
75
  if: ${{ success() }}
76
+ #### Developer note: you'll need to replace `.` with the path to
77
+ #### the repo and branch and leave off the trailing `/`
78
+ #### For example suffolkLITLab/ALKiln@v5
58
79
  uses: ./
59
80
  with:
60
81
  SERVER_URL: "${{ steps.github_server.outputs.SERVER_URL }}"
61
82
  DOCASSEMBLE_DEVELOPER_API_KEY: "${{ steps.github_server.outputs.DOCASSEMBLE_DEVELOPER_API_KEY }}"
62
83
  INSTALL_METHOD: "server"
63
- # Temporary while in pre-release
64
- ALKILN_VERSION: "server"
65
- # Has been useful for development. Can remove when more stable.
66
- ALKILN_TAG_EXPRESSION: ""
84
+ #### Developer note: Useful for temporarily shortening ALKiln tests
85
+ #### to debug the docker install step
86
+ # ALKILN_TAG_EXPRESSION: @onetest
67
87
  - run: echo "ALkiln finished running ALKiln tests"
88
+ shell: bash
68
89
 
package/CHANGELOG.md CHANGED
@@ -45,6 +45,12 @@ Format:
45
45
 
46
46
  <!-- ## [Unreleased] -->
47
47
 
48
+ ## [5.6.0] - 2023-10-27
49
+
50
+ ### Changed
51
+
52
+ - For isolated GitHub server, only show GitHub action console logs when `SHOW_DOCKER_LOGS` input is set to `true`. Same for creating the docker logs GitHub artifact. See [#819](https://github.com/SuffolkLITLab/ALKiln/issues/819).
53
+
48
54
  ## [5.5.0] - 2023-10-27
49
55
 
50
56
  ### Added
@@ -13,19 +13,23 @@ description: "Download and start up a temporary docassemble server on GitHub's s
13
13
 
14
14
  inputs:
15
15
  CONFIG_CONTENTS:
16
- description: "The contents of the config file of the docassemble server"
16
+ description: "The contents of the config file of the docassemble server."
17
+ required: false
18
+ SHOW_DOCKER_OUTPUT:
19
+ description: 'Default is "false" to prevent docker from showing output in GitHub, like logs and artifacts. When set to "true", this will give you the docker output. It will be visible to those who can see the output, like people with admin or write permissions.'
20
+ default: false
17
21
  required: false
18
22
  MAX_SECONDS_FOR_DOCKER:
19
- description: "Maximum amount of seconds to give the docassemble docker container to serve the site."
23
+ description: "Default is 600 seconds. Maximum amount of seconds to give the docassemble docker container to serve the site."
20
24
  required: false
21
25
  default: 600 # 10 min
22
26
 
23
27
  outputs:
24
28
  DOCASSEMBLE_DEVELOPER_API_KEY:
25
- description: "Use this inside `with:` for the ALKiln step. Temporary admin api key. It will be destroyed after the tests are done."
29
+ description: 'Use this inside "with:" for the ALKiln step. Temporary admin api key. It will be destroyed after the tests are done.'
26
30
  value: ${{ steps.api_key_output_step.outputs.DOCASSEMBLE_DEVELOPER_API_KEY }}
27
31
  SERVER_URL:
28
- description: "Use this inside `with:` for the ALKiln step. URL of the temporary docassemble server."
32
+ description: 'Use this inside "with:" for the ALKiln step. URL of the temporary docassemble server.'
29
33
  value: "http://localhost"
30
34
  DA_ADMIN_EMAIL:
31
35
  value: ${{ steps.api_key_output_step.outputs.DA_ADMIN_EMAIL }}
@@ -38,7 +42,7 @@ runs:
38
42
  steps:
39
43
  - uses: actions/checkout@v3
40
44
 
41
- - name: "ALKiln github_server: Set environment variables"
45
+ - name: "ALKiln github_server - Set environment variables"
42
46
  run: |
43
47
  echo "DA_ADMIN_API_KEY=abcd1234abcd1234abcd5678abdc5678" >> $GITHUB_ENV
44
48
  echo "MAX_SECONDS_FOR_DOCKER=${{ inputs.MAX_SECONDS_FOR_DOCKER }}" >> $GITHUB_ENV
@@ -53,20 +57,72 @@ runs:
53
57
  echo "DA_ADMIN_PASSWORD=$DA_ADMIN_PASSWORD" >> "$GITHUB_OUTPUT"
54
58
  shell: bash
55
59
 
56
- - name: "ALKiln github_server: Download and start docker"
60
+ - name: "ALKiln github_server - Get config"
57
61
  run: |
62
+ # Info: config values
58
63
  mkdir /tmp/config
64
+ # Worth making this silent by defining a variable with > /dev/null...?
59
65
  if [ -n "${{ inputs.CONFIG_CONTENTS }}" ]
60
66
  then
61
- echo "ALKiln github_server: The developer did provided a custom docassemble config file as an input into this action."
67
+ echo "ALKiln github_server - The developer did provide a custom docassemble config file as an input into this action."
62
68
  echo "${{ inputs.CONFIG_CONTENTS }}" > /tmp/config/myconfig.yml
63
69
  echo "CONFIG_ARGS=--env DA_CONFIG=/tmp/config/myconfig.yml --volume /tmp/config:/tmp/config " >> $GITHUB_ENV
64
70
  else
65
- echo "ALKiln github_server: The developer did not provide a custom docassemble config file as an input into this action. Docassemble will use its default config."
71
+ echo "ALKiln github_server - The developer did NOT provide a custom docassemble config file as an input into this action. Docassemble will use its default config."
66
72
  echo "CONFIG_ARGS=" >> $GITHUB_ENV
67
73
  fi
68
74
  shell: bash
69
- - run: |
75
+
76
+ # GitHub masks secret values like the config, so we don't really
77
+ # need to stop that yet, but users may start using variables, so
78
+ # a question: If in future we allow variables instead of just secrets,
79
+ # should we let those be visible or prevent them along with the docker logs?
80
+
81
+ # Also, does this leave GitHub job environment output While just
82
+ # hiding the output from the job console?
83
+
84
+ # Define the var to prevent/show docker output
85
+ - name: Env var for showing docker output
86
+ run: |
87
+ # Info: Docker logs visibility decision
88
+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
89
+ echo "OUTPUT_DOCKER=${{ inputs.SHOW_DOCKER_OUTPUT }}" >> $GITHUB_ENV
90
+ else
91
+ echo "OUTPUT_DOCKER=false" >> $GITHUB_ENV
92
+ fi
93
+ shell: bash
94
+
95
+ # Messages about output
96
+ - if: ${{ env.OUTPUT_DOCKER == 'false' }}
97
+ run: |
98
+ # Info: no output
99
+ printf '===\nALKiln github_server - GitHub will now stop showing 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==='
100
+ shell: bash
101
+ - if: ${{ env.OUTPUT_DOCKER == 'true' }}
102
+ run: |
103
+ # Info: show output
104
+ printf '===\nALKiln github_server - GitHub will now show the output of docker creation. 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==='
105
+ shell: bash
106
+
107
+ # No output
108
+ - name: "ALKiln github_server - Download and start docker silently"
109
+ if: ${{ env.OUTPUT_DOCKER == 'false' }}
110
+ run: |
111
+ # Info: Silent docker pull/run
112
+ docker pull jhpyle/docassemble > /dev/null 2>&1
113
+ docker run --name docassemble_container \
114
+ --env DA_ADMIN_EMAIL="${{ env.DA_ADMIN_EMAIL }}" \
115
+ --env DA_ADMIN_PASSWORD="${{ env.DA_ADMIN_PASSWORD }}" \
116
+ --env DA_ADMIN_API_KEY="${{ env.DA_ADMIN_API_KEY }}" \
117
+ ${{ env.CONFIG_ARGS }} \
118
+ --cap-add SYS_PTRACE \
119
+ --memory="4gb" -d -p 80:80 jhpyle/docassemble > /dev/null 2>&1
120
+ shell: bash
121
+ # With output
122
+ - name: "ALKiln github_server - Download and start docker"
123
+ if: ${{ env.OUTPUT_DOCKER == 'true' }}
124
+ run: |
125
+ # Info: Docker pull/run
70
126
  docker pull jhpyle/docassemble
71
127
  docker run --name docassemble_container \
72
128
  --env DA_ADMIN_EMAIL="${{ env.DA_ADMIN_EMAIL }}" \
@@ -76,9 +132,17 @@ runs:
76
132
  --cap-add SYS_PTRACE \
77
133
  --memory="4gb" -d -p 80:80 jhpyle/docassemble
78
134
  shell: bash
79
- - name: "ALKiln github_server: Wait for server to start"
135
+
136
+ # Show the time it takes to start the server.
137
+ - if: ${{ env.OUTPUT_DOCKER == 'false' }}
80
138
  run: |
81
- # ALKiln github_server: Wait for server to start
139
+ # Info: temporary visible logs
140
+ echo "ALKiln github_server - ALKiln will show safe ALKiln-only output temporarily as ALKiln waits for the server to start"
141
+ shell: bash
142
+
143
+ - name: "ALKiln github_server - Wait for server to start"
144
+ run: |
145
+ # ALKiln github_server - Wait for server to start
82
146
 
83
147
  # Reset the SECONDS variable
84
148
  SECONDS=0
@@ -86,9 +150,8 @@ runs:
86
150
  sleep 60
87
151
 
88
152
  response="start"
89
-
90
153
  while [[ $response != *"200"* ]]; do
91
- echo "ALKiln github_server: Time elapsed: $SECONDS seconds"
154
+ echo "ALKiln github_server - Time elapsed: $SECONDS seconds"
92
155
 
93
156
  # Check if max seconds till loading has passed
94
157
  if [[ $SECONDS -ge $MAX_SECONDS_FOR_DOCKER ]]; then
@@ -98,44 +161,71 @@ runs:
98
161
 
99
162
  # Set the variable to a new string value in each iteration
100
163
  response=$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:80/health_check?ready=1)
101
- echo "ALKiln github_server: response is $response"
164
+ echo "ALKiln github_server - response is $response"
102
165
 
103
166
  # Check if the string includes the desired text
104
167
  if [[ $response == *"200"* ]]; then
105
- echo "ALKiln github_server: Success! The docker container is ready!"
168
+ echo "ALKiln github_server - Success! The docker container is ready!"
106
169
  else
107
- echo "ALKiln github_server: The docker container isn't ready yet. Will check again in 30 seconds."
170
+ echo "ALKiln github_server - The docker container is not ready yet. Will check again in 30 seconds."
108
171
  sleep 30
109
172
  fi
110
173
 
111
174
  done
112
175
  shell: bash
113
176
 
177
+ # Output visibility message
178
+ - name: Message about docassemble install output
179
+ if: ${{ env.OUTPUT_DOCKER == 'false' }}
180
+ run: |
181
+ # Info: Silent install message
182
+ echo "ALKiln github_server - ALKiln will now prevent output again"
183
+ shell: bash
184
+
114
185
  # Don't rely on the environment's version of python
115
186
  - uses: actions/setup-python@v4
116
187
  with:
117
188
  python-version: '3.10'
189
+ # No output
190
+ - run: pip install docassemblecli > /dev/null 2>&1
191
+ if: ${{ env.OUTPUT_DOCKER == 'false' }}
192
+ shell: bash
193
+ # Install the package, the current directory (.), onto the docassemble server
194
+ - run: dainstall . --apiurl http://localhost --apikey $DA_ADMIN_API_KEY > /dev/null 2>&1
195
+ if: ${{ env.OUTPUT_DOCKER == 'false' }}
196
+ shell: bash
197
+
198
+ # With output
118
199
  - run: pip install docassemblecli
200
+ if: ${{ env.OUTPUT_DOCKER == 'true' }}
119
201
  shell: bash
120
- # Install the current directory onto the docassemble server
202
+ # Install the package, the current directory (.), onto the docassemble server
121
203
  - run: dainstall . --apiurl http://localhost --apikey $DA_ADMIN_API_KEY
204
+ if: ${{ env.OUTPUT_DOCKER == 'true' }}
122
205
  shell: bash
123
206
 
124
- # Upload artifacts that subscribers can download on the Actions summary page
125
- - name: "ALKiln github_server: Get path names with date and time"
126
- if: ${{ always() }}
207
+ # Upload artifacts that devs can download on the Actions summary page
208
+ # Only if the developer wants to get that info, though
209
+ - name: "ALKiln github_server - Get path names with date and time"
210
+ if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
127
211
  run: |
128
212
  echo "GITHUB_SERVER_LOG_FILE_NAME=/tmp/alkiln_docker_logs-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC.txt" >> $GITHUB_ENV
129
213
  echo "GITHUB_SERVER_ARTIFACT_NAME=alkiln_github_server-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
130
214
  shell: bash
131
- - name: "ALKiln github_server: Docker logs"
132
- if: ${{ always() }}
215
+ - name: "ALKiln github_server - Docker output"
216
+ if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
133
217
  run: |
134
- echo "$(docker logs docassemble_container)" > "${{ env.GITHUB_SERVER_LOG_FILE_NAME }}"
218
+ echo "$(docker output docassemble_container)" > "${{ env.GITHUB_SERVER_LOG_FILE_NAME }}"
135
219
  shell: bash
136
- - name: "ALKiln github_server: Upload artifacts folder"
137
- if: ${{ always() }}
220
+ - name: "ALKiln github_server - Upload artifacts folder"
221
+ if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
138
222
  uses: actions/upload-artifact@v3
139
223
  with:
140
224
  name: ${{ env.GITHUB_SERVER_ARTIFACT_NAME }}
141
225
  path: ${{ env.GITHUB_SERVER_LOG_FILE_NAME }}
226
+
227
+ - run: |
228
+ # Info: End silent output
229
+ echo "ALKiln github_server - ALKiln will show output again"
230
+ if: ${{ always() && env.OUTPUT_DOCKER == 'false' }}
231
+ shell: bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suffolklitlab/alkiln",
3
- "version": "5.5.0",
3
+ "version": "5.6.0",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {