bulk.sh
· 1.3 KiB · Bash
Raw
#!/bin/sh
# /usr/local/etc/poudriere.d/hooks/bulk.sh
[ -f "${POUDRIERED}/hooks/config" ] && . "${POUDRIERED}/hooks/config"
bulk_sync() {
local arch=$(pkg info -f -F ${PACKAGES}/Latest/pkg.??? |
awk '$1 == "Architecture" {print $3}')
curl ${NTFY_URL} -d "$(hostname -s) ${arch} built $1 failed $2 ignored $3 skipped $4"
[ "${SHOULD_SYNC_TO_S3:-0}" -eq 1 ] || return 0
touch ${PACKAGES}/.commitid
(cd /usr/ports && git rev-parse HEAD > ${PACKAGES}/.commitid)
(cd ${PACKAGES} && s5cmd \
--endpoint-url ${S3_ENDPOINT_URL} \
--credentials-file ${S3_CREDENTIALS_FILE} \
--profile ${S3_PROFILE} \
sync --delete \
--include 'All/*.pkg' \
--include 'All/*.txz' \
--include 'Latest/pkg.*' \
--include .buildname \
--include .commitid \
--include .jailversion \
--include data.pkg \
--include meta.conf \
--include packagesite.pkg \
--no-follow-symlinks \
. \
s3://pkg/${arch}/ )
return 0
}
status="$1"
shift
case ${status} in
"done")
test $2 -le 0 && bulk_sync "$@"
;;
esac
exit 0
| 1 | #!/bin/sh |
| 2 | # /usr/local/etc/poudriere.d/hooks/bulk.sh |
| 3 | |
| 4 | [ -f "${POUDRIERED}/hooks/config" ] && . "${POUDRIERED}/hooks/config" |
| 5 | |
| 6 | bulk_sync() { |
| 7 | |
| 8 | local arch=$(pkg info -f -F ${PACKAGES}/Latest/pkg.??? | |
| 9 | awk '$1 == "Architecture" {print $3}') |
| 10 | |
| 11 | curl ${NTFY_URL} -d "$(hostname -s) ${arch} built $1 failed $2 ignored $3 skipped $4" |
| 12 | |
| 13 | [ "${SHOULD_SYNC_TO_S3:-0}" -eq 1 ] || return 0 |
| 14 | |
| 15 | touch ${PACKAGES}/.commitid |
| 16 | (cd /usr/ports && git rev-parse HEAD > ${PACKAGES}/.commitid) |
| 17 | (cd ${PACKAGES} && s5cmd \ |
| 18 | --endpoint-url ${S3_ENDPOINT_URL} \ |
| 19 | --credentials-file ${S3_CREDENTIALS_FILE} \ |
| 20 | --profile ${S3_PROFILE} \ |
| 21 | sync --delete \ |
| 22 | --include 'All/*.pkg' \ |
| 23 | --include 'All/*.txz' \ |
| 24 | --include 'Latest/pkg.*' \ |
| 25 | --include .buildname \ |
| 26 | --include .commitid \ |
| 27 | --include .jailversion \ |
| 28 | --include data.pkg \ |
| 29 | --include meta.conf \ |
| 30 | --include packagesite.pkg \ |
| 31 | --no-follow-symlinks \ |
| 32 | . \ |
| 33 | s3://pkg/${arch}/ ) |
| 34 | return 0 |
| 35 | } |
| 36 | |
| 37 | status="$1" |
| 38 | shift |
| 39 | |
| 40 | case ${status} in |
| 41 | "done") |
| 42 | test $2 -le 0 && bulk_sync "$@" |
| 43 | ;; |
| 44 | esac |
| 45 | exit 0 |
config
· 298 B · Text
Raw
NTFY_URL=https://ntfy.sh/xyz
S3_ENDPOINT_URL=https://....compat.objectstorage.eu-amsterdam-1.oraclecloud.com/
S3_CREDENTIALS_FILE=/root/.config/s5cmd/oci
S3_PROFILE=poudriere
# push packages up on completion
SHOULD_SYNC_TO_S3=1
# pull in custom packages from S3 prior to signing
FETCH_PKG_FROM_S3=1
| 1 | NTFY_URL=https://ntfy.sh/xyz |
| 2 | S3_ENDPOINT_URL=https://....compat.objectstorage.eu-amsterdam-1.oraclecloud.com/ |
| 3 | S3_CREDENTIALS_FILE=/root/.config/s5cmd/oci |
| 4 | S3_PROFILE=poudriere |
| 5 | # push packages up on completion |
| 6 | SHOULD_SYNC_TO_S3=1 |
| 7 | # pull in custom packages from S3 prior to signing |
| 8 | FETCH_PKG_FROM_S3=1 |
| 1 | [poudriere] |
| 2 | region = eu-amsterdam-1 |
| 3 | aws_access_key_id = ... |
| 4 | aws_secret_access_key = ... |
| 5 | endpoint_url = ....compat.objectstorage.eu-amsterdam-1.oraclecloud.com |
| 6 |
pkgrepo.sh
· 886 B · Bash
Raw
#!/bin/sh
# /usr/local/etc/poudriere.d/hooks/pkgrepo.sh
# PACKAGES PKG_REPO_SIGNING_KEY PKG_REPO_FROM_HOST PKG_REPO_META_FILE
[ -f "${POUDRIERED}/hooks/config" ] && . "${POUDRIERED}/hooks/config"
fetch_custom_packages() {
[ "${FETCH_PKG_FROM_S3:-0}" -eq 1 ] || return 0
arch=$(pkg info -f -F ${PACKAGES}/Latest/pkg.pkg |
awk '$1 == "Architecture" {print $3}')
/usr/local/bin/s5cmd \
--endpoint-url ${S3_ENDPOINT_URL} \
--credentials-file ${S3_CREDENTIALS_FILE} \
--profile ${S3_PROFILE} \
sync s3://pkg/indie/${arch}/\*.pkg ${PACKAGES}/All/
# ignore errors if there are no packages because indie:15:amd64/ "dir" is not present
return 0
}
status="$1"
shift
case ${status} in
"sign")
fetch_custom_packages "$@"
;;
esac
exit 0
| 1 | #!/bin/sh |
| 2 | # /usr/local/etc/poudriere.d/hooks/pkgrepo.sh |
| 3 | # PACKAGES PKG_REPO_SIGNING_KEY PKG_REPO_FROM_HOST PKG_REPO_META_FILE |
| 4 | |
| 5 | [ -f "${POUDRIERED}/hooks/config" ] && . "${POUDRIERED}/hooks/config" |
| 6 | |
| 7 | fetch_custom_packages() { |
| 8 | [ "${FETCH_PKG_FROM_S3:-0}" -eq 1 ] || return 0 |
| 9 | |
| 10 | arch=$(pkg info -f -F ${PACKAGES}/Latest/pkg.pkg | |
| 11 | awk '$1 == "Architecture" {print $3}') |
| 12 | |
| 13 | /usr/local/bin/s5cmd \ |
| 14 | --endpoint-url ${S3_ENDPOINT_URL} \ |
| 15 | --credentials-file ${S3_CREDENTIALS_FILE} \ |
| 16 | --profile ${S3_PROFILE} \ |
| 17 | sync s3://pkg/indie/${arch}/\*.pkg ${PACKAGES}/All/ |
| 18 | # ignore errors if there are no packages because indie:15:amd64/ "dir" is not present |
| 19 | return 0 |
| 20 | } |
| 21 | |
| 22 | status="$1" |
| 23 | |
| 24 | shift |
| 25 | |
| 26 | case ${status} in |
| 27 | "sign") |
| 28 | fetch_custom_packages "$@" |
| 29 | ;; |
| 30 | esac |
| 31 | exit 0 |