Added MinIO
This commit is contained in:
55
minio/mc-cp/action.yaml
Normal file
55
minio/mc-cp/action.yaml
Normal 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
64
minio/mc-find/action.yaml
Normal 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
7
minio/mc/Dockerfile
Normal 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
39
minio/mc/action.yaml
Normal 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
25
minio/mc/entrypoint.sh
Normal 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
|
||||
Reference in New Issue
Block a user