Last active 1769902804

riff'd off gist.github.com/bdrewery/9438353

Revision 71c24ed8bf94b4ed557c847b7b854871d6d50e63

bulk.sh Raw
1#!/bin/sh
2# /usr/local/etc/poudriere.d/hooks/bulk.sh
3
4[ -f "${POUDRIERED}/hooks/config" ] && . "${POUDRIERED}/hooks/config"
5
6bulk_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
37status="$1"
38shift
39
40case ${status} in
41 "done")
42 test $2 -le 0 && bulk_sync "$@"
43 ;;
44esac
45exit 0
config Raw
1NTFY_URL=https://ntfy.sh/xyz
2S3_ENDPOINT_URL=https://....compat.objectstorage.eu-amsterdam-1.oraclecloud.com/
3S3_CREDENTIALS_FILE=/root/.config/s5cmd/oci
4S3_PROFILE=poudriere
5# push packages up on completion
6SHOULD_SYNC_TO_S3=1
7# pull in custom packages from S3 prior to signing
8FETCH_PKG_FROM_S3=1
oci Raw
1[poudriere]
2region = eu-amsterdam-1
3aws_access_key_id = ...
4aws_secret_access_key = ...
5endpoint_url = ....compat.objectstorage.eu-amsterdam-1.oraclecloud.com
6
pkgrepo.sh Raw
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
7fetch_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
22status="$1"
23
24shift
25
26case ${status} in
27 "sign")
28 fetch_custom_packages "$@"
29 ;;
30esac
31exit 0