@suffolklitlab/alkiln 5.6.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 +7 -5
- package/.github/workflows/playground.yml +58 -0
- package/.github/workflows/unit_tests.yml +35 -0
- package/CHANGELOG.md +12 -0
- package/action.yml +32 -14
- package/action_for_github_server/action.yml +38 -31
- 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,7 +1,9 @@
|
|
|
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:
|
|
@@ -33,7 +35,9 @@ jobs:
|
|
|
33
35
|
SECRET_FOR_MISSING_FIELD: secret for missing field
|
|
34
36
|
|
|
35
37
|
steps:
|
|
36
|
-
|
|
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
|
|
37
41
|
- uses: actions/checkout@v3
|
|
38
42
|
|
|
39
43
|
- name: ALKiln - Start the isolated temporary docassemble server on GitHub
|
|
@@ -83,7 +87,5 @@ jobs:
|
|
|
83
87
|
INSTALL_METHOD: "server"
|
|
84
88
|
#### Developer note: Useful for temporarily shortening ALKiln tests
|
|
85
89
|
#### to debug the docker install step
|
|
86
|
-
# ALKILN_TAG_EXPRESSION: @
|
|
87
|
-
- run: echo "ALkiln finished running ALKiln tests"
|
|
88
|
-
shell: bash
|
|
90
|
+
# ALKILN_TAG_EXPRESSION: @a_tag_expression
|
|
89
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,18 @@ 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
|
+
|
|
48
60
|
## [5.6.0] - 2023-10-27
|
|
49
61
|
|
|
50
62
|
### Changed
|
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
|
|
@@ -40,9 +40,10 @@ outputs:
|
|
|
40
40
|
runs:
|
|
41
41
|
using: "composite"
|
|
42
42
|
steps:
|
|
43
|
+
# Place the root directory in this branch
|
|
43
44
|
- uses: actions/checkout@v3
|
|
44
45
|
|
|
45
|
-
- name: "ALKiln
|
|
46
|
+
- name: "ALKiln GitHub server - Set environment variables"
|
|
46
47
|
run: |
|
|
47
48
|
echo "DA_ADMIN_API_KEY=abcd1234abcd1234abcd5678abdc5678" >> $GITHUB_ENV
|
|
48
49
|
echo "MAX_SECONDS_FOR_DOCKER=${{ inputs.MAX_SECONDS_FOR_DOCKER }}" >> $GITHUB_ENV
|
|
@@ -57,18 +58,18 @@ runs:
|
|
|
57
58
|
echo "DA_ADMIN_PASSWORD=$DA_ADMIN_PASSWORD" >> "$GITHUB_OUTPUT"
|
|
58
59
|
shell: bash
|
|
59
60
|
|
|
60
|
-
- name: "ALKiln
|
|
61
|
+
- name: "ALKiln GitHub server - Get config"
|
|
61
62
|
run: |
|
|
62
|
-
#
|
|
63
|
+
# ALKiln GitHub server info: config values
|
|
63
64
|
mkdir /tmp/config
|
|
64
65
|
# Worth making this silent by defining a variable with > /dev/null...?
|
|
65
66
|
if [ -n "${{ inputs.CONFIG_CONTENTS }}" ]
|
|
66
67
|
then
|
|
67
|
-
echo "ALKiln
|
|
68
|
+
echo "ALKiln GitHub server - The developer did provide a custom docassemble config file as an input into this action."
|
|
68
69
|
echo "${{ inputs.CONFIG_CONTENTS }}" > /tmp/config/myconfig.yml
|
|
69
70
|
echo "CONFIG_ARGS=--env DA_CONFIG=/tmp/config/myconfig.yml --volume /tmp/config:/tmp/config " >> $GITHUB_ENV
|
|
70
71
|
else
|
|
71
|
-
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."
|
|
72
73
|
echo "CONFIG_ARGS=" >> $GITHUB_ENV
|
|
73
74
|
fi
|
|
74
75
|
shell: bash
|
|
@@ -84,7 +85,7 @@ runs:
|
|
|
84
85
|
# Define the var to prevent/show docker output
|
|
85
86
|
- name: Env var for showing docker output
|
|
86
87
|
run: |
|
|
87
|
-
#
|
|
88
|
+
# ALKiln GitHub server info: Docker logs visibility decision
|
|
88
89
|
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
|
89
90
|
echo "OUTPUT_DOCKER=${{ inputs.SHOW_DOCKER_OUTPUT }}" >> $GITHUB_ENV
|
|
90
91
|
else
|
|
@@ -95,20 +96,20 @@ runs:
|
|
|
95
96
|
# Messages about output
|
|
96
97
|
- if: ${{ env.OUTPUT_DOCKER == 'false' }}
|
|
97
98
|
run: |
|
|
98
|
-
#
|
|
99
|
-
printf '===\nALKiln
|
|
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==='
|
|
100
101
|
shell: bash
|
|
101
102
|
- if: ${{ env.OUTPUT_DOCKER == 'true' }}
|
|
102
103
|
run: |
|
|
103
|
-
#
|
|
104
|
-
printf '===\nALKiln
|
|
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==='
|
|
105
106
|
shell: bash
|
|
106
107
|
|
|
107
108
|
# No output
|
|
108
|
-
- name: "ALKiln
|
|
109
|
+
- name: "ALKiln GitHub server - Download and start docker silently"
|
|
109
110
|
if: ${{ env.OUTPUT_DOCKER == 'false' }}
|
|
110
111
|
run: |
|
|
111
|
-
#
|
|
112
|
+
# ALKiln GitHub server info: Silent docker pull/run
|
|
112
113
|
docker pull jhpyle/docassemble > /dev/null 2>&1
|
|
113
114
|
docker run --name docassemble_container \
|
|
114
115
|
--env DA_ADMIN_EMAIL="${{ env.DA_ADMIN_EMAIL }}" \
|
|
@@ -119,10 +120,10 @@ runs:
|
|
|
119
120
|
--memory="4gb" -d -p 80:80 jhpyle/docassemble > /dev/null 2>&1
|
|
120
121
|
shell: bash
|
|
121
122
|
# With output
|
|
122
|
-
- name: "ALKiln
|
|
123
|
+
- name: "ALKiln GitHub server - Download and start docker"
|
|
123
124
|
if: ${{ env.OUTPUT_DOCKER == 'true' }}
|
|
124
125
|
run: |
|
|
125
|
-
#
|
|
126
|
+
# ALKiln GitHub server info: Docker pull/run
|
|
126
127
|
docker pull jhpyle/docassemble
|
|
127
128
|
docker run --name docassemble_container \
|
|
128
129
|
--env DA_ADMIN_EMAIL="${{ env.DA_ADMIN_EMAIL }}" \
|
|
@@ -136,13 +137,13 @@ runs:
|
|
|
136
137
|
# Show the time it takes to start the server.
|
|
137
138
|
- if: ${{ env.OUTPUT_DOCKER == 'false' }}
|
|
138
139
|
run: |
|
|
139
|
-
#
|
|
140
|
-
echo "ALKiln
|
|
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"
|
|
141
142
|
shell: bash
|
|
142
143
|
|
|
143
|
-
- name: "ALKiln
|
|
144
|
+
- name: "ALKiln GitHub server - Wait for server to start"
|
|
144
145
|
run: |
|
|
145
|
-
# ALKiln
|
|
146
|
+
# ALKiln GitHub server - Wait for server to start
|
|
146
147
|
|
|
147
148
|
# Reset the SECONDS variable
|
|
148
149
|
SECONDS=0
|
|
@@ -151,23 +152,23 @@ runs:
|
|
|
151
152
|
|
|
152
153
|
response="start"
|
|
153
154
|
while [[ $response != *"200"* ]]; do
|
|
154
|
-
echo "ALKiln
|
|
155
|
+
echo "ALKiln GitHub server - Time elapsed: $SECONDS seconds"
|
|
155
156
|
|
|
156
157
|
# Check if max seconds till loading has passed
|
|
157
158
|
if [[ $SECONDS -ge $MAX_SECONDS_FOR_DOCKER ]]; then
|
|
158
|
-
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."
|
|
159
160
|
exit 1
|
|
160
161
|
fi
|
|
161
162
|
|
|
162
163
|
# Set the variable to a new string value in each iteration
|
|
163
164
|
response=$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:80/health_check?ready=1)
|
|
164
|
-
echo "ALKiln
|
|
165
|
+
echo "ALKiln GitHub server - response is $response"
|
|
165
166
|
|
|
166
167
|
# Check if the string includes the desired text
|
|
167
168
|
if [[ $response == *"200"* ]]; then
|
|
168
|
-
echo "ALKiln
|
|
169
|
+
echo "ALKiln GitHub server - Success! The docker container is ready!"
|
|
169
170
|
else
|
|
170
|
-
echo "ALKiln
|
|
171
|
+
echo "ALKiln GitHub server - The docker container is not ready yet. Will check again in 30 seconds."
|
|
171
172
|
sleep 30
|
|
172
173
|
fi
|
|
173
174
|
|
|
@@ -178,8 +179,8 @@ runs:
|
|
|
178
179
|
- name: Message about docassemble install output
|
|
179
180
|
if: ${{ env.OUTPUT_DOCKER == 'false' }}
|
|
180
181
|
run: |
|
|
181
|
-
#
|
|
182
|
-
echo "ALKiln
|
|
182
|
+
# ALKiln GitHub server info: Silent install message
|
|
183
|
+
echo "ALKiln GitHub server - ALKiln will now prevent output again"
|
|
183
184
|
shell: bash
|
|
184
185
|
|
|
185
186
|
# Don't rely on the environment's version of python
|
|
@@ -206,18 +207,18 @@ runs:
|
|
|
206
207
|
|
|
207
208
|
# Upload artifacts that devs can download on the Actions summary page
|
|
208
209
|
# Only if the developer wants to get that info, though
|
|
209
|
-
- name: "ALKiln
|
|
210
|
+
- name: "ALKiln GitHub server - Get path names with date and time"
|
|
210
211
|
if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
|
|
211
212
|
run: |
|
|
212
213
|
echo "GITHUB_SERVER_LOG_FILE_NAME=/tmp/alkiln_docker_logs-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC.txt" >> $GITHUB_ENV
|
|
213
214
|
echo "GITHUB_SERVER_ARTIFACT_NAME=alkiln_github_server-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
|
|
214
215
|
shell: bash
|
|
215
|
-
- name: "ALKiln
|
|
216
|
+
- name: "ALKiln GitHub server - Docker output"
|
|
216
217
|
if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
|
|
217
218
|
run: |
|
|
218
219
|
echo "$(docker output docassemble_container)" > "${{ env.GITHUB_SERVER_LOG_FILE_NAME }}"
|
|
219
220
|
shell: bash
|
|
220
|
-
- name: "ALKiln
|
|
221
|
+
- name: "ALKiln GitHub server - Upload artifacts folder"
|
|
221
222
|
if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
|
|
222
223
|
uses: actions/upload-artifact@v3
|
|
223
224
|
with:
|
|
@@ -225,7 +226,13 @@ runs:
|
|
|
225
226
|
path: ${{ env.GITHUB_SERVER_LOG_FILE_NAME }}
|
|
226
227
|
|
|
227
228
|
- run: |
|
|
228
|
-
#
|
|
229
|
-
echo "ALKiln
|
|
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"
|
|
230
237
|
if: ${{ always() && env.OUTPUT_DOCKER == 'false' }}
|
|
231
238
|
shell: bash
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
const axios = require('axios');
|
|
2
|
-
const qs = require('qs');
|
|
3
2
|
|
|
3
|
+
// Ours
|
|
4
4
|
const session_vars = require('../utils/session_vars' );
|
|
5
5
|
|
|
6
6
|
/* Requests to make to the developer's docassemble server.
|
|
7
7
|
* As close to plain requests as we can get so we don't have
|
|
8
8
|
* to think about this file again.
|
|
9
|
-
|
|
10
|
-
* - We are not using `.create()` because we want to get
|
|
11
|
-
* the environment variables fresh every time. */
|
|
9
|
+
*/
|
|
12
10
|
|
|
13
11
|
let da = {};
|
|
14
12
|
module.exports = da;
|
|
@@ -33,82 +31,6 @@ da.get_dev_id = async function ( timeout ) {
|
|
|
33
31
|
}; // Ends da.get_dev_id()
|
|
34
32
|
|
|
35
33
|
|
|
36
|
-
// node -e 'require("./lib/docassemble/docassemble_api_REST.js").create_project( "create1" )'
|
|
37
|
-
da.create_project = async function ( project_name, timeout ) {
|
|
38
|
-
/* Create a new project on the user's da server. */
|
|
39
|
-
let options = {
|
|
40
|
-
method: 'POST',
|
|
41
|
-
headers: {'X-API-Key': session_vars.get_dev_api_key()},
|
|
42
|
-
url: `${ session_vars.get_da_server_url() }/api/playground/project`,
|
|
43
|
-
data: qs.stringify({
|
|
44
|
-
project: project_name,
|
|
45
|
-
}),
|
|
46
|
-
timeout: timeout,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
try {
|
|
50
|
-
return await axios.request( options );
|
|
51
|
-
} catch (error) {
|
|
52
|
-
let response = error.response || {data: null}
|
|
53
|
-
throw {...error.toJSON(), data: response.data};
|
|
54
|
-
}
|
|
55
|
-
}; // Ends da.create_project()
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// node -e 'require("./lib/docassemble/docassemble_api_REST.js").pull()'
|
|
59
|
-
da.pull = async function ( timeout ) {
|
|
60
|
-
/* Pull github code into an existing Project. */
|
|
61
|
-
let options = {
|
|
62
|
-
method: 'POST',
|
|
63
|
-
headers: {'X-API-Key': session_vars.get_dev_api_key()},
|
|
64
|
-
url: `${ session_vars.get_da_server_url() }/api/playground_pull`,
|
|
65
|
-
data: qs.stringify({
|
|
66
|
-
project: session_vars.get_project_name(),
|
|
67
|
-
github_url: session_vars.get_repo_url(),
|
|
68
|
-
branch: session_vars.get_branch_name(),
|
|
69
|
-
}),
|
|
70
|
-
timeout: timeout,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
return await axios.request( options );
|
|
75
|
-
} catch (error) {
|
|
76
|
-
let response = error.response || {data: null}
|
|
77
|
-
throw {...error.toJSON(), data: response.data};
|
|
78
|
-
}
|
|
79
|
-
}; // Ends da.pull()
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
da.has_playground_task_finished = async function ( task_id, timeout ) {
|
|
83
|
-
return await da.has_task_finished( "/api/restart_status", task_id, timeout);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
da.has_package_task_finished = async function ( task_id, timeout ) {
|
|
87
|
-
return await da.has_task_finished( "/api/package_update_status", task_id, timeout);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// node -e 'require("./lib/docassemble/docassemble_api_REST.js").has_task_finished()'
|
|
91
|
-
da.has_task_finished = async function ( api_endpoint, task_id, timeout ) {
|
|
92
|
-
/* Check task status based on `task_id`. */
|
|
93
|
-
let options = {
|
|
94
|
-
method: 'GET',
|
|
95
|
-
headers: {'X-API-Key': session_vars.get_dev_api_key()},
|
|
96
|
-
url: `${ session_vars.get_da_server_url() }${ api_endpoint }`,
|
|
97
|
-
params: {
|
|
98
|
-
task_id: task_id,
|
|
99
|
-
},
|
|
100
|
-
timeout: timeout,
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
try {
|
|
104
|
-
return await axios.request( options );
|
|
105
|
-
} catch (error) {
|
|
106
|
-
let response = error.response || {data: null}
|
|
107
|
-
throw {...error.toJSON(), data: response.data};
|
|
108
|
-
}
|
|
109
|
-
}; // Ends da.has_task_finished()
|
|
110
|
-
|
|
111
|
-
|
|
112
34
|
// node -e 'require("./lib/docassemble/docassemble_api_REST.js").delete_project( "create1" )'
|
|
113
35
|
da.delete_project = async function ( timeout ) {
|
|
114
36
|
/* Delete a project on the user's da server. */
|
|
@@ -160,4 +82,4 @@ da.__delete_projects_starting_with = async function ( base_name, starting_num=1,
|
|
|
160
82
|
}
|
|
161
83
|
name_incrementor++;
|
|
162
84
|
}
|
|
163
|
-
}; // Ends
|
|
85
|
+
}; // Ends da.__delete_projects_starting_with()
|