-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Harden actions, delete Projects of failed tests, close #831 #843
Changes from all commits
ee6c8d9
71e2ebb
f3a7112
01c3378
836eeb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ inputs: | |
required: false | ||
default: 600 # 10 min | ||
DOCASSEMBLECLI_VERSION: | ||
description: 'Where to get the docassemblecli package. E.g. a GitHub zip or a pypi version.' | ||
description: "The version of docassemblecli to install." | ||
required: false | ||
default: "0.0.17" | ||
|
||
|
@@ -48,13 +48,17 @@ runs: | |
- uses: actions/checkout@v3 | ||
|
||
- name: "ALKiln GitHub server - Set environment variables" | ||
env: | ||
MAX_SECONDS_FOR_DOCKER: ${{ inputs.MAX_SECONDS_FOR_DOCKER }} | ||
DOCASSEMBLECLI_VERSION: ${{ inputs.DOCASSEMBLECLI_VERSION }} | ||
run: | | ||
# ALKiln GitHub server info: Set environment variables | ||
echo "MAX_SECONDS_FOR_DOCKER=$MAX_SECONDS_FOR_DOCKER" >> $GITHUB_ENV | ||
echo "DOCASSEMBLECLI_VERSION=$DOCASSEMBLECLI_VERSION" >> $GITHUB_ENV | ||
echo "DA_ADMIN_API_KEY=abcd1234abcd1234abcd5678abdc5678" >> $GITHUB_ENV | ||
echo "MAX_SECONDS_FOR_DOCKER=${{ inputs.MAX_SECONDS_FOR_DOCKER }}" >> $GITHUB_ENV | ||
echo "DA_ADMIN_EMAIL=admin@example.com" >> $GITHUB_ENV | ||
# Login will fail if this is "password" | ||
# Login will fail if this value is "password" | ||
echo "DA_ADMIN_PASSWORD=@123abcdefg" >> $GITHUB_ENV | ||
echo "DOCASSEMBLECLI_VERSION=${{ inputs.DOCASSEMBLECLI_VERSION }}" >> $GITHUB_ENV | ||
shell: bash | ||
- id: api_key_output_step | ||
run: | | ||
|
@@ -64,35 +68,37 @@ runs: | |
shell: bash | ||
|
||
- name: "ALKiln GitHub server - Get config" | ||
env: | ||
CONFIG: ${{ inputs.CONFIG_CONTENTS }} | ||
run: | | ||
# ALKiln GitHub server info: config values | ||
mkdir /tmp/config | ||
# Worth making this silent by defining a variable with > /dev/null...? | ||
if [ -n "${{ inputs.CONFIG_CONTENTS }}" ] | ||
if [ -n "$CONFIG" ] | ||
then | ||
echo "ALKiln GitHub server - The developer did provide a custom docassemble config file as an input into this action." | ||
echo "${{ inputs.CONFIG_CONTENTS }}" > /tmp/config/myconfig.yml | ||
echo "$CONFIG" > /tmp/config/myconfig.yml | ||
echo "CONFIG_ARGS=--env DA_CONFIG=/tmp/config/myconfig.yml --volume /tmp/config:/tmp/config " >> $GITHUB_ENV | ||
else | ||
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." | ||
echo "CONFIG_ARGS=" >> $GITHUB_ENV | ||
fi | ||
shell: bash | ||
|
||
# GitHub masks secret values like the config, so we don't really | ||
# need to stop that yet, but users may start using variables, so | ||
# a question: If in future we allow variables instead of just secrets, | ||
# Question: If in future we allow GitHub variables instead of just secrets, | ||
# should we let those be visible or prevent them along with the docker logs? | ||
|
||
# Also, does this leave GitHub job environment output While just | ||
# hiding the output from the job console? | ||
# Also, does GitHub hide job environment output of secrets as well as | ||
# hiding the secrets' output from the job console? | ||
|
||
# Define the var to prevent/show docker output | ||
# TODO: Why are we only doing this for manually triggered workflows? | ||
- name: Env var for showing docker output | ||
env: | ||
SHOW_DOCKER_OUTPUT: ${{ inputs.SHOW_DOCKER_OUTPUT }} | ||
run: | | ||
# ALKiln GitHub server info: Docker logs visibility decision | ||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | ||
echo "OUTPUT_DOCKER=${{ inputs.SHOW_DOCKER_OUTPUT }}" >> $GITHUB_ENV | ||
echo "OUTPUT_DOCKER=$SHOW_DOCKER_OUTPUT" >> $GITHUB_ENV | ||
else | ||
echo "OUTPUT_DOCKER=false" >> $GITHUB_ENV | ||
fi | ||
|
@@ -110,31 +116,36 @@ runs: | |
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===' | ||
shell: bash | ||
|
||
# TODO: Reduce these to 1 block by putting ` > /dev/null 2>&1` into an env var | ||
# No output | ||
- name: "ALKiln GitHub server - Download and start docker silently" | ||
if: ${{ env.OUTPUT_DOCKER == 'false' }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also can't comment on the exact lines, but each instance of |
||
env: | ||
CONFIG_ARGS: ${{ env.CONFIG_ARGS }} | ||
run: | | ||
# ALKiln GitHub server info: Silent docker pull/run | ||
docker pull jhpyle/docassemble > /dev/null 2>&1 | ||
docker run --name docassemble_container \ | ||
--env DA_ADMIN_EMAIL="${{ env.DA_ADMIN_EMAIL }}" \ | ||
--env DA_ADMIN_PASSWORD="${{ env.DA_ADMIN_PASSWORD }}" \ | ||
--env DA_ADMIN_API_KEY="${{ env.DA_ADMIN_API_KEY }}" \ | ||
${{ env.CONFIG_ARGS }} \ | ||
--env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \ | ||
--env DA_ADMIN_PASSWORD="$DA_ADMIN_PASSWORD" \ | ||
--env DA_ADMIN_API_KEY="$DA_ADMIN_API_KEY" \ | ||
$CONFIG_ARGS \ | ||
--cap-add SYS_PTRACE \ | ||
--memory="4gb" -d -p 80:80 jhpyle/docassemble > /dev/null 2>&1 | ||
shell: bash | ||
# With output | ||
- name: "ALKiln GitHub server - Download and start docker" | ||
if: ${{ env.OUTPUT_DOCKER == 'true' }} | ||
env: | ||
CONFIG_ARGS: ${{ env.CONFIG_ARGS }} | ||
run: | | ||
# ALKiln GitHub server info: Docker pull/run | ||
docker pull jhpyle/docassemble | ||
docker run --name docassemble_container \ | ||
--env DA_ADMIN_EMAIL="${{ env.DA_ADMIN_EMAIL }}" \ | ||
--env DA_ADMIN_PASSWORD="${{ env.DA_ADMIN_PASSWORD }}" \ | ||
--env DA_ADMIN_API_KEY="${{ env.DA_ADMIN_API_KEY }}" \ | ||
${{ env.CONFIG_ARGS }} \ | ||
--env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \ | ||
--env DA_ADMIN_PASSWORD="$DA_ADMIN_PASSWORD" \ | ||
--env DA_ADMIN_API_KEY="$DA_ADMIN_API_KEY" \ | ||
$CONFIG_ARGS \ | ||
--cap-add SYS_PTRACE \ | ||
--memory="4gb" -d -p 80:80 jhpyle/docassemble | ||
shell: bash | ||
|
@@ -193,7 +204,7 @@ runs: | |
with: | ||
python-version: '3.10' | ||
# No output | ||
- run: pip install docassemblecli==$DOCASSEMBLECLI_VERSION > /dev/null 2>&1 | ||
- run: pip install "docassemblecli==$DOCASSEMBLECLI_VERSION" > /dev/null 2>&1 | ||
if: ${{ env.OUTPUT_DOCKER == 'false' }} | ||
shell: bash | ||
# Install the package, the current directory (.), onto the docassemble server | ||
|
@@ -202,7 +213,7 @@ runs: | |
shell: bash | ||
|
||
# With output | ||
- run: pip install docassemblecli==$DOCASSEMBLECLI_VERSION | ||
- run: pip install "docassemblecli==$DOCASSEMBLECLI_VERSION" | ||
if: ${{ env.OUTPUT_DOCKER == 'true' }} | ||
shell: bash | ||
# Install the package, the current directory (.), onto the docassemble server | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github won't let me comment on specific lines, but https://github.com/SuffolkLITLab/ALKiln/pull/843/files#diff-1243c5424efaaa19bd8e813c5e6f6da46316e63761421b3e5f5c8ced9a36e6b6L90 should also be quoted in bash. Tested the command locally and it should be good:
Same with the
npm install -g
line: https://github.com/SuffolkLITLab/ALKiln/pull/843/files#diff-1243c5424efaaa19bd8e813c5e6f6da46316e63761421b3e5f5c8ced9a36e6b6R83.