@suffolklitlab/alkiln 5.5.0 → 5.7.0-feature-tap1
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 +37 -14
- package/.github/workflows/playground.yml +58 -0
- package/.github/workflows/unit_tests.yml +35 -0
- package/CHANGELOG.md +18 -0
- package/action.yml +32 -14
- package/action_for_github_server/action.yml +124 -27
- package/lib/docassemble/docassemble_api_REST.js +3 -81
- package/lib/docassemble/docassemble_api_interface.js +3 -280
- package/lib/docassemble/server_install.js +2 -0
- package/lib/docassemble/setup.js +45 -35
- package/lib/scope.js +81 -70
- package/lib/steps.js +25 -13
- package/lib/utils/session_vars.js +1 -3
- package/package.json +1 -1
- package/.github/workflows/test_tests.yml +0 -73
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
name: GitHub server
|
|
1
|
+
name: GitHub server installation
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
+
# Default opened, reopened, synchronize. "edited" is something else.
|
|
6
|
+
pull_request_target:
|
|
5
7
|
workflow_dispatch:
|
|
6
8
|
inputs:
|
|
7
9
|
tags:
|
|
8
10
|
required: False
|
|
9
11
|
description: 'Optional. Use a "tag expression" specify which tagged tests to run (https://cucumber.io/docs/cucumber/api/#tag-expressions)'
|
|
12
|
+
show_docker_output:
|
|
13
|
+
required: false
|
|
14
|
+
default: false
|
|
15
|
+
type: boolean
|
|
16
|
+
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.'
|
|
17
|
+
#### Developer note: You probably don't need this
|
|
10
18
|
enable_tmate:
|
|
11
19
|
type: boolean
|
|
12
20
|
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
|
|
@@ -27,27 +35,41 @@ jobs:
|
|
|
27
35
|
SECRET_FOR_MISSING_FIELD: secret for missing field
|
|
28
36
|
|
|
29
37
|
steps:
|
|
30
|
-
|
|
38
|
+
#### Developer note: You probably don't need this
|
|
39
|
+
# Place the root directory in this branch to access
|
|
40
|
+
# relative paths to action files
|
|
31
41
|
- uses: actions/checkout@v3
|
|
32
42
|
|
|
33
|
-
- name:
|
|
43
|
+
- name: ALKiln - Start the isolated temporary docassemble server on GitHub
|
|
34
44
|
id: github_server
|
|
45
|
+
#### Developer note: you'll need to replace `.` with the path to
|
|
46
|
+
#### the repo and branch. For example:
|
|
47
|
+
#### suffolkLITLab/ALKiln@v5/action_for_github_server
|
|
35
48
|
uses: ./action_for_github_server
|
|
36
49
|
with:
|
|
37
50
|
CONFIG_CONTENTS: "${{ secrets.CONFIG_CONTENTS }}"
|
|
51
|
+
#### Developer note: Set this to True to show docker logs and
|
|
52
|
+
#### allow ALKiln to create the docker logs output artifact.
|
|
53
|
+
SHOW_DOCKER_OUTPUT: "${{ github.event.inputs.show_docker_output }}"
|
|
38
54
|
- run: echo "ALKiln finished starting the isolated GitHub docassemble server"
|
|
55
|
+
shell: bash
|
|
39
56
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
57
|
+
#### Developer note: You probably don't need this
|
|
58
|
+
# Optional debugging to explore things like config issues
|
|
59
|
+
- name: Docker debug tmate session
|
|
60
|
+
if: ${{ github.event.inputs.enable_tmate }}
|
|
43
61
|
uses: mxschmitt/action-tmate@v3
|
|
44
62
|
|
|
45
|
-
|
|
63
|
+
#### Developer note: You probably don't need this
|
|
64
|
+
- name: Run ALKiln - Env vars for our own tests from server output
|
|
46
65
|
run: |
|
|
47
66
|
echo "USER1_EMAIL=${{ steps.github_server.outputs.DA_ADMIN_EMAIL }}" >> $GITHUB_ENV
|
|
48
67
|
echo "USER1_PASSWORD=${{ steps.github_server.outputs.DA_ADMIN_PASSWORD }}" >> $GITHUB_ENV
|
|
49
|
-
|
|
50
|
-
|
|
68
|
+
|
|
69
|
+
#### Developer note:
|
|
70
|
+
#### Example of working with the docker container after it's been
|
|
71
|
+
#### started. For example, you can make more users with different
|
|
72
|
+
#### permissions and passwords
|
|
51
73
|
#- name: Work with docker
|
|
52
74
|
# run: |
|
|
53
75
|
# container_name=$(docker ps --format '{{.Names}}' | head -n 1)
|
|
@@ -55,14 +77,15 @@ jobs:
|
|
|
55
77
|
|
|
56
78
|
- name: "Run ALKiln tests"
|
|
57
79
|
if: ${{ success() }}
|
|
80
|
+
#### Developer note: you'll need to replace `.` with the path to
|
|
81
|
+
#### the repo and branch and leave off the trailing `/`
|
|
82
|
+
#### For example suffolkLITLab/ALKiln@v5
|
|
58
83
|
uses: ./
|
|
59
84
|
with:
|
|
60
85
|
SERVER_URL: "${{ steps.github_server.outputs.SERVER_URL }}"
|
|
61
86
|
DOCASSEMBLE_DEVELOPER_API_KEY: "${{ steps.github_server.outputs.DOCASSEMBLE_DEVELOPER_API_KEY }}"
|
|
62
87
|
INSTALL_METHOD: "server"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
#
|
|
66
|
-
ALKILN_TAG_EXPRESSION: ""
|
|
67
|
-
- run: echo "ALkiln finished running ALKiln tests"
|
|
88
|
+
#### Developer note: Useful for temporarily shortening ALKiln tests
|
|
89
|
+
#### to debug the docker install step
|
|
90
|
+
# ALKILN_TAG_EXPRESSION: @a_tag_expression
|
|
68
91
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
name: Playground installation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
# Default: opened, reopened, synchronize. "edited" is not what we want.
|
|
6
|
+
pull_request_target:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
tags:
|
|
10
|
+
required: False
|
|
11
|
+
description: 'Optional. Use a "tag expression" specify which tagged tests to run (https://cucumber.io/docs/cucumber/api/#tag-expressions)'
|
|
12
|
+
default: ''
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
|
|
16
|
+
puppeteer-tests:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
|
|
19
|
+
strategy:
|
|
20
|
+
matrix:
|
|
21
|
+
node-version: [18.x]
|
|
22
|
+
|
|
23
|
+
env:
|
|
24
|
+
#### Developer note: Required
|
|
25
|
+
SERVER_URL: ${{ secrets.SERVER_URL }}
|
|
26
|
+
DOCASSEMBLE_DEVELOPER_API_KEY: ${{ secrets.DOCASSEMBLE_DEVELOPER_API_KEY }}
|
|
27
|
+
#### Developer note: you don't need any of these
|
|
28
|
+
# Specific to our repo's tests
|
|
29
|
+
PLAYGROUND_EMAIL: ${{ secrets.PLAYGROUND_EMAIL }}
|
|
30
|
+
PLAYGROUND_PASSWORD: ${{ secrets.PLAYGROUND_PASSWORD }}
|
|
31
|
+
PLAYGROUND_ID: ${{ secrets.PLAYGROUND_ID }}
|
|
32
|
+
USER1_EMAIL: ${{ secrets.USER1_EMAIL }}
|
|
33
|
+
USER1_PASSWORD: ${{ secrets.USER1_PASSWORD }}
|
|
34
|
+
SECRET_VAR1: secret-var1-value
|
|
35
|
+
SECRET_VAR2: secret-var2-value
|
|
36
|
+
SECRET_FOR_MISSING_FIELD: secret for missing field
|
|
37
|
+
# Internal
|
|
38
|
+
_ORIGIN: github
|
|
39
|
+
|
|
40
|
+
name: Run ALKiln tests
|
|
41
|
+
steps:
|
|
42
|
+
#### Developer note: You probably don't need this
|
|
43
|
+
# Place the root directory in this branch to access
|
|
44
|
+
# relative paths to action files
|
|
45
|
+
- uses: actions/checkout@v3
|
|
46
|
+
|
|
47
|
+
#### Developer note: you'll need to replace `.` with the path to
|
|
48
|
+
#### the repo and branch and leave off the trailing `/`
|
|
49
|
+
#### For example suffolkLITLab/ALKiln@v5
|
|
50
|
+
- uses: ./
|
|
51
|
+
with:
|
|
52
|
+
SERVER_URL: "${{ env.SERVER_URL }}"
|
|
53
|
+
DOCASSEMBLE_DEVELOPER_API_KEY: "${{ env.DOCASSEMBLE_DEVELOPER_API_KEY }}"
|
|
54
|
+
#### Developer note: Useful for temporarily shortening ALKiln tests
|
|
55
|
+
#### to debug the docker install step
|
|
56
|
+
# ALKILN_TAG_EXPRESSION: @a_tag_expression
|
|
57
|
+
#### Developer note: you probalby don't need this
|
|
58
|
+
ALKILN_VERSION: 5.7.0-feature-tap1
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Unit tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
|
|
9
|
+
unit-tests:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
node-version: [18.x]
|
|
15
|
+
|
|
16
|
+
name: Run unit tests
|
|
17
|
+
steps:
|
|
18
|
+
- name: Set name of artifact folder with date and UTC time
|
|
19
|
+
# https://www.shell-tips.com/linux/how-to-format-date-and-time-in-linux-macos-and-bash/#how-to-format-a-date-in-bash
|
|
20
|
+
run: |
|
|
21
|
+
echo "UNIT_TESTS_ARTIFACT_NAME=_alkiln-misc-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
|
|
22
|
+
- uses: actions/checkout@v3
|
|
23
|
+
- uses: actions/setup-node@v3
|
|
24
|
+
with:
|
|
25
|
+
node-version: ${{ matrix.node-version }}
|
|
26
|
+
- run: npm install
|
|
27
|
+
- run: npm run unit
|
|
28
|
+
# Artifacts
|
|
29
|
+
- name: upload unit tests artifacts folder
|
|
30
|
+
uses: actions/upload-artifact@v3
|
|
31
|
+
# This will upload even if a previous step has failed
|
|
32
|
+
if: ${{ always() }}
|
|
33
|
+
with:
|
|
34
|
+
name: ${{ env.UNIT_TESTS_ARTIFACT_NAME }}
|
|
35
|
+
path: ./_alkiln-*
|
package/CHANGELOG.md
CHANGED
|
@@ -45,6 +45,24 @@ Format:
|
|
|
45
45
|
|
|
46
46
|
<!-- ## [Unreleased] -->
|
|
47
47
|
|
|
48
|
+
## [5.7.0] - 2023-11-14
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
- Allow tests to run when a PR is made by switching to docassemblecli's `dainstall` to upload packagese to the Playground. See [#760](https://github.com/SuffolkLITLab/ALKiln/issues/760).
|
|
52
|
+
|
|
53
|
+
### Internal
|
|
54
|
+
- Workflows:
|
|
55
|
+
- Split unit tests into their own file. They have to use `npm install` in our repo and we don't want to use that for Playground tests. It avoids trying to push all the node modules to the Playground which would otherwise cause error 413 "too large".
|
|
56
|
+
- Use our own action in the tests that install on the Playground, to avoid duplicating edits to the action - see [#822](https://github.com/SuffolkLITLab/ALKiln/issues/822).
|
|
57
|
+
- Rename files
|
|
58
|
+
- Also see [#822](https://github.com/SuffolkLITLab/ALKiln/issues/822)
|
|
59
|
+
|
|
60
|
+
## [5.6.0] - 2023-10-27
|
|
61
|
+
|
|
62
|
+
### Changed
|
|
63
|
+
|
|
64
|
+
- 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).
|
|
65
|
+
|
|
48
66
|
## [5.5.0] - 2023-10-27
|
|
49
67
|
|
|
50
68
|
### Added
|
package/action.yml
CHANGED
|
@@ -35,11 +35,15 @@ inputs:
|
|
|
35
35
|
runs:
|
|
36
36
|
using: "composite"
|
|
37
37
|
steps:
|
|
38
|
+
# Place the root directory in this branch
|
|
39
|
+
- uses: actions/checkout@v3
|
|
40
|
+
|
|
38
41
|
# Set environment variables
|
|
39
|
-
- name: "ALKiln: Set environment variables"
|
|
42
|
+
- name: "ALKiln setup info: Set environment variables"
|
|
40
43
|
# Human-readable date/time:
|
|
41
44
|
# https://www.shell-tips.com/linux/how-to-format-date-and-time-in-linux-macos-and-bash/#how-to-format-a-date-in-bash
|
|
42
45
|
run: |
|
|
46
|
+
# ALKiln setup info: Set environment variables
|
|
43
47
|
echo "ARTIFACT_NAME=alkiln-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
|
|
44
48
|
echo "REPO_URL=${{ github.server_url }}/${{ github.repository }}" >> $GITHUB_ENV
|
|
45
49
|
echo "BRANCH_PATH=${{ github.ref }}" >> $GITHUB_ENV
|
|
@@ -50,59 +54,75 @@ runs:
|
|
|
50
54
|
echo "SERVER_RELOAD_TIMEOUT_SECONDS=${{ inputs.SERVER_RELOAD_TIMEOUT_SECONDS }}" >> $GITHUB_ENV
|
|
51
55
|
echo "_ORIGIN=github" >> $GITHUB_ENV
|
|
52
56
|
shell: bash
|
|
53
|
-
- name: "ALKiln: confirm
|
|
57
|
+
- name: "ALKiln setup info: confirm environment variables"
|
|
54
58
|
run: |
|
|
59
|
+
# ALKiln setup info: confirm environment variables
|
|
55
60
|
echo -e "\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"
|
|
56
61
|
shell: bash
|
|
57
62
|
|
|
58
63
|
# Install
|
|
59
|
-
- name: "ALKiln: Install node packages"
|
|
64
|
+
- name: "ALKiln setup info: Install node packages"
|
|
60
65
|
uses: actions/setup-node@v3
|
|
61
66
|
with:
|
|
62
67
|
node-version: "18"
|
|
63
68
|
- name: Install ALKiln directly from npm
|
|
64
69
|
run: |
|
|
70
|
+
# ALKiln setup info: Install ALKiln directly from npm
|
|
65
71
|
npm install -g @suffolklitlab/alkiln@$ALKILN_VERSION
|
|
66
72
|
shell: bash
|
|
67
73
|
|
|
68
74
|
# Install on playground
|
|
69
|
-
|
|
75
|
+
|
|
76
|
+
# Don't rely on the environment's version of python
|
|
77
|
+
- uses: actions/setup-python@v4
|
|
78
|
+
if: ${{ inputs.INSTALL_METHOD == 'playground' }}
|
|
79
|
+
with:
|
|
80
|
+
python-version: '3.10'
|
|
81
|
+
- name: "ALKiln: Create a Project and install the package from GitHub"
|
|
70
82
|
if: ${{ inputs.INSTALL_METHOD == 'playground' }}
|
|
71
|
-
run:
|
|
83
|
+
run: |
|
|
84
|
+
# ALKiln setup info: Create a Project and install the package from GitHub
|
|
85
|
+
pip3 install docassemblecli
|
|
86
|
+
alkiln-setup
|
|
72
87
|
shell: bash
|
|
73
|
-
-
|
|
88
|
+
- name: "ALKiln setup ERROR"
|
|
89
|
+
run: echo -e "\n\n====\nALKiln ERROR - could not create a project on your server's testing account or pull your package into it. Check the messages above this line.\n\n"
|
|
74
90
|
if: ${{ inputs.INSTALL_METHOD == 'playground' && failure() }}
|
|
75
91
|
shell: bash
|
|
76
92
|
|
|
77
|
-
#
|
|
78
|
-
- name: "ALKiln: Install the GitHub package onto the server"
|
|
93
|
+
# Server installations - find folders and save session vars
|
|
94
|
+
- name: "ALKiln setup info: Install the GitHub package onto the server"
|
|
79
95
|
if: ${{ inputs.INSTALL_METHOD == 'server' }}
|
|
80
96
|
run: alkiln-server-install
|
|
81
97
|
shell: bash
|
|
82
|
-
-
|
|
98
|
+
- name: "ALKiln setup ERROR"
|
|
99
|
+
run: echo -e "\n\n====\nALKiln ERROR - could not install the package on the temporary GitHub docassemble server. Check the steps above this line.\n\n"
|
|
83
100
|
if: ${{ inputs.INSTALL_METHOD == 'server' && failure() }}
|
|
84
101
|
shell: bash
|
|
85
102
|
|
|
86
103
|
# run tests
|
|
87
|
-
- name: "ALKiln: Run tests"
|
|
104
|
+
- name: "ALKiln info: Run tests"
|
|
88
105
|
if: ${{ success() }}
|
|
89
106
|
run: alkiln-run ${{ inputs.ALKILN_TAG_EXPRESSION || github.event.inputs.tags && format('{0}', github.event.inputs.tags) }}
|
|
90
107
|
shell: bash
|
|
91
108
|
|
|
92
109
|
# on playground, delete project
|
|
93
|
-
- name: "ALKiln: Try to delete the project from the playground of the docassemble test account."
|
|
110
|
+
- name: "ALKiln info: Try to delete the project from the playground of the docassemble test account."
|
|
94
111
|
if: ${{ inputs.INSTALL_METHOD == 'playground' }}
|
|
95
112
|
run: alkiln-takedown
|
|
96
113
|
shell: bash
|
|
97
114
|
|
|
98
115
|
# Upload artifacts that subscribers can download on the Actions summary page
|
|
99
|
-
- name: "ALKiln: Upload artifacts folder"
|
|
116
|
+
- name: "ALKiln info: Upload artifacts folder"
|
|
100
117
|
if: ${{ always() }}
|
|
101
118
|
uses: actions/upload-artifact@v3
|
|
102
119
|
with:
|
|
103
120
|
name: ${{ env.ARTIFACT_NAME }}
|
|
104
121
|
path: ./alkiln-*
|
|
105
122
|
|
|
123
|
+
- run: echo "ALkiln finished running tests"
|
|
124
|
+
shell: bash
|
|
125
|
+
|
|
106
126
|
# ##################################
|
|
107
127
|
# # A developer's workflow should look similar to the below.
|
|
108
128
|
# # In place of `uses: suffolkLITLab/ALKiln@v5`, they
|
|
@@ -123,10 +143,8 @@ runs:
|
|
|
123
143
|
# runs-on: ubuntu-latest
|
|
124
144
|
# name: Run interview tests
|
|
125
145
|
# steps:
|
|
126
|
-
# - uses: actions/checkout@v3
|
|
127
146
|
# - name: Use ALKiln to run tests
|
|
128
147
|
# uses: suffolkLITLab/ALKiln@v5
|
|
129
148
|
# with:
|
|
130
149
|
# SERVER_URL: "${{ secrets.SERVER_URL }}"
|
|
131
150
|
# DOCASSEMBLE_DEVELOPER_API_KEY: "${{ secrets.DOCASSEMBLE_DEVELOPER_API_KEY }}"
|
|
132
|
-
# - run: echo "Finished running ALKiln tests"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name: "ALKiln
|
|
1
|
+
name: "ALKiln isolated GitHub docassemble server tests"
|
|
2
2
|
description: "Download and start up a temporary docassemble server on GitHub's servers, in an isolated environment. Avoids docassemble reload errors and other external factors."
|
|
3
3
|
|
|
4
4
|
# If we want to control the version of the docassemble image, we'd have
|
|
@@ -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:
|
|
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:
|
|
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 }}
|
|
@@ -36,9 +40,10 @@ outputs:
|
|
|
36
40
|
runs:
|
|
37
41
|
using: "composite"
|
|
38
42
|
steps:
|
|
43
|
+
# Place the root directory in this branch
|
|
39
44
|
- uses: actions/checkout@v3
|
|
40
45
|
|
|
41
|
-
- name: "ALKiln
|
|
46
|
+
- name: "ALKiln GitHub server - Set environment variables"
|
|
42
47
|
run: |
|
|
43
48
|
echo "DA_ADMIN_API_KEY=abcd1234abcd1234abcd5678abdc5678" >> $GITHUB_ENV
|
|
44
49
|
echo "MAX_SECONDS_FOR_DOCKER=${{ inputs.MAX_SECONDS_FOR_DOCKER }}" >> $GITHUB_ENV
|
|
@@ -53,20 +58,72 @@ runs:
|
|
|
53
58
|
echo "DA_ADMIN_PASSWORD=$DA_ADMIN_PASSWORD" >> "$GITHUB_OUTPUT"
|
|
54
59
|
shell: bash
|
|
55
60
|
|
|
56
|
-
- name: "ALKiln
|
|
61
|
+
- name: "ALKiln GitHub server - Get config"
|
|
57
62
|
run: |
|
|
63
|
+
# ALKiln GitHub server info: config values
|
|
58
64
|
mkdir /tmp/config
|
|
65
|
+
# Worth making this silent by defining a variable with > /dev/null...?
|
|
59
66
|
if [ -n "${{ inputs.CONFIG_CONTENTS }}" ]
|
|
60
67
|
then
|
|
61
|
-
echo "ALKiln
|
|
68
|
+
echo "ALKiln GitHub server - The developer did provide a custom docassemble config file as an input into this action."
|
|
62
69
|
echo "${{ inputs.CONFIG_CONTENTS }}" > /tmp/config/myconfig.yml
|
|
63
70
|
echo "CONFIG_ARGS=--env DA_CONFIG=/tmp/config/myconfig.yml --volume /tmp/config:/tmp/config " >> $GITHUB_ENV
|
|
64
71
|
else
|
|
65
|
-
echo "ALKiln
|
|
72
|
+
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
73
|
echo "CONFIG_ARGS=" >> $GITHUB_ENV
|
|
67
74
|
fi
|
|
68
75
|
shell: bash
|
|
69
|
-
|
|
76
|
+
|
|
77
|
+
# GitHub masks secret values like the config, so we don't really
|
|
78
|
+
# need to stop that yet, but users may start using variables, so
|
|
79
|
+
# a question: If in future we allow variables instead of just secrets,
|
|
80
|
+
# should we let those be visible or prevent them along with the docker logs?
|
|
81
|
+
|
|
82
|
+
# Also, does this leave GitHub job environment output While just
|
|
83
|
+
# hiding the output from the job console?
|
|
84
|
+
|
|
85
|
+
# Define the var to prevent/show docker output
|
|
86
|
+
- name: Env var for showing docker output
|
|
87
|
+
run: |
|
|
88
|
+
# ALKiln GitHub server info: Docker logs visibility decision
|
|
89
|
+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
|
90
|
+
echo "OUTPUT_DOCKER=${{ inputs.SHOW_DOCKER_OUTPUT }}" >> $GITHUB_ENV
|
|
91
|
+
else
|
|
92
|
+
echo "OUTPUT_DOCKER=false" >> $GITHUB_ENV
|
|
93
|
+
fi
|
|
94
|
+
shell: bash
|
|
95
|
+
|
|
96
|
+
# Messages about output
|
|
97
|
+
- if: ${{ env.OUTPUT_DOCKER == 'false' }}
|
|
98
|
+
run: |
|
|
99
|
+
# ALKiln GitHub server info: no output
|
|
100
|
+
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==='
|
|
101
|
+
shell: bash
|
|
102
|
+
- if: ${{ env.OUTPUT_DOCKER == 'true' }}
|
|
103
|
+
run: |
|
|
104
|
+
# ALKiln GitHub server info: show output
|
|
105
|
+
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==='
|
|
106
|
+
shell: bash
|
|
107
|
+
|
|
108
|
+
# No output
|
|
109
|
+
- name: "ALKiln GitHub server - Download and start docker silently"
|
|
110
|
+
if: ${{ env.OUTPUT_DOCKER == 'false' }}
|
|
111
|
+
run: |
|
|
112
|
+
# ALKiln GitHub server info: Silent docker pull/run
|
|
113
|
+
docker pull jhpyle/docassemble > /dev/null 2>&1
|
|
114
|
+
docker run --name docassemble_container \
|
|
115
|
+
--env DA_ADMIN_EMAIL="${{ env.DA_ADMIN_EMAIL }}" \
|
|
116
|
+
--env DA_ADMIN_PASSWORD="${{ env.DA_ADMIN_PASSWORD }}" \
|
|
117
|
+
--env DA_ADMIN_API_KEY="${{ env.DA_ADMIN_API_KEY }}" \
|
|
118
|
+
${{ env.CONFIG_ARGS }} \
|
|
119
|
+
--cap-add SYS_PTRACE \
|
|
120
|
+
--memory="4gb" -d -p 80:80 jhpyle/docassemble > /dev/null 2>&1
|
|
121
|
+
shell: bash
|
|
122
|
+
# With output
|
|
123
|
+
- name: "ALKiln GitHub server - Download and start docker"
|
|
124
|
+
if: ${{ env.OUTPUT_DOCKER == 'true' }}
|
|
125
|
+
run: |
|
|
126
|
+
# ALKiln GitHub server info: Docker pull/run
|
|
70
127
|
docker pull jhpyle/docassemble
|
|
71
128
|
docker run --name docassemble_container \
|
|
72
129
|
--env DA_ADMIN_EMAIL="${{ env.DA_ADMIN_EMAIL }}" \
|
|
@@ -76,9 +133,17 @@ runs:
|
|
|
76
133
|
--cap-add SYS_PTRACE \
|
|
77
134
|
--memory="4gb" -d -p 80:80 jhpyle/docassemble
|
|
78
135
|
shell: bash
|
|
79
|
-
|
|
136
|
+
|
|
137
|
+
# Show the time it takes to start the server.
|
|
138
|
+
- if: ${{ env.OUTPUT_DOCKER == 'false' }}
|
|
139
|
+
run: |
|
|
140
|
+
# ALKiln GitHub server info: temporary visible logs
|
|
141
|
+
echo "ALKiln GitHub server - ALKiln will show safe ALKiln-only output temporarily as ALKiln waits for the server to start"
|
|
142
|
+
shell: bash
|
|
143
|
+
|
|
144
|
+
- name: "ALKiln GitHub server - Wait for server to start"
|
|
80
145
|
run: |
|
|
81
|
-
# ALKiln
|
|
146
|
+
# ALKiln GitHub server - Wait for server to start
|
|
82
147
|
|
|
83
148
|
# Reset the SECONDS variable
|
|
84
149
|
SECONDS=0
|
|
@@ -86,56 +151,88 @@ runs:
|
|
|
86
151
|
sleep 60
|
|
87
152
|
|
|
88
153
|
response="start"
|
|
89
|
-
|
|
90
154
|
while [[ $response != *"200"* ]]; do
|
|
91
|
-
echo "ALKiln
|
|
155
|
+
echo "ALKiln GitHub server - Time elapsed: $SECONDS seconds"
|
|
92
156
|
|
|
93
157
|
# Check if max seconds till loading has passed
|
|
94
158
|
if [[ $SECONDS -ge $MAX_SECONDS_FOR_DOCKER ]]; then
|
|
95
|
-
echo "ALKiln
|
|
159
|
+
echo "ALKiln GitHub server 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."
|
|
96
160
|
exit 1
|
|
97
161
|
fi
|
|
98
162
|
|
|
99
163
|
# Set the variable to a new string value in each iteration
|
|
100
164
|
response=$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:80/health_check?ready=1)
|
|
101
|
-
echo "ALKiln
|
|
165
|
+
echo "ALKiln GitHub server - response is $response"
|
|
102
166
|
|
|
103
167
|
# Check if the string includes the desired text
|
|
104
168
|
if [[ $response == *"200"* ]]; then
|
|
105
|
-
echo "ALKiln
|
|
169
|
+
echo "ALKiln GitHub server - Success! The docker container is ready!"
|
|
106
170
|
else
|
|
107
|
-
echo "ALKiln
|
|
171
|
+
echo "ALKiln GitHub server - The docker container is not ready yet. Will check again in 30 seconds."
|
|
108
172
|
sleep 30
|
|
109
173
|
fi
|
|
110
174
|
|
|
111
175
|
done
|
|
112
176
|
shell: bash
|
|
113
177
|
|
|
178
|
+
# Output visibility message
|
|
179
|
+
- name: Message about docassemble install output
|
|
180
|
+
if: ${{ env.OUTPUT_DOCKER == 'false' }}
|
|
181
|
+
run: |
|
|
182
|
+
# ALKiln GitHub server info: Silent install message
|
|
183
|
+
echo "ALKiln GitHub server - ALKiln will now prevent output again"
|
|
184
|
+
shell: bash
|
|
185
|
+
|
|
114
186
|
# Don't rely on the environment's version of python
|
|
115
187
|
- uses: actions/setup-python@v4
|
|
116
188
|
with:
|
|
117
189
|
python-version: '3.10'
|
|
190
|
+
# No output
|
|
191
|
+
- run: pip install docassemblecli > /dev/null 2>&1
|
|
192
|
+
if: ${{ env.OUTPUT_DOCKER == 'false' }}
|
|
193
|
+
shell: bash
|
|
194
|
+
# Install the package, the current directory (.), onto the docassemble server
|
|
195
|
+
- run: dainstall . --apiurl http://localhost --apikey $DA_ADMIN_API_KEY > /dev/null 2>&1
|
|
196
|
+
if: ${{ env.OUTPUT_DOCKER == 'false' }}
|
|
197
|
+
shell: bash
|
|
198
|
+
|
|
199
|
+
# With output
|
|
118
200
|
- run: pip install docassemblecli
|
|
201
|
+
if: ${{ env.OUTPUT_DOCKER == 'true' }}
|
|
119
202
|
shell: bash
|
|
120
|
-
# Install the current directory onto the docassemble server
|
|
203
|
+
# Install the package, the current directory (.), onto the docassemble server
|
|
121
204
|
- run: dainstall . --apiurl http://localhost --apikey $DA_ADMIN_API_KEY
|
|
205
|
+
if: ${{ env.OUTPUT_DOCKER == 'true' }}
|
|
122
206
|
shell: bash
|
|
123
207
|
|
|
124
|
-
# Upload artifacts that
|
|
125
|
-
|
|
126
|
-
|
|
208
|
+
# Upload artifacts that devs can download on the Actions summary page
|
|
209
|
+
# Only if the developer wants to get that info, though
|
|
210
|
+
- name: "ALKiln GitHub server - Get path names with date and time"
|
|
211
|
+
if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
|
|
127
212
|
run: |
|
|
128
213
|
echo "GITHUB_SERVER_LOG_FILE_NAME=/tmp/alkiln_docker_logs-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC.txt" >> $GITHUB_ENV
|
|
129
214
|
echo "GITHUB_SERVER_ARTIFACT_NAME=alkiln_github_server-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
|
|
130
215
|
shell: bash
|
|
131
|
-
- name: "ALKiln
|
|
132
|
-
if: ${{ always() }}
|
|
216
|
+
- name: "ALKiln GitHub server - Docker output"
|
|
217
|
+
if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
|
|
133
218
|
run: |
|
|
134
|
-
echo "$(docker
|
|
219
|
+
echo "$(docker output docassemble_container)" > "${{ env.GITHUB_SERVER_LOG_FILE_NAME }}"
|
|
135
220
|
shell: bash
|
|
136
|
-
- name: "ALKiln
|
|
137
|
-
if: ${{ always() }}
|
|
221
|
+
- name: "ALKiln GitHub server - Upload artifacts folder"
|
|
222
|
+
if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
|
|
138
223
|
uses: actions/upload-artifact@v3
|
|
139
224
|
with:
|
|
140
225
|
name: ${{ env.GITHUB_SERVER_ARTIFACT_NAME }}
|
|
141
226
|
path: ${{ env.GITHUB_SERVER_LOG_FILE_NAME }}
|
|
227
|
+
|
|
228
|
+
- run: |
|
|
229
|
+
# ALKiln GitHub server info: End silent output
|
|
230
|
+
echo "ALKiln GitHub server - ALKiln will show output again"
|
|
231
|
+
if: ${{ always() && env.OUTPUT_DOCKER == 'false' }}
|
|
232
|
+
shell: bash
|
|
233
|
+
|
|
234
|
+
- run: |
|
|
235
|
+
# ALKiln GitHub server info: Done
|
|
236
|
+
echo "ALKiln GitHub server - ALKiln will show output again"
|
|
237
|
+
if: ${{ always() && env.OUTPUT_DOCKER == 'false' }}
|
|
238
|
+
shell: bash
|