refactor: rewrite with plain commands #2

Merged
maximilian.jugl merged 16 commits from refactor/bash into main 2026-07-17 11:57:42 +00:00

Contains some fixes and improvements:

  • no need to build and download release binary (and no additional version identifier in inputs)
  • masks secret values automatically
  • writes delimited outputs
  • reuses one token across multiple uses of this action and reauthenticates as necessary
  • only requires curl and jq, both of which are pre-installed on the default stackit-docker runner
  • tested on stackit-docker, stackit-alpine and stackit-alpine-bash runners

Why not just use the vault CLI?

$ ll vault_2.0.3_linux_amd64.zip 
-rw-r--r--@ 1 jugl  staff   168M Jun 18 08:28 vault_2.0.3_linux_amd64.zip
$ unzip -l vault_2.0.3_linux_amd64.zip 
Archive:  vault_2.0.3_linux_amd64.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
     4919  06-17-2026 18:45   LICENSE.txt
536903029  06-17-2026 18:45   vault
---------                     -------
536907948                     2 files

512M unzipped :D

Contains some fixes and improvements: - no need to build and download release binary (and no additional version identifier in inputs) - masks secret values automatically - writes delimited outputs - reuses one token across multiple uses of this action and reauthenticates as necessary - only requires curl and jq, both of which are pre-installed on the default stackit-docker runner - tested on stackit-docker, stackit-alpine and stackit-alpine-bash runners Why not just use the vault CLI? ``` $ ll vault_2.0.3_linux_amd64.zip -rw-r--r--@ 1 jugl staff 168M Jun 18 08:28 vault_2.0.3_linux_amd64.zip $ unzip -l vault_2.0.3_linux_amd64.zip Archive: vault_2.0.3_linux_amd64.zip Length Date Time Name --------- ---------- ----- ---- 4919 06-17-2026 18:45 LICENSE.txt 536903029 06-17-2026 18:45 vault --------- ------- 536907948 2 files ``` 512M unzipped :D
feat: add test workflow
Some checks failed
Run tests / Run tests on stackit-alpine (push) Failing after 4s
Run tests / Run tests on stackit-alpine-bash (push) Failing after 5s
Run tests / Run tests on stackit-docker (push) Successful in 46s
a1284eb903
fix: add nodejs dep
Some checks failed
Run tests / Run tests on stackit-alpine (push) Failing after 12s
Run tests / Run tests on stackit-alpine-bash (push) Failing after 8s
Run tests / Run tests on stackit-docker (push) Successful in 57s
9dd5779ea3
fix: remove openssl dep check
All checks were successful
Run tests / Run tests on stackit-alpine (push) Successful in 6s
Run tests / Run tests on stackit-alpine-bash (push) Successful in 8s
Run tests / Run tests on stackit-docker (push) Successful in 58s
beffde6bc1
feat: add formatter
All checks were successful
Run tests / Run tests on stackit-alpine-bash (push) Successful in 7s
Run tests / Run tests on stackit-alpine (push) Successful in 10s
Run tests / Run tests on stackit-docker (push) Successful in 42s
6aae52e3c8
feat: add check for empty secret
All checks were successful
Run tests / Run tests on stackit-alpine (push) Successful in 10s
Run tests / Run tests on stackit-alpine-bash (push) Successful in 9s
Run tests / Run tests on stackit-docker (push) Successful in 47s
784fc60e78
docs: typo
All checks were successful
Run tests / Run tests on stackit-alpine-bash (pull_request) Successful in 7s
Run tests / Run tests on stackit-alpine (pull_request) Successful in 10s
Run tests / Run tests on stackit-docker (pull_request) Successful in 38s
7142cc13a9
refactor: leading newline
All checks were successful
Run tests / Run tests on stackit-alpine (pull_request) Successful in 7s
Run tests / Run tests on stackit-alpine-bash (pull_request) Successful in 12s
Run tests / Run tests on stackit-docker (pull_request) Successful in 40s
ced59fed2e
marcel.henselin approved these changes 2026-07-17 08:46:49 +00:00
Dismissed
@ -0,0 +1,5 @@
{

why do we check in ide files?

why do we check in ide files?
Author
Owner

Using prettier to auto-format and enforce consistent formatting for workflow files and the README. Others who use this repo would automatically be prompted to get the corresponding extension. This is also why npm is part of this repo. Contains prettier as a dev dependency, nothing more. It's just there for DX :)

Using [prettier](https://prettier.io/) to auto-format and enforce consistent formatting for workflow files and the README. Others who use this repo would automatically be prompted to get the corresponding extension. This is also why npm is part of this repo. Contains prettier as a dev dependency, nothing more. It's just there for DX :)
action.yml Outdated
@ -50,1 +43,4 @@
VAULT_PASSWORD: ${{ inputs.vault_password }}
shell: sh
run: |
if [ -z "${VAULT_TOKEN_FILE}" ]; then

i think we should use "set -e" and probably also "set -o pipefail" here

i think we should use "set -e" and probably also "set -o pipefail" here
Author
Owner

Agree

Agree
Author
Owner

pipefail is not supported in runner environments but -e is present now

pipefail is not supported in runner environments but -e is present now
maximilian.jugl marked this conversation as resolved
@ -51,0 +57,4 @@
CURRENT_TOKEN="$(cat "${VAULT_TOKEN_FILE}")"
if [ -n "${CURRENT_TOKEN}" ]; then
HTTP_CODE="$(curl -s -o /dev/null -w "%{http_code}" \

should we use the --fail option as well?

should we use the --fail option as well?
Author
Owner

Yes

Yes
Author
Owner

Checked it again and no, we can't have --fail here. This endpoint can return a 403 if the Vault token expired, in which case the workflow will re-issue a new token. Docs are not clear which status codes can be returned. But I'm already checking for a 200 in the source code. Added a check for 4xx and 5xx status codes and causing the workflow to exit if the status code is not 403.

Checked it again and no, we can't have --fail here. This endpoint can return a 403 if the Vault token expired, in which case the workflow will re-issue a new token. Docs are not clear which status codes can be returned. But I'm already checking for a 200 in the source code. Added a check for 4xx and 5xx status codes and causing the workflow to exit if the status code is not 403.
maximilian.jugl marked this conversation as resolved
@ -0,0 +1,5 @@
{

do we really need npm here?

do we really need npm here?
Author
Owner

See comment on IDE files

See comment on IDE files
feat: add secrets_file_path input
All checks were successful
Run tests / Run tests on stackit-alpine (pull_request) Successful in 6s
Run tests / Run tests on stackit-alpine-bash (pull_request) Successful in 9s
Run tests / Run tests on stackit-docker (pull_request) Successful in 43s
fd32752170
feat: add missing fail flag, -eo pipefail in shell
Some checks failed
Run tests / Run tests on stackit-alpine-bash (pull_request) Failing after 7s
Run tests / Run tests on stackit-alpine (pull_request) Failing after 7s
Run tests / Run tests on stackit-docker (pull_request) Failing after 40s
5e4926449b
fix: remove pipefail option
All checks were successful
Run tests / Run tests on stackit-alpine-bash (pull_request) Successful in 12s
Run tests / Run tests on stackit-alpine (pull_request) Successful in 12s
Run tests / Run tests on stackit-docker (pull_request) Successful in 1m25s
ec8fe9e921
feat: add status code check
Some checks failed
Run tests / Run tests on stackit-alpine (pull_request) Has been cancelled
Run tests / Run tests on stackit-alpine-bash (pull_request) Has been cancelled
Run tests / Run tests on stackit-docker (pull_request) Has been cancelled
7f78809ab0
fix: remove -x flag
All checks were successful
Run tests / Run tests on stackit-alpine-bash (pull_request) Successful in 7s
Run tests / Run tests on stackit-alpine (pull_request) Successful in 7s
Run tests / Run tests on stackit-docker (pull_request) Successful in 46s
867ad00506
feat: write response body to temporary file
All checks were successful
Run tests / Run tests on stackit-alpine (pull_request) Successful in 8s
Run tests / Run tests on stackit-alpine-bash (pull_request) Successful in 10s
Run tests / Run tests on stackit-docker (pull_request) Successful in 38s
f7ba0e6440
maximilian.jugl deleted branch refactor/bash 2026-07-17 11:57:42 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
actions/secretsmanager!2
No description provided.