@@ -465,15 +465,27 @@ func contentDescriptorToLayer(cdesc []byte) (*Layer, error) {
465
465
)
466
466
}
467
467
468
+ var prestophookScript = `#!/bin/bash
469
+ cd ${GITPOD_REPO_ROOT}
470
+ git config --global --add safe.directory ${GITPOD_REPO_ROOT}
471
+ git status --porcelain=v2 --branch -uall > /.workspace/prestophookdata/git_status.txt
472
+ git log --pretty='%h: %s' --branches --not --remotes > /.workspace/prestophookdata/git_log_1.txt
473
+ git log --pretty=%H -n 1 > /.workspace/prestophookdata/git_log_2.txt
474
+ `
475
+
468
476
// version of this function for persistent volume claim feature
469
477
// we cannot use /workspace folder as when mounting /workspace folder through PVC
470
478
// it will mask anything that was in container layer, hence we are using /.workspace instead here
471
479
func contentDescriptorToLayerPVC (cdesc []byte ) (* Layer , error ) {
472
- return layerFromContent (
473
- fileInLayer {& tar.Header {Typeflag : tar .TypeDir , Name : "/.workspace" , Uid : initializer .GitpodUID , Gid : initializer .GitpodGID , Mode : 0755 }, nil },
474
- fileInLayer {& tar.Header {Typeflag : tar .TypeDir , Name : "/.workspace/.gitpod" , Uid : initializer .GitpodUID , Gid : initializer .GitpodGID , Mode : 0755 }, nil },
475
- fileInLayer {& tar.Header {Typeflag : tar .TypeReg , Name : "/.workspace/.gitpod/content.json" , Uid : initializer .GitpodUID , Gid : initializer .GitpodGID , Mode : 0755 , Size : int64 (len (cdesc ))}, cdesc },
476
- )
480
+ layers := []fileInLayer {
481
+ {& tar.Header {Typeflag : tar .TypeDir , Name : "/.workspace" , Uid : initializer .GitpodUID , Gid : initializer .GitpodGID , Mode : 0755 }, nil },
482
+ {& tar.Header {Typeflag : tar .TypeDir , Name : "/.workspace/.gitpod" , Uid : initializer .GitpodUID , Gid : initializer .GitpodGID , Mode : 0755 }, nil },
483
+ {& tar.Header {Typeflag : tar .TypeReg , Name : "/.supervisor/prestophook.sh" , Uid : 0 , Gid : 0 , Mode : 0775 , Size : int64 (len (prestophookScript ))}, []byte (prestophookScript )},
484
+ }
485
+ if len (cdesc ) > 0 {
486
+ layers = append (layers , fileInLayer {& tar.Header {Typeflag : tar .TypeReg , Name : "/.workspace/.gitpod/content.json" , Uid : initializer .GitpodUID , Gid : initializer .GitpodGID , Mode : 0755 , Size : int64 (len (cdesc ))}, cdesc })
487
+ }
488
+ return layerFromContent (layers ... )
477
489
}
478
490
479
491
func workspaceReadyLayer (src csapi.WorkspaceInitSource ) (* Layer , error ) {
0 commit comments