All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
65 lines
2.5 KiB
YAML
65 lines
2.5 KiB
YAML
# 只调度到你的 macOS 本机 agent(local/exec)
|
||
labels:
|
||
host: Mac-mini.local
|
||
platform: darwin/arm64
|
||
gpu: metal
|
||
when:
|
||
event: [push, manual, pull_request]
|
||
steps:
|
||
- name: create some file
|
||
image: /bin/zsh
|
||
commands:
|
||
- echo "Hello, World!" > hello.txt
|
||
|
||
- name: upload-hello-txt
|
||
image: /bin/zsh
|
||
environment:
|
||
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
|
||
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
|
||
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
|
||
S3_BUCKET: ${S3_BUCKET}
|
||
S3_ENDPOINT: ${S3_ENDPOINT}
|
||
commands:
|
||
- |
|
||
set -e
|
||
echo "=== 调试信息 ==="
|
||
echo "AWS_ACCESS_KEY_ID is set: $([[ -n "$AWS_ACCESS_KEY_ID" ]] && echo 'YES' || echo 'NO')"
|
||
echo "AWS_SECRET_ACCESS_KEY is set: $([[ -n "$AWS_SECRET_ACCESS_KEY" ]] && echo 'YES' || echo 'NO')"
|
||
echo "S3_BUCKET is set: $([[ -n "$S3_BUCKET" ]] && echo 'YES' || echo 'NO')"
|
||
echo "S3_ENDPOINT value: ${S3_ENDPOINT:-'NOT SET'}"
|
||
echo "================"
|
||
|
||
if [[ -n "$AWS_ACCESS_KEY_ID" && -n "$AWS_SECRET_ACCESS_KEY" && -n "$S3_BUCKET" ]]; then
|
||
echo "Uploading hello.txt to S3..."
|
||
export PLUGIN_SOURCE="hello.txt"
|
||
export PLUGIN_BUCKET="$S3_BUCKET"
|
||
export PLUGIN_TARGET="woodpecker-test/"
|
||
[[ -n "$S3_ENDPOINT" ]] && export PLUGIN_ENDPOINT="$S3_ENDPOINT" && export PLUGIN_PATH_STYLE=true
|
||
plugin-s3
|
||
echo "✅ hello.txt uploaded successfully!"
|
||
else
|
||
echo "⚠️ No S3 credentials found. Skipping upload."
|
||
fi
|
||
|
||
- name: s3-upload-demo
|
||
image: /bin/zsh
|
||
environment:
|
||
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
|
||
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
|
||
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
|
||
S3_BUCKET: ${S3_BUCKET}
|
||
S3_ENDPOINT: ${S3_ENDPOINT}
|
||
commands:
|
||
- |
|
||
set -e
|
||
if [[ -n "$AWS_ACCESS_KEY_ID" && -n "$AWS_SECRET_ACCESS_KEY" && -n "$S3_BUCKET" ]]; then
|
||
echo "Hello S3 from Woodpecker at $(date)" > s3-demo.txt
|
||
# plugin-s3 的环境变量(与容器版一致)
|
||
export PLUGIN_SOURCE="s3-demo.txt"
|
||
export PLUGIN_BUCKET="$S3_BUCKET"
|
||
export PLUGIN_TARGET="woodpecker-demo/"
|
||
[[ -n "$S3_ENDPOINT" ]] && export PLUGIN_ENDPOINT="$S3_ENDPOINT" && export PLUGIN_PATH_STYLE=true
|
||
plugin-s3
|
||
else
|
||
echo "No S3 creds found. Skipping s3-upload-demo."
|
||
fi |