File tree 2 files changed +18
-4
lines changed
2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 72
72
build_or_job .artifacts ()
73
73
# end artifacts
74
74
75
- # stream artifacts
75
+ # stream artifacts with class
76
76
class Foo (object ):
77
77
def __init__ (self ):
78
78
self ._fd = open ('artifacts.zip' , 'wb' )
@@ -83,7 +83,15 @@ def __call__(self, chunk):
83
83
target = Foo ()
84
84
build_or_job .artifacts (streamed = True , action = target )
85
85
del (target ) # flushes data on disk
86
- # end stream artifacts
86
+ # end stream artifacts with class
87
+
88
+ # stream artifacts with unzip
89
+ zipfn = "___artifacts.zip"
90
+ with open (zipfn , "wb" ) as f :
91
+ build_or_job .artifacts (streamed = True , action = f .write )
92
+ subprocess .run (["unzip" , "-bo" , zipfn ])
93
+ os .unlink (zipfn )
94
+ # end stream artifacts with unzip
87
95
88
96
# keep artifacts
89
97
build_or_job .keep_artifacts ()
Original file line number Diff line number Diff line change @@ -201,8 +201,14 @@ You can download artifacts as a stream. Provide a callable to handle the
201
201
stream:
202
202
203
203
.. literalinclude :: builds.py
204
- :start-after: # stream artifacts
205
- :end-before: # end stream artifacts
204
+ :start-after: # stream artifacts with class
205
+ :end-before: # end stream artifacts with class
206
+
207
+ In this second example, you can directly stream the output into a file, and unzip it afterwards:
208
+
209
+ .. literalinclude :: builds.py
210
+ :start-after: # stream artifacts with unzip
211
+ :end-before: # end stream artifacts with unzip
206
212
207
213
Mark a job artifact as kept when expiration is set:
208
214
You can’t perform that action at this time.
0 commit comments