@@ -17,7 +17,6 @@ import (
17
17
"log"
18
18
"os"
19
19
"os/exec"
20
- "strings"
21
20
"time"
22
21
)
23
22
@@ -186,18 +185,25 @@ func RunSpecManualCommand(
186
185
usage .ReportErrorAndExit (spec .VCS .Actor , fmt .Sprintf ("could not download job artefact: %v" , err ), 1 )
187
186
}
188
187
zipPath := * absoluteFileName
189
- utils .ExtractZip (zipPath , tempDir )
190
- // Transforming: /var/temp/xxx/yyy/blabla.zip -> /var/temp/xxx/yyy/blabla
191
- gitLocation := strings .TrimSuffix (zipPath , ".zip" )
192
- log .Printf ("git location is: %v" , gitLocation )
193
- log .Printf ("zipPath: %v" , zipPath )
194
- f , err := os .Stat (tempDir )
195
- log .Printf ("files in %v : %v " , tempDir , f )
196
-
197
- err = os .Chdir (gitLocation )
198
- if err != nil {
199
- log .Printf ("Could not chdir: %v" , err )
200
- usage .ReportErrorAndExit (spec .VCS .Actor , fmt .Sprintf ("could not change directory: %v" , err ), 1 )
188
+ err = utils .ExtractZip (zipPath , tempDir )
189
+ if err != nil {
190
+ log .Printf ("ExtractZip err: %v" , err )
191
+ usage .ReportErrorAndExit (spec .VCS .Actor , fmt .Sprintf ("artefact zip extraction err: %v" , err ), 1 )
192
+
193
+ }
194
+
195
+ // remove the zipPath
196
+ err = os .Remove (zipPath )
197
+ if err != nil {
198
+ log .Printf ("os.Remove err: %v" , err )
199
+ usage .ReportErrorAndExit (spec .VCS .Actor , fmt .Sprintf ("zip path removal err: %v" , err ), 1 )
200
+ }
201
+
202
+ // Navigating to our diractory
203
+ err = os .Chdir (tempDir )
204
+ if err != nil {
205
+ log .Printf ("Chdir err: %v" , err )
206
+ usage .ReportErrorAndExit (spec .VCS .Actor , fmt .Sprintf ("Chdir err: %v" , err ), 1 )
201
207
}
202
208
203
209
cmd := exec .Command ("git" , "init" )
0 commit comments