Added MinIO

This commit is contained in:
2023-04-27 23:18:14 -07:00
parent 0e2ef14a5a
commit a02e1dc69b
15 changed files with 212 additions and 101 deletions

View File

@@ -1,9 +1,8 @@
name: busybox name: busybox
description: "Run busybox commands." description: "Run busybox commands."
inputs: inputs:
#Note: Passing in "args" overwrites the arguments passed into the container directly.
args: args:
description: "Shell command to pass into busybox." description: "Shell arguments to pass into busybox."
required: true required: true
outputs: outputs:
console: console:
@@ -12,4 +11,4 @@ runs:
using: docker using: docker
image: Dockerfile image: Dockerfile
args: args:
- ${{ inputs.args }} - ${{ inputs.args }}

View File

@@ -7,9 +7,10 @@ echo "$OUTPUT"
#Output multiline strings. #Output multiline strings.
#https://trstringer.com/github-actions-multiline-strings/ #https://trstringer.com/github-actions-multiline-strings/
OUTPUT="${OUTPUT//'%'/'%25'}" if [[ -n "$OUTPUT" ]]; then
OUTPUT="${OUTPUT//$'\n'/'%0A'}" echo "console<<EOF" >> "$GITHUB_OUTPUT"
OUTPUT="${OUTPUT//$'\r'/'%0D'}" echo "$OUTPUT" >> "$GITHUB_OUTPUT"
echo "::set-output name=console::$OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT"
fi
exit $RESULT exit $RESULT

View File

@@ -1,18 +0,0 @@
# Container image that runs your code
FROM rockylinux:9.1
RUN dnf install -y \
rpm-sign \
unzip \
pinentry \
wget \
zip
COPY setup_gpg.sh /setup_gpg.sh
RUN chmod +x /setup_gpg.sh
RUN /setup_gpg.sh
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -1,15 +0,0 @@
name: rockylinux
description: "Run rockylinux commands."
inputs:
#Note: Passing in "args" overwrites the arguments passed into the container directly.
args:
description: "Shell arguments to pass into Rocky Linux."
required: true
outputs:
console:
description: "The console output of the command."
runs:
using: docker
image: Dockerfile
args:
- ${{ inputs.args }}

View File

@@ -1,17 +0,0 @@
#!/bin/sh
WORKDIR=${WORKDIR:-.}
cd "$WORKDIR"
ARGS="$@"
OUTPUT=$(bash -c "$ARGS")
RESULT=$?
echo "$OUTPUT"
#Output multiline strings.
#https://trstringer.com/github-actions-multiline-strings/
OUTPUT="${OUTPUT//'%'/'%25'}"
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
echo "::set-output name=console::$OUTPUT"
exit $RESULT

View File

@@ -1,29 +0,0 @@
#!/bin/bash
#Importing gpg key via cli
#https://d.sb/2016/11/gpg-inappropriate-ioctl-for-device-errors
GPG_CONF="$HOME/.gnupg/gpg.conf"
GPG_AGENT_CONF="$HOME/.gnupg/gpg-agent.conf"
function create_file
{
FILE_PATH="$1"
CONTENTS="$2"
DIR=$(dirname "$FILE_PATH")
mkdir -p "$DIR"
chmod 700 "$DIR"
echo "$CONTENTS" > "$FILE_PATH"
}
create_file "$GPG_CONF" "$(cat <<EOF
use-agent
pinentry-mode loopback
EOF
)"
create_file "$GPG_AGENT_CONF" "$(cat <<EOF
allow-loopback-pinentry
EOF
)"
echo "RELOADAGENT" | gpg-connect-agent

View File

@@ -1,9 +1,9 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0 ARG VERSION=6.0.401
FROM mcr.microsoft.com/dotnet/sdk:$VERSION
# https://github.com/dotnet-script/dotnet-script RUN apt update
#RUN dotnet tool install dotnet-script --tool-path /usr/bin RUN apt install curl -y
COPY ./startup.sh /startup.sh COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /startup.sh RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT [ "/startup.sh" ]

View File

@@ -1,11 +1,11 @@
name: "dotnet" name: dotnet
description: "Runs the specified dotnet command." description: "Run a dotnet command."
inputs: inputs:
command: command:
description: "The command to run." description: "Dotnet command to run."
required: false required: false
runs: runs:
using: docker using: 'docker'
image: Dockerfile image: 'Dockerfile'
args: args:
- ${{ inputs.command }} - ${{ inputs.command }}

2
dotnet/entrypoint.sh Normal file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
dotnet $@

View File

@@ -1,2 +0,0 @@
#!/bin/bash
dotnet $@

55
minio/mc-cp/action.yaml Normal file
View File

@@ -0,0 +1,55 @@
name: mc-cp
description: "Copy files to or from s3."
inputs:
target:
description: "Target file."
required: true
dest:
description: "Destination file."
required: true
accessKey:
description: "S3 access key."
required: true
secretKey:
description: "S3 secret key."
required: true
alias:
description: "S3 alias."
required: true
url:
description: "S3 url."
required: true
default: https://s3-us-gov-west-1.amazonaws.com
recursive:
description: "Is the command recursive."
required: true
default: "true"
tags:
description: "Tags as ampersand-separated list of key-value pairs."
required: true
default: ""
runs:
using: "composite"
steps:
- name: "Build command."
id: command
run: |
COMMAND="cp \"${{ inputs.target }}\" \"${{ inputs.dest }}\""
RECURSIVE="${{ inputs.recursive }}"
if [[ "$RECURSIVE" == "true" ]]; then
COMMAND="$COMMAND --recursive"
fi
TAGS="${{ inputs.tags }}"
if [[ -n "$TAGS" ]]; then
COMMAND="$COMMAND --tags $TAGS"
fi
echo "command=$COMMAND" >> "$GITHUB_OUTPUT"
shell: bash
- name: "Copy files to/from S3."
uses: act/common/minio/mc@master
with:
alias: ${{ inputs.alias }}
args: ${{ steps.command.outputs.command }}
accessKey: ${{ inputs.accessKey }}
secretKey: ${{ inputs.secretKey }}
url: ${{ inputs.url }}

64
minio/mc-find/action.yaml Normal file
View File

@@ -0,0 +1,64 @@
name: mc-find
description: "Find files in s3."
inputs:
accessKey:
description: "S3 access key."
required: true
secretKey:
description: "S3 secret key."
required: true
alias:
description: "S3 alias."
required: true
url:
description: "S3 url."
required: true
default: https://s3-us-gov-west-1.amazonaws.com
path:
description: "The path to search for."
required: true
args:
description: "Additional arguments."
required: false
outputs:
files:
description: "The path of the found file."
value: ${{ steps.output.outputs.files }}
success:
description: "Whether files were found."
value: ${{ steps.output.outputs.success }}
runs:
using: "composite"
steps:
- name: "Build command."
id: command
run: |
COMMAND="find '${{ inputs.path }}' ${{ inputs.args }}"
echo "command=$COMMAND" >> "$GITHUB_OUTPUT"
shell: bash
- name: "Find file in S3."
id: find
uses: act/common/minio/mc@master
with:
alias: ${{ inputs.alias }}
args: ${{ steps.command.outputs.command }}
accessKey: ${{ inputs.accessKey }}
secretKey: ${{ inputs.secretKey }}
url: ${{ inputs.url }}
catchErrors: true
- name: "Set output."
id: output
run: |
RESULT="${{ steps.find.outputs.exitCode }}"
if [[ "$RESULT" != "0" ]]; then
SUCCESS="false"
else
echo "files<<EOF" >> "$GITHUB_OUTPUT"
echo "${{ steps.find.outputs.console }}" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
SUCCESS="true"
fi
echo "success=$SUCCESS" >> "$GITHUB_OUTPUT"
shell: bash

7
minio/mc/Dockerfile Normal file
View File

@@ -0,0 +1,7 @@
# Container image that runs your code
FROM minio/mc:RELEASE.2023-01-11T03-14-16Z
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

39
minio/mc/action.yaml Normal file
View File

@@ -0,0 +1,39 @@
name: mc
description: "Run MinIO Client mc commands."
inputs:
args:
description: "Arguments to pass into mc."
required: true
alias:
description: "S3 alias."
required: true
default: s3
url:
description: "S3 URL."
required: true
default: https://s3-us-gov-west-1.amazonaws.com
accessKey:
description: "S3 access key."
required: true
secretKey:
description: "S3 secret key."
required: true
catchErrors:
description: "Whether or not errors should be handled."
required: false
outputs:
console:
description: "The console output of the aws command."
exitCode:
description: "How the program exited."
runs:
using: docker
image: Dockerfile
env:
CATCH_ERRORS: ${{ inputs.catchErrors }}
S3_URL: ${{ inputs.url }}
S3_ALIAS: ${{ inputs.alias }}
S3_ACCESS_KEY_ID: ${{ inputs.accessKey }}
S3_SECRET_ACCESS_KEY: ${{ inputs.secretKey }}
args:
- ${{ inputs.args }}

25
minio/mc/entrypoint.sh Normal file
View File

@@ -0,0 +1,25 @@
#!/bin/sh
ARGS="$@"
MC_CONFIG_DIR="/root/.mc"
mkdir -p "$MC_CONFIG_DIR"
mc --config-dir "$MC_CONFIG_DIR" alias set "$S3_ALIAS" "$S3_URL" "$S3_ACCESS_KEY_ID" "$S3_SECRET_ACCESS_KEY"
OUTPUT=$(bash -c "mc --config-dir $MC_CONFIG_DIR $ARGS")
RESULT=$?
echo "$OUTPUT"
#Output multiline strings.
#https://trstringer.com/github-actions-multiline-strings/
if [[ -n "$OUTPUT" ]]; then
echo "console<<EOF" >> "$GITHUB_OUTPUT"
echo "$OUTPUT" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
fi
echo "exitCode=$RESULT" >> "$GITHUB_OUTPUT"
if [[ "$CATCH_ERRORS" != "true" ]]; then
exit $RESULT
fi