Skip to content

Commit ea74301

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

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
@@ -2233,7 +2233,9 @@ The default is ``[download, upload]``.
22332233
``upload``
22342234
Use this archive to upload artifacts. To actually upload to the archive the
22352235
build must be performed with uploads enabled (``--upload``).
2236-
2236+
``managed``
2237+
This archive is managed, meaning the files can be iterated and deleted.
2238+
This is required for the archive command to work.
22372239
``cache``
22382240
Use this archive to cache downloaded artifacts from other archives. If a
22392241
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 canManage(self):
405+
return self.__managed and self._canManage()
406+
407+
def _canManage(self):
404408
return False
405409

406410
async def downloadPackage(self, step, buildId, audit, content, caches=[],
@@ -754,7 +758,7 @@ def __init__(self, spec):
754758
self.__fileMode = spec.get("fileMode")
755759
self.__dirMode = spec.get("directoryMode")
756760

757-
def canManage(self):
761+
def _canManage(self):
758762
return True
759763

760764
def _getPath(self, buildId, suffix):
@@ -879,7 +883,7 @@ def __retry(self, request):
879883
if not retry: return (False, e)
880884
retry = False
881885

882-
def canManage(self):
886+
def _canManage(self):
883887
return True
884888

885889
def _resetConnection(self):

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def doArchive(argv, bobRoot):
516516
archivers = []
517517
if args.local:
518518
# provide local directory as backend
519-
archivespec = [{"name" : "local", "backend": "file", "path": "{}".format(os.getcwd())}]
519+
archivespec = [{"name" : "local", "backend": "file", "path": "{}".format(os.getcwd()), "flags" : "[download, upload, managed]"}]
520520
archiver = getSingleArchiver(None, archivespec[0])
521521
archivers.append(archiver)
522522
else:

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
'backend' : str,
29862986
schema.Optional('name') : 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)