@@ -9,3 +9,5 @@ steps: | |||||
- copy: | - copy: | ||||
- [ '/tmp/x', '/etc/x' ] | - [ '/tmp/x', '/etc/x' ] | ||||
- [ 'focker-compose.yml', '/etc/focker-compose.yml' ] | - [ 'focker-compose.yml', '/etc/focker-compose.yml' ] | ||||
- run: | | |||||
pkg install py37-certbot |
@@ -47,11 +47,11 @@ def build(spec, args): | |||||
name = root + '/' + st_sha256[:pre] | name = root + '/' + st_sha256[:pre] | ||||
if not zfs_exists(name): | if not zfs_exists(name): | ||||
break | break | ||||
snap_name = new_snapshot(base, lambda: st.execute(zfs_mountpoint(name), args=args), name) | |||||
feed = { | feed = { | ||||
'focker:sha256': st_sha256 | 'focker:sha256': st_sha256 | ||||
} | } | ||||
zfs_set_props(name, feed) | |||||
snap_name = new_snapshot(base, lambda: st.execute(zfs_mountpoint(name), args=args) and zfs_set_props(name, feed), name) | |||||
# zfs_set_props(name, feed) | |||||
# zfs_set_props(snap_name, feed) | # zfs_set_props(snap_name, feed) | ||||
base = snap_name | base = snap_name | ||||
base_sha256 = st_sha256 | base_sha256 = st_sha256 | ||||
@@ -7,8 +7,12 @@ import shutil | |||||
def jail_run(path, command): | def jail_run(path, command): | ||||
command = ['jail', '-c', 'host.hostname=' + os.path.split(path)[1], 'mount.devfs=1', 'interface=lo1', 'ip4.addr=127.0.1.0', 'path=' + path, 'command', '/bin/sh', '-c', command] | command = ['jail', '-c', 'host.hostname=' + os.path.split(path)[1], 'mount.devfs=1', 'interface=lo1', 'ip4.addr=127.0.1.0', 'path=' + path, 'command', '/bin/sh', '-c', command] | ||||
print('Running:', ' '.join(command)) | print('Running:', ' '.join(command)) | ||||
res = subprocess.run(command) | |||||
try: | |||||
res = subprocess.run(command) | |||||
finally: | |||||
subprocess.run(['umount', os.path.join(path, 'dev')]) | |||||
if res.returncode != 0: | if res.returncode != 0: | ||||
subprocess.run(['umount', os.path.join(path, 'dev')]) | |||||
raise RuntimeError('Command failed') | raise RuntimeError('Command failed') | ||||
@@ -11,10 +11,10 @@ def new_snapshot(base, fun, name): | |||||
zfs_run(['zfs', 'clone', base, name]) | zfs_run(['zfs', 'clone', base, name]) | ||||
try: | try: | ||||
fun() | fun() | ||||
zfs_run(['zfs', 'set', 'readonly=on', name]) | |||||
snap_name = name + '@1' | |||||
zfs_run(['zfs', 'snapshot', snap_name]) | |||||
except: | except: | ||||
zfs_run(['zfs', 'destroy', name]) | |||||
zfs_run(['zfs', 'destroy', '-f', name]) | |||||
raise | raise | ||||
zfs_run(['zfs', 'set', 'readonly=on', name]) | |||||
snap_name = name + '@1' | |||||
zfs_run(['zfs', 'snapshot', snap_name]) | |||||
return snap_name | return snap_name |