Add script to actually run the build.
This commit is contained in:
parent
9be646f943
commit
9599cfb577
@ -5,13 +5,67 @@ set -euo pipefail
|
|||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
COMMAND="$1"
|
function main {
|
||||||
shift 1
|
COMMAND="$1"
|
||||||
|
shift 1
|
||||||
|
|
||||||
if [ "$COMMAND" = "start" ]; then
|
if [ "$COMMAND" = "start" ]; then
|
||||||
echo "foo"
|
cmd_start "${@}"
|
||||||
elif [ "$COMMAND" = "stop" ]; then
|
elif [ "$COMMAND" = "stop" ]; then
|
||||||
echo "bar"
|
cmd_stop "${@}"
|
||||||
else
|
else
|
||||||
echo "baz"
|
die 1 "Unrecognized command: $COMMAND"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function die {
|
||||||
|
exit_code="$1"
|
||||||
|
shift 1
|
||||||
|
(>&2 echo "${@}")
|
||||||
|
exit "$exit_code"
|
||||||
|
}
|
||||||
|
|
||||||
|
function abort_if_jobs_running {
|
||||||
|
if [[ $(sudo poudriere status) != *"No running builds"* ]]; then
|
||||||
|
echo "There is already a poudriere build in progress, exiting."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function build {
|
||||||
|
poudriere pkgclean -y "$@"
|
||||||
|
poudriere bulk -J "${POUDRIERE_JOBS:-1}" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function cmd_start {
|
||||||
|
# Allow command failures without quitting the script because some
|
||||||
|
# package sets might fail whereas others may succeed based on which
|
||||||
|
# packages are in each set.
|
||||||
|
set +e
|
||||||
|
|
||||||
|
for conf in /opt/poudriere/build_configs/*; do
|
||||||
|
(
|
||||||
|
source "$conf"
|
||||||
|
build -j "$JAIL" -p "$PORTS" -z "$SET" -f /usr/local/etc/poudriere.d/$JAIL-$PORTS-$SET-pkglist
|
||||||
|
)
|
||||||
|
done
|
||||||
|
|
||||||
|
# Re-enable exiting on failed commands
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Cleanup old unused dist files
|
||||||
|
for conf in /opt/poudriere/build_configs/*; do
|
||||||
|
(
|
||||||
|
source "$conf"
|
||||||
|
poudriere distclean -y -p "$PORTS" -f /usr/local/etc/poudriere.d/$JAIL-$PORTS-$SET-pkglist
|
||||||
|
)
|
||||||
|
done
|
||||||
|
|
||||||
|
poudriere logclean -y 180
|
||||||
|
}
|
||||||
|
|
||||||
|
function cmd_stop {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
main "${@}"
|
||||||
|
@ -29,16 +29,16 @@
|
|||||||
- flock
|
- flock
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
# - name: Create directories
|
- name: Create directories
|
||||||
# file:
|
file:
|
||||||
# name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
# state: directory
|
state: directory
|
||||||
# mode: 0755
|
mode: 0755
|
||||||
# owner: root
|
owner: root
|
||||||
# group: wheel
|
group: wheel
|
||||||
# loop:
|
loop:
|
||||||
# - /usr/ports/distfiles
|
# - /usr/ports/distfiles
|
||||||
# - /opt/poudriere/build_configs
|
- /opt/poudriere/build_configs
|
||||||
# - /usr/local/poudriere/data/logs/bulk
|
# - /usr/local/poudriere/data/logs/bulk
|
||||||
|
|
||||||
- name: Install Configuration
|
- name: Install Configuration
|
||||||
@ -77,6 +77,15 @@
|
|||||||
- src: poudboot.bash
|
- src: poudboot.bash
|
||||||
dest: /usr/local/bin/poudboot
|
dest: /usr/local/bin/poudboot
|
||||||
|
|
||||||
|
- name: Install Configuration
|
||||||
|
template:
|
||||||
|
src: "build_config.j2"
|
||||||
|
dest: "/opt/poudriere/build_configs/{{ item.jail }}-{{ item.ports }}-{{ item.set }}"
|
||||||
|
owner: root
|
||||||
|
group: wheel
|
||||||
|
mode: 0600
|
||||||
|
loop: "{{ poudriere_builds }}"
|
||||||
|
|
||||||
- name: Get ports tree list
|
- name: Get ports tree list
|
||||||
command: poudriere ports -ln
|
command: poudriere ports -ln
|
||||||
register: ports_tree_list
|
register: ports_tree_list
|
||||||
|
3
ansible/roles/poudriere/templates/build_config.j2
Normal file
3
ansible/roles/poudriere/templates/build_config.j2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
JAIL={{ item.jail }}
|
||||||
|
PORTS={{ item.ports }}
|
||||||
|
SET={{ item.set }}
|
Loading…
x
Reference in New Issue
Block a user