- save_to_workspace (source, dest, path)
- restore_workspace (only
dest_dir
param)
TaskFlow
In one of my build as the code follows, there be 4 tasks: clone-> goBuild/nodeBuild -> dockerImg.
##clone task
steps: [
{ type: 'clone' },
{ type: 'save_to_workspace', contents: [{ source_dir: '.', dest_dir: './clone', paths: ['**'] }] },
##golang build
steps: [
{ type: 'restore_workspace', dest_dir: '.' },
..
{ type: 'save_to_workspace', contents: [{ source_dir: './clone/dist', dest_dir: './target_gin', paths: ['**'] }] },
##nodejs build
steps: [
{ type: 'restore_workspace', dest_dir: '.' },
...
{ type: 'save_to_workspace', contents: [{ source_dir: './clone/dist/binary', dest_dir: './target_ui', paths: ['ui/**'] }] },
##docker-img merge
steps: [
{ type: 'restore_workspace', dest_dir: '.' },
WorkspaceUsage
I just found that restore_workspace
copy all the workspace tar and then unTar. When some file/dir repeated, then failed in unTar.
To avoid this err I have to define diff topDir when save_to_workspace
with clone/target_gin/target_ui
by using dest_dir
.
Suggest
We can find that the clone
topDir in workspace isn’t used by the docker-img task, But still restored to the taskPod, cost more file transfer work and few build-time cost.
Can we just restore what we want to the building-container. Or any good ideas?