Skip to content

Commit f2ae12b

Browse files
committed
fix(mc): command to add sources
1 parent 07ee845 commit f2ae12b

2 files changed

Lines changed: 23 additions & 23 deletions

File tree

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030
3131
- name: Create test buckets
3232
run: |
33-
mc config host add minio1 http://localhost:9000 minio minio123
34-
mc config host add minio2 http://localhost:9001 minio minio123
33+
mc admin bucket remote add minio1 http://localhost:9000 minio minio123
34+
mc admin bucket remote add minio2 http://localhost:9001 minio minio123
3535
mc mb minio1/source
3636
mc mb minio2/destination
3737

mirrio.sh

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,44 @@ RETENTION=${RETENTION:-30d0h0m}
77
ADDITIONAL_PARAMETERS=${ADDITIONAL_PARAMETERS:---quiet}
88

99
function pushgateway {
10-
if [[ -n "${PUSHGATEWAY_URL}" ]]; then
11-
cat <<-EOF | curl --retry 3 --max-time 5 --silent --show-error --data-binary @- "${PUSHGATEWAY_URL}/metrics/job/mirrio/instance/${JOB_NAME}" >/dev/null
10+
if [[ -n "${PUSHGATEWAY_URL}" ]]; then
11+
cat <<-EOF | curl --retry 3 --max-time 5 --silent --show-error --data-binary @- "${PUSHGATEWAY_URL}/metrics/job/mirrio/instance/${JOB_NAME}" >/dev/null
1212
# TYPE mirrio_sync_failed gauge
1313
# HELP mirrio_sync_failed Whether the last sync failed
1414
mirrio_sync_failed $1
1515
EOF
16-
fi
16+
fi
1717
}
1818

1919
function check_env {
20-
for var in "$@"; do
21-
if [[ -z "${!var}" ]]; then
22-
echo "${var} is not set!"
23-
exit 1
24-
fi
25-
done
20+
for var in "$@"; do
21+
if [[ -z "${!var}" ]]; then
22+
echo "${var} is not set!"
23+
exit 1
24+
fi
25+
done
2626
}
2727

2828
function notify {
29-
pushgateway 1
30-
echo "ERROR: Unable to sync!"
29+
pushgateway 1
30+
echo "ERROR: Unable to sync!"
3131
}
3232

3333
check_env \
34-
SOURCE_URL \
35-
SOURCE_ACCESSKEY \
36-
SOURCE_SECRETKEY \
37-
DESTINATION_URL \
38-
DESTINATION_ACCESSKEY \
39-
DESTINATION_SECRETKEY \
40-
SOURCE_BUCKET \
41-
DESTINATION_BUCKET
34+
SOURCE_URL \
35+
SOURCE_ACCESSKEY \
36+
SOURCE_SECRETKEY \
37+
DESTINATION_URL \
38+
DESTINATION_ACCESSKEY \
39+
DESTINATION_SECRETKEY \
40+
SOURCE_BUCKET \
41+
DESTINATION_BUCKET
4242

4343
trap notify ERR
4444

45-
mc config host add source "${SOURCE_URL}" "${SOURCE_ACCESSKEY}" "${SOURCE_SECRETKEY}" --api S3v4
45+
mc admin bucket remote add source "${SOURCE_URL}" "${SOURCE_ACCESSKEY}" "${SOURCE_SECRETKEY}" --api S3v4
4646

47-
mc config host add destination "${DESTINATION_URL}" "${DESTINATION_ACCESSKEY}" "${DESTINATION_SECRETKEY}" --api S3v4
47+
mc admin bucket remote add destination "${DESTINATION_URL}" "${DESTINATION_ACCESSKEY}" "${DESTINATION_SECRETKEY}" --api S3v4
4848

4949
mc ls destination | grep -q "${DESTINATION_BUCKET}" || mc mb "destination/${DESTINATION_BUCKET}"
5050

0 commit comments

Comments
 (0)