-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add action to run a few Linux tools (#8)
Co-authored-by: Pedro Rodrigues <[email protected]>
- Loading branch information
1 parent
eaaa2d4
commit c3bb912
Showing
10 changed files
with
103 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ Simple wrapper action for running [envsubst] over a file or set of files. | |
## Usage | ||
|
||
```yaml | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
with: | ||
# One or more files to apply substitutions on (separated by space). | ||
input: '' | ||
|
@@ -35,7 +35,7 @@ Simple wrapper action for running [envsubst] over a file or set of files. | |
### Apply substitutions on a single file | ||
```yaml | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
with: | ||
input: template.yml | ||
output: deployment.yml | ||
|
@@ -44,7 +44,7 @@ Simple wrapper action for running [envsubst] over a file or set of files. | |
### Apply substitutions on multiple files | ||
```yaml | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
with: | ||
input: template.yml package.txt config.toml | ||
output: result.yml output.txt result.toml | ||
|
@@ -53,7 +53,7 @@ Simple wrapper action for running [envsubst] over a file or set of files. | |
### Apply substitutions in-place | ||
```yaml | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
with: | ||
input: deployment.yml | ||
in_place: true | ||
|
@@ -62,7 +62,7 @@ Simple wrapper action for running [envsubst] over a file or set of files. | |
### Apply substitutions with custom environment variables | ||
```yaml | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
with: | ||
input: template.yml | ||
output: result.yml | ||
|
@@ -74,15 +74,15 @@ Simple wrapper action for running [envsubst] over a file or set of files. | |
### Apply substitutions and print result to stdout | ||
```yaml | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
with: | ||
input: template.yml | ||
``` | ||
### Apply substitutions restricting to specific environment variables | ||
```yaml | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
with: | ||
input: template.yml | ||
format: '${CUSTOM_VAR} ${GITHUB_SHA}' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ An action to validate kustomization files and outputs using [Kustomize]. | |
## Usage | ||
|
||
```yaml | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
with: | ||
# Strategy to use for detecting kustomization directories. | ||
# Possible values | ||
|
@@ -40,9 +40,9 @@ An action to validate kustomization files and outputs using [Kustomize]. | |
### Validate all kustomization directories | ||
```yaml | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
# or | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
with: | ||
auto_discovery: all | ||
``` | ||
|
@@ -53,15 +53,15 @@ An action to validate kustomization files and outputs using [Kustomize]. | |
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # This is required to allow this action to detect modified files. | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
with: | ||
auto_discovery: modified | ||
``` | ||
### Validate specific kustomization directories | ||
```yaml | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
with: | ||
auto_discovery: static | ||
path: kustomize/base kustomize/overlays/production | ||
|
@@ -70,7 +70,7 @@ An action to validate kustomization files and outputs using [Kustomize]. | |
### Validate kustomization directories with custom log level | ||
```yaml | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
with: | ||
auto_discovery: all | ||
log_level: verbose | ||
|
@@ -79,7 +79,7 @@ An action to validate kustomization files and outputs using [Kustomize]. | |
### Validate kustomization directories with custom flags | ||
```yaml | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
with: | ||
auto_discovery: all | ||
flags: --load-restrictor=LoadRestrictionsNone --enable-alpha-plugins | ||
|
@@ -92,7 +92,7 @@ An action to validate kustomization files and outputs using [Kustomize]. | |
- uses: alexellis/arkade-get@master | ||
with: | ||
kustomize: latest | ||
- uses: hpedrorodrigues/actions/[email protected].4 | ||
- uses: hpedrorodrigues/actions/[email protected].5 | ||
with: | ||
auto_discovery: all | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ An action that sets up [Sphynx CLI]. | |
|
||
```yaml | ||
- name: Set up Sphynx | ||
uses: hpedrorodrigues/actions/[email protected].4 | ||
uses: hpedrorodrigues/actions/[email protected].5 | ||
``` | ||
[Sphynx CLI]: https://github.com/hpedrorodrigues/sphynx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ Checks files recursively against a canonical format using [Terraform][terraform] | |
|
||
```yaml | ||
- name: Lint | ||
uses: hpedrorodrigues/actions/[email protected].4 | ||
uses: hpedrorodrigues/actions/[email protected].5 | ||
``` | ||
[terraform]: https://www.terraform.io | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM ghcr.io/hpedrorodrigues/tools | ||
COPY entrypoint.sh / | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# tools | ||
|
||
Action that let you run a few Linux tools without the necessity to install them on the runner. | ||
|
||
List of pre-installed tools is [here](https://github.com/hpedrorodrigues/images/blob/main/tools/tools.apko.yaml). | ||
|
||
## Usage | ||
|
||
```yaml | ||
- name: Compress an example file | ||
uses: hpedrorodrigues/actions/[email protected] | ||
with: | ||
script: | | ||
FILE_NAME='example-file' | ||
zip -r ${FILE_NAME}.zip . | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: tools | ||
author: Pedro Rodrigues | ||
description: Let you run a few pre-installed Linux tools without the necessity to install them on the runner. | ||
inputs: | ||
script: | ||
description: Shell script to run inside the container. | ||
required: true | ||
branding: | ||
icon: activity | ||
color: gray-dark | ||
runs: | ||
using: docker | ||
image: Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bats | ||
|
||
setup() { | ||
export SINGLE_LINE_SCRIPT='echo "Hello!"' | ||
export MULTILINE_SCRIPT=' | ||
echo "Hi!" | ||
echo "Hello, world!" | ||
' | ||
} | ||
|
||
main() { | ||
sh "${BATS_TEST_DIRNAME}/entrypoint.sh" | ||
} | ||
|
||
@test 'Allow to run single line scripts' { | ||
# GitHub-provided environment variables | ||
export INPUT_SCRIPT="${SINGLE_LINE_SCRIPT}" | ||
|
||
run main | ||
[ "${status}" -eq 0 ] | ||
[ "${lines[0]}" = 'Hello!' ] | ||
} | ||
|
||
@test 'Allow to run multiline scripts' { | ||
# GitHub-provided environment variables | ||
export INPUT_SCRIPT="${MULTILINE_SCRIPT}" | ||
|
||
run main | ||
[ "${status}" -eq 0 ] | ||
[ "${lines[0]}" = 'Hi!' ] | ||
[ "${lines[1]}" = 'Hello, world!' ] | ||
} | ||
|
||
@test 'Print error message when no script is provided' { | ||
run main | ||
[ "${status}" -eq 1 ] | ||
[ "${lines[0]}" = 'No script provided!' ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
|
||
if ${VERBOSE:-false}; then | ||
set -o xtrace | ||
fi | ||
|
||
if [ -z "${INPUT_SCRIPT:-}" ]; then | ||
echo 'No script provided!' >&2 | ||
exit 1 | ||
fi | ||
|
||
eval "${INPUT_SCRIPT}" |