Skip to content

Commit 832f424

Browse files
committed
archive: add managed flag
used to specify archives that support deleting/iterating files, required for archive cmd
1 parent c373895 commit 832f424

File tree

6 files changed

+17
-8
lines changed

6 files changed

+17
-8
lines changed

Diff for: doc/manpages/bob-archive.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ Description
3232
-----------
3333

3434
The bob archive command can be used to manage binary artifact archives.
35-
The command works on the archives defined in the user configuration :ref:`archive <configuration-config-archive>`.
36-
The archives to work on need to be specified (`-l`, `-a`, `-b`).
37-
It needs write access to the recipe root folder to create an index cache.
35+
The command works on the archives defined in the user configuration :ref:`archive <configuration-config-archive>` .
36+
The archives require the `managed` flag.
37+
The archives to work on need to be explicitly specified (`-l`, `-a`, `-b`).
38+
Write access to the recipe root folder to create an index cache is required.
3839

3940
Artifacts are managed by the information included in their :ref:`Audit Trail
4041
<audit-trail>`. See the Audit Trail documentation for a detailed description of

Diff for: doc/manual/configuration.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -2232,7 +2232,9 @@ the following list for possible flags. The default is ``[download, upload]``.
22322232
``upload``
22332233
Use this archive to upload artifacts. To actually upload to the archive the
22342234
build must be performed with uploads enabled (``--upload``).
2235-
2235+
``managed``
2236+
This archive is managed, meaning the files can be iterated and deleted.
2237+
This is required for the archive command to work.
22362238
``cache``
22372239
Use this archive to cache downloaded artifacts from other archives. If a
22382240
binary artifact was successfully downloaded from another archive it will

Diff for: pym/bob/archive.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ def __init__(self, spec):
365365
self.__useLocal = "nolocal" not in flags
366366
self.__useJenkins = "nojenkins" not in flags
367367
self.__useCache = "cache" in flags
368+
self.__managed = "managed" in flags
368369
self.__wantDownloadLocal = False
369370
self.__wantDownloadJenkins = False
370371
self.__wantUploadLocal = False
@@ -401,6 +402,9 @@ def _openDownloadFile(self, buildId, suffix):
401402
raise ArtifactNotFoundError()
402403

403404
def archiveCmdSupported(self):
405+
return self.__managed and self._archiveCmdSupported()
406+
407+
def _archiveCmdSupported(self):
404408
return False
405409

406410
async def downloadPackage(self, step, buildId, audit, content, caches=[],
@@ -788,7 +792,7 @@ def __init__(self, spec):
788792
self.__fileMode = spec.get("fileMode")
789793
self.__dirMode = spec.get("directoryMode")
790794

791-
def archiveCmdSupported(self):
795+
def _archiveCmdSupported(self):
792796
return True
793797

794798
def _getPath(self, buildId, suffix):
@@ -903,7 +907,7 @@ def __init__(self, spec):
903907
self.__url = urllib.parse.urlparse(spec["url"])
904908
self.webdav = WebDav(spec)
905909

906-
def archiveCmdSupported(self):
910+
def _archiveCmdSupported(self):
907911
return True
908912

909913
def _resetConnection(self):

Diff for: pym/bob/cmds/archive.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ def doArchive(argv, bobRoot):
502502
archivers = []
503503
if args.local:
504504
# provide local directory as backend
505-
archivespec = [{"name" : "local", "backend": "file", "path": "{}".format(os.getcwd())}]
505+
archivespec = [{"name" : "local", "backend": "file", "path": "{}".format(os.getcwd()), "flags" : "[download, upload, managed]"}]
506506
archiver = getSingleArchiver(None, archivespec[0])
507507
if archiver.archiveCmdSupported():
508508
archivers.append(archiver)

Diff for: pym/bob/input.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2984,7 +2984,7 @@ def __init__(self):
29842984
baseArchive = {
29852985
'name' : str,
29862986
'backend' : str,
2987-
schema.Optional('flags') : schema.Schema(["download", "upload",
2987+
schema.Optional('flags') : schema.Schema(["download", "upload", "managed",
29882988
"nofail", "nolocal", "nojenkins", "cache"])
29892989
}
29902990
fileArchive = baseArchive.copy()

Diff for: test/black-box/archive/run.sh

+2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ archive:
1717
name: "local"
1818
backend: file
1919
path: "$(mangle_path "$archiveDir")"
20+
flags: [download, upload, managed]
2021
EOF
2122
if [[ "$1" == "multi" ]]; then
2223
cat >> default.yaml << EOF
2324
-
2425
name: "local2"
2526
backend: file
2627
path: "$(mangle_path "$archiveDir2")"
28+
flags: [download, upload, managed]
2729
EOF
2830
fi
2931
}

0 commit comments

Comments
 (0)