IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Explorar el Código

Add reusing of existing steps.

tags/0.92
Stanislaw Adaszewski hace 4 años
padre
commit
174ecdfb6d
Se han modificado 3 ficheros con 26 adiciones y 1 borrados
  1. +3
    -1
      Fockerfile
  2. +5
    -0
      image.py
  3. +18
    -0
      zfs.py

+ 3
- 1
Fockerfile Ver fichero

@@ -1,6 +1,8 @@
base: freebsd-12.1
base: freebsd-latest
steps:
- run: |
pkg -y install -y python3 && \
pkg -y install -y py37-pip
- run: |
pkg install -y py37-yaml

+ 5
- 0
image.py Ver fichero

@@ -38,6 +38,11 @@ def build(spec):
for st in steps:
st = create_step(st)
st_sha256 = st.hash(base_sha256)
if zfs_exists_snapshot_sha256(st_sha256):
base = zfs_snapshot_by_sha256(st_sha256)
base_sha256 = st_sha256
print('Reusing:', base)
continue
for pre in range(7, 64):
name = root + '/' + st_sha256[:pre]
if not zfs_exists(name):


+ 18
- 0
zfs.py Ver fichero

@@ -54,6 +54,24 @@ def zfs_mountpoint(name):
return lst[0][0]
def zfs_exists_snapshot_sha256(sha256):
lst = zfs_parse_output(['zfs', 'list', '-o', 'focker:sha256', '-t', 'snap'])
lst = list(filter(lambda a: a[0] == sha256, lst))
if len(lst) == 0:
return False
return True
def zfs_snapshot_by_sha256(sha256):
lst = zfs_parse_output(['zfs', 'list', '-o', 'focker:sha256,name', '-t', 'snap', '-H'])
lst = list(filter(lambda a: a[0] == sha256, lst))
if len(lst) == 0:
raise ValueError('Snapshot with given sha256 does not exist: ' + sha256)
if len(lst) > 1:
raise ValueError('Ambiguous snapshot sha256: ' + sha256)
return lst[0][1]
def zfs_init():
poolname = zfs_parse_output(['zfs', 'list', '-H', '/'])
if len(poolname) == 0:


Cargando…
Cancelar
Guardar