Compare commits
6 commits
Author | SHA1 | Date | |
---|---|---|---|
e9601a51be | |||
383cef7e60 | |||
5e62916e92 | |||
24469d6105 | |||
0ad61179b5 | |||
ebd9608380 |
7 changed files with 116 additions and 4 deletions
|
@ -38,7 +38,7 @@ jobs:
|
|||
- /buildkit-certs:/buildkit-certs
|
||||
steps:
|
||||
- name: ⏬ Checkout code repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v4.1.7
|
||||
|
||||
- name: 📌 Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
|
|
|
@ -30,7 +30,7 @@ jobs:
|
|||
image: devthefuture/act-runner:latest
|
||||
steps:
|
||||
- name: 🎡 Check out the Helm chart repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v4.1.7
|
||||
with:
|
||||
repository: "${{ github.repository_owner }}/appsets"
|
||||
token: ${{ secrets.M8A_ORG_BOT_REPO_TOKEN }}
|
||||
|
|
5
minio-upload/Dockerfile
Normal file
5
minio-upload/Dockerfile
Normal file
|
@ -0,0 +1,5 @@
|
|||
FROM minio/mc:RELEASE.2024-06-24T19-40-33Z.fips
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
7
minio-upload/README.md
Normal file
7
minio-upload/README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# minio Action
|
||||
|
||||
This action allows you to upload objects to a MinIO server
|
||||
|
||||
|
||||
---
|
||||
forked from https://github.com/cloudkernels/minio-upload
|
35
minio-upload/action.yml
Normal file
35
minio-upload/action.yml
Normal file
|
@ -0,0 +1,35 @@
|
|||
# action.yml
|
||||
|
||||
name: minio-upload
|
||||
description: "Action that lets you upload objects from a MinIO server"
|
||||
inputs:
|
||||
url:
|
||||
description: "URL of the MinIO server"
|
||||
required: true
|
||||
access-key:
|
||||
description: "Access Key for the MinIO server"
|
||||
required: true
|
||||
secret-key:
|
||||
description: "Secret Key for the MinIO server"
|
||||
required: true
|
||||
local-path:
|
||||
description: 'Path of the local object'
|
||||
required: true
|
||||
default: './'
|
||||
remote-path:
|
||||
description: 'Path to remote object'
|
||||
required: true
|
||||
policy:
|
||||
description: 'Policy'
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
args:
|
||||
- ${{ inputs.url }}
|
||||
- ${{ inputs.access-key }}
|
||||
- ${{ inputs.secret-key }}
|
||||
- ${{ inputs.local-path }}
|
||||
- ${{ inputs.remote-path }}
|
||||
- ${{ inputs.policy }}
|
62
minio-upload/entrypoint.sh
Executable file
62
minio-upload/entrypoint.sh
Executable file
|
@ -0,0 +1,62 @@
|
|||
#!/bin/bash
|
||||
|
||||
LOG_NAME="minio"
|
||||
|
||||
info() {
|
||||
[ -t 1 ] && [ -n "$TERM" ] \
|
||||
&& echo "$(tput setaf 2)[$LOG_NAME]$(tput sgr0) $*" \
|
||||
|| echo "[$LOG_NAME] $*"
|
||||
}
|
||||
|
||||
err() {
|
||||
[ -t 2 ] && [ -n "$TERM" ] \
|
||||
&& echo -e "$(tput setaf 1)[$LOG_NAME]$(tput sgr0) $*" 1>&2 \
|
||||
|| echo -e "[$LOG_NAME] $*" 1>&2
|
||||
}
|
||||
|
||||
die() {
|
||||
err "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
ok_or_die() {
|
||||
if [ $? -ne 0 ]; then
|
||||
die $1
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ $# -lt 5 ]] ; then
|
||||
die "Usage: $0 url access_key secret_key local_path remote_path"
|
||||
fi
|
||||
|
||||
url=$1
|
||||
access_key=$2
|
||||
secret_key=$3
|
||||
local_path=$4
|
||||
remote_path=$5
|
||||
|
||||
mc alias set s3 $url $access_key $secret_key
|
||||
ok_or_die "Could not set mc alias"
|
||||
|
||||
if [[ "$local_path" == */ ]]; then
|
||||
copy_command="mc cp -r"
|
||||
else
|
||||
copy_command="mc cp"
|
||||
fi
|
||||
|
||||
IFS=' ' read -r -a remote_paths <<< "$remote_path"
|
||||
for rpath in "${remote_paths[@]}"; do
|
||||
info "Will upload $local_path to $rpath"
|
||||
$copy_command "$local_path" "s3/$rpath"
|
||||
ok_or_die "Could not upload object"
|
||||
done
|
||||
|
||||
if [[ $# -eq 6 ]] ; then
|
||||
if [[ $6 -eq 1 ]] ; then
|
||||
info "Will make $remote_path public"
|
||||
mc anonymous -r set download s3/$remote_path
|
||||
else
|
||||
info "Will make $remote_path private"
|
||||
mc anonymous -r set private s3/$remote_path || true
|
||||
fi
|
||||
fi
|
|
@ -46,11 +46,14 @@ const main = async () => {
|
|||
for (const env of envs) {
|
||||
const { name, key = cdKey, tag = defaultTag } = app;
|
||||
const valuesFile = `apps/${name}/envs/${env}/values.yaml`;
|
||||
console.log(`${valuesFile} -> ${key}=${tag}`);
|
||||
const keys = key.split(",")
|
||||
const valuesFilePath = `${workingDir}/${valuesFile}`;
|
||||
const valuesRaw = await fs.readFile(valuesFilePath, { encoding: "utf-8" })
|
||||
const values = yaml.parse(valuesRaw);
|
||||
set(values, key, tag);
|
||||
for(const k of keys){
|
||||
console.log(`${valuesFile} -> ${k}=${tag}`);
|
||||
set(values, k, tag);
|
||||
}
|
||||
await fs.writeFile(valuesFilePath, yaml.stringify(values));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue