bulk.sh
· 2.7 KiB · Bash
Raw
#!/bin/sh
#
# Copyright (c) 2013-2014 Bryan Drewery <bdrewery@FreeBSD.org>
# Copyright (c) 2025 Dave Cottlehuber <dch@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# /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 | # |
| 3 | # Copyright (c) 2013-2014 Bryan Drewery <bdrewery@FreeBSD.org> |
| 4 | # Copyright (c) 2025 Dave Cottlehuber <dch@FreeBSD.org> |
| 5 | |
| 6 | # All rights reserved. |
| 7 | # |
| 8 | # Redistribution and use in source and binary forms, with or without |
| 9 | # modification, are permitted provided that the following conditions |
| 10 | # are met: |
| 11 | # 1. Redistributions of source code must retain the above copyright |
| 12 | # notice, this list of conditions and the following disclaimer. |
| 13 | # 2. Redistributions in binary form must reproduce the above copyright |
| 14 | # notice, this list of conditions and the following disclaimer in the |
| 15 | # documentation and/or other materials provided with the distribution. |
| 16 | # |
| 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 18 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
| 21 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 22 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 23 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 24 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 25 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | # SUCH DAMAGE. |
| 28 | |
| 29 | # /usr/local/etc/poudriere.d/hooks/bulk.sh |
| 30 | |
| 31 | [ -f "${POUDRIERED}/hooks/config" ] && . "${POUDRIERED}/hooks/config" |
| 32 | |
| 33 | bulk_sync() { |
| 34 | |
| 35 | local arch=$(pkg info -f -F ${PACKAGES}/Latest/pkg.??? | |
| 36 | awk '$1 == "Architecture" {print $3}') |
| 37 | |
| 38 | curl ${NTFY_URL} -d "$(hostname -s) ${arch} built $1 failed $2 ignored $3 skipped $4" |
| 39 | |
| 40 | [ "${SHOULD_SYNC_TO_S3:-0}" -eq 1 ] || return 0 |
| 41 | |
| 42 | touch ${PACKAGES}/.commitid |
| 43 | (cd /usr/ports && git rev-parse HEAD > ${PACKAGES}/.commitid) |
| 44 | (cd ${PACKAGES} && s5cmd \ |
| 45 | --endpoint-url ${S3_ENDPOINT_URL} \ |
| 46 | --credentials-file ${S3_CREDENTIALS_FILE} \ |
| 47 | --profile ${S3_PROFILE} \ |
| 48 | sync --delete \ |
| 49 | --include 'All/*.pkg' \ |
| 50 | --include 'All/*.txz' \ |
| 51 | --include 'Latest/pkg.*' \ |
| 52 | --include .buildname \ |
| 53 | --include .commitid \ |
| 54 | --include .jailversion \ |
| 55 | --include data.pkg \ |
| 56 | --include meta.conf \ |
| 57 | --include packagesite.pkg \ |
| 58 | --no-follow-symlinks \ |
| 59 | . \ |
| 60 | s3://pkg/${arch}/ ) |
| 61 | return 0 |
| 62 | } |
| 63 | |
| 64 | status="$1" |
| 65 | shift |
| 66 | |
| 67 | case ${status} in |
| 68 | "done") |
| 69 | test $2 -le 0 && bulk_sync "$@" |
| 70 | ;; |
| 71 | esac |
| 72 | 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
· 2.2 KiB · Bash
Raw
#!/bin/sh
#
# Copyright (c) 2025 Dave Cottlehuber <dch@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# /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 | # |
| 3 | # Copyright (c) 2025 Dave Cottlehuber <dch@FreeBSD.org> |
| 4 | |
| 5 | # All rights reserved. |
| 6 | # |
| 7 | # Redistribution and use in source and binary forms, with or without |
| 8 | # modification, are permitted provided that the following conditions |
| 9 | # are met: |
| 10 | # 1. Redistributions of source code must retain the above copyright |
| 11 | # notice, this list of conditions and the following disclaimer. |
| 12 | # 2. Redistributions in binary form must reproduce the above copyright |
| 13 | # notice, this list of conditions and the following disclaimer in the |
| 14 | # documentation and/or other materials provided with the distribution. |
| 15 | # |
| 16 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 17 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
| 20 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 22 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 23 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 24 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 25 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 26 | # SUCH DAMAGE. |
| 27 | |
| 28 | # /usr/local/etc/poudriere.d/hooks/pkgrepo.sh |
| 29 | # PACKAGES PKG_REPO_SIGNING_KEY PKG_REPO_FROM_HOST PKG_REPO_META_FILE |
| 30 | |
| 31 | [ -f "${POUDRIERED}/hooks/config" ] && . "${POUDRIERED}/hooks/config" |
| 32 | |
| 33 | fetch_custom_packages() { |
| 34 | [ "${FETCH_PKG_FROM_S3:-0}" -eq 1 ] || return 0 |
| 35 | |
| 36 | arch=$(pkg info -f -F ${PACKAGES}/Latest/pkg.pkg | |
| 37 | awk '$1 == "Architecture" {print $3}') |
| 38 | |
| 39 | /usr/local/bin/s5cmd \ |
| 40 | --endpoint-url ${S3_ENDPOINT_URL} \ |
| 41 | --credentials-file ${S3_CREDENTIALS_FILE} \ |
| 42 | --profile ${S3_PROFILE} \ |
| 43 | sync s3://pkg/indie/${arch}/\*.pkg ${PACKAGES}/All/ |
| 44 | # ignore errors if there are no packages because indie:15:amd64/ "dir" is not present |
| 45 | return 0 |
| 46 | } |
| 47 | |
| 48 | status="$1" |
| 49 | |
| 50 | shift |
| 51 | |
| 52 | case ${status} in |
| 53 | "sign") |
| 54 | fetch_custom_packages "$@" |
| 55 | ;; |
| 56 | esac |
| 57 | exit 0 |