@suffolklitlab/alkiln 5.8.0 → 5.8.1
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 +2 -2
- package/CHANGELOG.md +12 -0
- package/action.yml +29 -14
- package/action_for_github_server/action.yml +37 -21
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ name: GitHub server installation
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
# Default opened, reopened, synchronize. "edited"
|
|
5
|
+
# Default "opened", "reopened", "synchronize". "edited" fires when the PR title gets edited, etc.
|
|
6
6
|
pull_request_target:
|
|
7
7
|
workflow_dispatch:
|
|
8
8
|
inputs:
|
|
@@ -44,7 +44,7 @@ jobs:
|
|
|
44
44
|
id: github_server
|
|
45
45
|
#### Developer note: you'll need to replace `.` with the path to
|
|
46
46
|
#### the repo and branch. For example:
|
|
47
|
-
#### suffolkLITLab/ALKiln@v5
|
|
47
|
+
#### suffolkLITLab/ALKiln/action_for_github_server@v5
|
|
48
48
|
uses: ./action_for_github_server
|
|
49
49
|
with:
|
|
50
50
|
CONFIG_CONTENTS: "${{ secrets.CONFIG_CONTENTS }}"
|
package/CHANGELOG.md
CHANGED
|
@@ -45,6 +45,18 @@ Format:
|
|
|
45
45
|
|
|
46
46
|
<!-- ## [Unreleased] -->
|
|
47
47
|
|
|
48
|
+
## [5.8.1] - 2023-12-28
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
- Restored previous behavior - Projects are now deleted even when a workflow fails. See [#831](https://github.com/SuffolkLITLab/ALKiln/issues/831).
|
|
52
|
+
- Fixed typo of comment explaining how to reference the isolated GitHub server action.
|
|
53
|
+
|
|
54
|
+
### Security
|
|
55
|
+
- Harden security for action input handling. That said, the source of the problem would come from author workflows, so there's a lot more authors can do to help this situation than we can. Workflows triggered by pull requests are a specific place to watch. GitHub already has [some default safeguards](https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks#about-workflow-runs-from-public-forks) to prevent strangers, specifically first-time contributors, from triggering workflows like that. They can also set their [org](https://docs.github.com/en/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#configuring-required-approval-for-workflows-from-public-forks) or [repo](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#controlling-changes-from-forks-to-workflows-in-public-repositories) to be more strict about pull requests from outside collaborators.
|
|
56
|
+
|
|
57
|
+
### Internal
|
|
58
|
+
- Freeze `docassemblecli` version at 0.0.17. See [#827](https://github.com/SuffolkLITLab/ALKiln/issues/827).
|
|
59
|
+
|
|
48
60
|
## [5.8.0] - 2023-12-18
|
|
49
61
|
|
|
50
62
|
### Added
|
package/action.yml
CHANGED
|
@@ -22,8 +22,6 @@ inputs:
|
|
|
22
22
|
description: "Max amount of time to give the server to reload if it needs to"
|
|
23
23
|
required: false
|
|
24
24
|
# no default to let the custom Scenario timeouts create the reload timeout
|
|
25
|
-
# INSTALL_LOCATION? Will that get confused with the location passed into the command line?
|
|
26
|
-
# Maybe `INSTALL_LOCATION` could be "playground", "server", or a custom path and we could handle all those.
|
|
27
25
|
INSTALL_METHOD:
|
|
28
26
|
description: "Default is 'playground'. Other option: 'server'. How to install the package onto the server."
|
|
29
27
|
required: false
|
|
@@ -31,6 +29,10 @@ inputs:
|
|
|
31
29
|
ALKILN_TAG_EXPRESSION:
|
|
32
30
|
description: "The tag expression to use to limit which tests to run. Default is no tag expression."
|
|
33
31
|
required: false
|
|
32
|
+
DOCASSEMBLECLI_VERSION:
|
|
33
|
+
description: "The version of docassemblecli to install."
|
|
34
|
+
required: false
|
|
35
|
+
default: "0.0.17"
|
|
34
36
|
|
|
35
37
|
runs:
|
|
36
38
|
using: "composite"
|
|
@@ -40,18 +42,29 @@ runs:
|
|
|
40
42
|
|
|
41
43
|
# Set environment variables
|
|
42
44
|
- name: "ALKiln setup info: Set environment variables"
|
|
43
|
-
#
|
|
44
|
-
|
|
45
|
+
# Safe input handling. Avoid evaluating in bash.
|
|
46
|
+
env:
|
|
47
|
+
BRANCH_PATH: ${{ github.ref }}
|
|
48
|
+
BASE_URL: ${{ inputs.SERVER_URL }}
|
|
49
|
+
DOCASSEMBLE_DEVELOPER_API_KEY: ${{ inputs.DOCASSEMBLE_DEVELOPER_API_KEY }}
|
|
50
|
+
ALKILN_VERSION: ${{ inputs.ALKILN_VERSION }}
|
|
51
|
+
MAX_SECONDS_FOR_SETUP: ${{ inputs.MAX_SECONDS_FOR_SETUP }}
|
|
52
|
+
SERVER_RELOAD_TIMEOUT_SECONDS: ${{ inputs.SERVER_RELOAD_TIMEOUT_SECONDS }}
|
|
53
|
+
DOCASSEMBLECLI_VERSION: ${{ inputs.DOCASSEMBLECLI_VERSION }}
|
|
45
54
|
run: |
|
|
46
55
|
# ALKiln setup info: Set environment variables
|
|
56
|
+
# 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
|
|
47
57
|
echo "ARTIFACT_NAME=alkiln-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
|
|
48
58
|
echo "REPO_URL=${{ github.server_url }}/${{ github.repository }}" >> $GITHUB_ENV
|
|
49
|
-
echo "BRANCH_PATH=$
|
|
50
|
-
|
|
51
|
-
echo "
|
|
52
|
-
echo "
|
|
53
|
-
echo "
|
|
54
|
-
echo "
|
|
59
|
+
echo "BRANCH_PATH=$BRANCH_PATH" >> $GITHUB_ENV
|
|
60
|
+
# Workflow inputs
|
|
61
|
+
echo "BASE_URL=$BASE_URL" >> $GITHUB_ENV
|
|
62
|
+
echo "DOCASSEMBLE_DEVELOPER_API_KEY=$DOCASSEMBLE_DEVELOPER_API_KEY" >> $GITHUB_ENV
|
|
63
|
+
echo "ALKILN_VERSION=$ALKILN_VERSION" >> $GITHUB_ENV
|
|
64
|
+
echo "MAX_SECONDS_FOR_SETUP=$MAX_SECONDS_FOR_SETUP" >> $GITHUB_ENV
|
|
65
|
+
echo "SERVER_RELOAD_TIMEOUT_SECONDS=$SERVER_RELOAD_TIMEOUT_SECONDS" >> $GITHUB_ENV
|
|
66
|
+
echo "DOCASSEMBLECLI_VERSION=$DOCASSEMBLECLI_VERSION" >> $GITHUB_ENV
|
|
67
|
+
# Hard-coded internal ALKiln vars
|
|
55
68
|
echo "_ORIGIN=github" >> $GITHUB_ENV
|
|
56
69
|
shell: bash
|
|
57
70
|
- name: "ALKiln setup info: confirm environment variables"
|
|
@@ -68,7 +81,7 @@ runs:
|
|
|
68
81
|
- name: Install ALKiln directly from npm
|
|
69
82
|
run: |
|
|
70
83
|
# ALKiln setup info: Install ALKiln directly from npm
|
|
71
|
-
npm install -g @suffolklitlab/alkiln@$ALKILN_VERSION
|
|
84
|
+
npm install -g "@suffolklitlab/alkiln@$ALKILN_VERSION"
|
|
72
85
|
shell: bash
|
|
73
86
|
|
|
74
87
|
# Install on playground
|
|
@@ -82,7 +95,7 @@ runs:
|
|
|
82
95
|
if: ${{ inputs.INSTALL_METHOD == 'playground' }}
|
|
83
96
|
run: |
|
|
84
97
|
# ALKiln setup info: Create a Project and install the package from GitHub
|
|
85
|
-
|
|
98
|
+
pip install "docassemblecli==$DOCASSEMBLECLI_VERSION"
|
|
86
99
|
alkiln-setup
|
|
87
100
|
shell: bash
|
|
88
101
|
- name: "ALKiln setup ERROR"
|
|
@@ -103,12 +116,14 @@ runs:
|
|
|
103
116
|
# run tests
|
|
104
117
|
- name: "ALKiln info: Run tests"
|
|
105
118
|
if: ${{ success() }}
|
|
106
|
-
|
|
119
|
+
env:
|
|
120
|
+
ALKILN_TAG_EXPRESSION: ${{ inputs.ALKILN_TAG_EXPRESSION || github.event.inputs.tags && format('{0}', github.event.inputs.tags) }}
|
|
121
|
+
run: alkiln-run $ALKILN_TAG_EXPRESSION
|
|
107
122
|
shell: bash
|
|
108
123
|
|
|
109
124
|
# on playground, delete project
|
|
110
125
|
- name: "ALKiln info: Try to delete the project from the playground of the docassemble test account."
|
|
111
|
-
if: ${{ inputs.INSTALL_METHOD == 'playground' }}
|
|
126
|
+
if: ${{ always() && inputs.INSTALL_METHOD == 'playground' }}
|
|
112
127
|
run: alkiln-takedown
|
|
113
128
|
shell: bash
|
|
114
129
|
|
|
@@ -23,6 +23,10 @@ inputs:
|
|
|
23
23
|
description: "Default is 600 seconds. Maximum amount of seconds to give the docassemble docker container to serve the site."
|
|
24
24
|
required: false
|
|
25
25
|
default: 600 # 10 min
|
|
26
|
+
DOCASSEMBLECLI_VERSION:
|
|
27
|
+
description: "The version of docassemblecli to install."
|
|
28
|
+
required: false
|
|
29
|
+
default: "0.0.17"
|
|
26
30
|
|
|
27
31
|
outputs:
|
|
28
32
|
DOCASSEMBLE_DEVELOPER_API_KEY:
|
|
@@ -44,11 +48,16 @@ runs:
|
|
|
44
48
|
- uses: actions/checkout@v3
|
|
45
49
|
|
|
46
50
|
- name: "ALKiln GitHub server - Set environment variables"
|
|
51
|
+
env:
|
|
52
|
+
MAX_SECONDS_FOR_DOCKER: ${{ inputs.MAX_SECONDS_FOR_DOCKER }}
|
|
53
|
+
DOCASSEMBLECLI_VERSION: ${{ inputs.DOCASSEMBLECLI_VERSION }}
|
|
47
54
|
run: |
|
|
55
|
+
# ALKiln GitHub server info: Set environment variables
|
|
56
|
+
echo "MAX_SECONDS_FOR_DOCKER=$MAX_SECONDS_FOR_DOCKER" >> $GITHUB_ENV
|
|
57
|
+
echo "DOCASSEMBLECLI_VERSION=$DOCASSEMBLECLI_VERSION" >> $GITHUB_ENV
|
|
48
58
|
echo "DA_ADMIN_API_KEY=abcd1234abcd1234abcd5678abdc5678" >> $GITHUB_ENV
|
|
49
|
-
echo "MAX_SECONDS_FOR_DOCKER=${{ inputs.MAX_SECONDS_FOR_DOCKER }}" >> $GITHUB_ENV
|
|
50
59
|
echo "DA_ADMIN_EMAIL=admin@example.com" >> $GITHUB_ENV
|
|
51
|
-
# Login will fail if this is "password"
|
|
60
|
+
# Login will fail if this value is "password"
|
|
52
61
|
echo "DA_ADMIN_PASSWORD=@123abcdefg" >> $GITHUB_ENV
|
|
53
62
|
shell: bash
|
|
54
63
|
- id: api_key_output_step
|
|
@@ -59,14 +68,16 @@ runs:
|
|
|
59
68
|
shell: bash
|
|
60
69
|
|
|
61
70
|
- name: "ALKiln GitHub server - Get config"
|
|
71
|
+
env:
|
|
72
|
+
CONFIG: ${{ inputs.CONFIG_CONTENTS }}
|
|
62
73
|
run: |
|
|
63
74
|
# ALKiln GitHub server info: config values
|
|
64
75
|
mkdir /tmp/config
|
|
65
76
|
# Worth making this silent by defining a variable with > /dev/null...?
|
|
66
|
-
if [ -n "$
|
|
77
|
+
if [ -n "$CONFIG" ]
|
|
67
78
|
then
|
|
68
79
|
echo "ALKiln GitHub server - The developer did provide a custom docassemble config file as an input into this action."
|
|
69
|
-
echo "$
|
|
80
|
+
echo "$CONFIG" > /tmp/config/myconfig.yml
|
|
70
81
|
echo "CONFIG_ARGS=--env DA_CONFIG=/tmp/config/myconfig.yml --volume /tmp/config:/tmp/config " >> $GITHUB_ENV
|
|
71
82
|
else
|
|
72
83
|
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."
|
|
@@ -74,20 +85,20 @@ runs:
|
|
|
74
85
|
fi
|
|
75
86
|
shell: bash
|
|
76
87
|
|
|
77
|
-
#
|
|
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,
|
|
88
|
+
# Question: If in future we allow GitHub variables instead of just secrets,
|
|
80
89
|
# should we let those be visible or prevent them along with the docker logs?
|
|
81
|
-
|
|
82
|
-
#
|
|
83
|
-
# hiding the output from the job console?
|
|
90
|
+
# Also, does GitHub hide job environment output of secrets as well as
|
|
91
|
+
# hiding the secrets' output from the job console?
|
|
84
92
|
|
|
85
93
|
# Define the var to prevent/show docker output
|
|
94
|
+
# TODO: Why are we only doing this for manually triggered workflows?
|
|
86
95
|
- name: Env var for showing docker output
|
|
96
|
+
env:
|
|
97
|
+
SHOW_DOCKER_OUTPUT: ${{ inputs.SHOW_DOCKER_OUTPUT }}
|
|
87
98
|
run: |
|
|
88
99
|
# ALKiln GitHub server info: Docker logs visibility decision
|
|
89
100
|
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
|
90
|
-
echo "OUTPUT_DOCKER=$
|
|
101
|
+
echo "OUTPUT_DOCKER=$SHOW_DOCKER_OUTPUT" >> $GITHUB_ENV
|
|
91
102
|
else
|
|
92
103
|
echo "OUTPUT_DOCKER=false" >> $GITHUB_ENV
|
|
93
104
|
fi
|
|
@@ -105,31 +116,36 @@ runs:
|
|
|
105
116
|
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
117
|
shell: bash
|
|
107
118
|
|
|
119
|
+
# TODO: Reduce these to 1 block by putting ` > /dev/null 2>&1` into an env var
|
|
108
120
|
# No output
|
|
109
121
|
- name: "ALKiln GitHub server - Download and start docker silently"
|
|
110
122
|
if: ${{ env.OUTPUT_DOCKER == 'false' }}
|
|
123
|
+
env:
|
|
124
|
+
CONFIG_ARGS: ${{ env.CONFIG_ARGS }}
|
|
111
125
|
run: |
|
|
112
126
|
# ALKiln GitHub server info: Silent docker pull/run
|
|
113
127
|
docker pull jhpyle/docassemble > /dev/null 2>&1
|
|
114
128
|
docker run --name docassemble_container \
|
|
115
|
-
--env DA_ADMIN_EMAIL="$
|
|
116
|
-
--env DA_ADMIN_PASSWORD="$
|
|
117
|
-
--env DA_ADMIN_API_KEY="$
|
|
118
|
-
$
|
|
129
|
+
--env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \
|
|
130
|
+
--env DA_ADMIN_PASSWORD="$DA_ADMIN_PASSWORD" \
|
|
131
|
+
--env DA_ADMIN_API_KEY="$DA_ADMIN_API_KEY" \
|
|
132
|
+
$CONFIG_ARGS \
|
|
119
133
|
--cap-add SYS_PTRACE \
|
|
120
134
|
--memory="4gb" -d -p 80:80 jhpyle/docassemble > /dev/null 2>&1
|
|
121
135
|
shell: bash
|
|
122
136
|
# With output
|
|
123
137
|
- name: "ALKiln GitHub server - Download and start docker"
|
|
124
138
|
if: ${{ env.OUTPUT_DOCKER == 'true' }}
|
|
139
|
+
env:
|
|
140
|
+
CONFIG_ARGS: ${{ env.CONFIG_ARGS }}
|
|
125
141
|
run: |
|
|
126
142
|
# ALKiln GitHub server info: Docker pull/run
|
|
127
143
|
docker pull jhpyle/docassemble
|
|
128
144
|
docker run --name docassemble_container \
|
|
129
|
-
--env DA_ADMIN_EMAIL="$
|
|
130
|
-
--env DA_ADMIN_PASSWORD="$
|
|
131
|
-
--env DA_ADMIN_API_KEY="$
|
|
132
|
-
$
|
|
145
|
+
--env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \
|
|
146
|
+
--env DA_ADMIN_PASSWORD="$DA_ADMIN_PASSWORD" \
|
|
147
|
+
--env DA_ADMIN_API_KEY="$DA_ADMIN_API_KEY" \
|
|
148
|
+
$CONFIG_ARGS \
|
|
133
149
|
--cap-add SYS_PTRACE \
|
|
134
150
|
--memory="4gb" -d -p 80:80 jhpyle/docassemble
|
|
135
151
|
shell: bash
|
|
@@ -188,7 +204,7 @@ runs:
|
|
|
188
204
|
with:
|
|
189
205
|
python-version: '3.10'
|
|
190
206
|
# No output
|
|
191
|
-
- run: pip install docassemblecli > /dev/null 2>&1
|
|
207
|
+
- run: pip install "docassemblecli==$DOCASSEMBLECLI_VERSION" > /dev/null 2>&1
|
|
192
208
|
if: ${{ env.OUTPUT_DOCKER == 'false' }}
|
|
193
209
|
shell: bash
|
|
194
210
|
# Install the package, the current directory (.), onto the docassemble server
|
|
@@ -197,7 +213,7 @@ runs:
|
|
|
197
213
|
shell: bash
|
|
198
214
|
|
|
199
215
|
# With output
|
|
200
|
-
- run: pip install docassemblecli
|
|
216
|
+
- run: pip install "docassemblecli==$DOCASSEMBLECLI_VERSION"
|
|
201
217
|
if: ${{ env.OUTPUT_DOCKER == 'true' }}
|
|
202
218
|
shell: bash
|
|
203
219
|
# Install the package, the current directory (.), onto the docassemble server
|