File tree Expand file tree Collapse file tree 6 files changed +138
-0
lines changed Expand file tree Collapse file tree 6 files changed +138
-0
lines changed Original file line number Diff line number Diff line change 10
10
- name : branch
11
11
default : master
12
12
tasks :
13
+ - name : init
14
+ workspaces :
15
+ - name : source
16
+ workspace : pipeline-workspace
17
+ taskRef :
18
+ name : cleanup
19
+
13
20
- name : clone
14
21
workspaces :
15
22
- name : output
21
28
value : $(params.repo-url)
22
29
- name : revision
23
30
value : $(params.branch)
31
+ runAfter :
32
+ - init
24
33
25
34
- name : lint
26
35
taskRef :
Original file line number Diff line number Diff line change 12
12
image : alpine:3
13
13
command : [/bin/echo]
14
14
args : ["$(params.message)"]
15
+
16
+ ---
17
+ apiVersion : tekton.dev/v1beta1
18
+ kind : Task
19
+ metadata :
20
+ name : cleanup
21
+ spec :
22
+ description : This task will clean up a workspace by deleting all of the files.
23
+ workspaces :
24
+ - name : source
25
+ steps :
26
+ - name : remove
27
+ image : alpine:3
28
+ env :
29
+ - name : WORKSPACE_SOURCE_PATH
30
+ value : $(workspaces.source.path)
31
+ workingDir : $(workspaces.source.path)
32
+ securityContext :
33
+ runAsNonRoot : false
34
+ runAsUser : 0
35
+ script : |
36
+ #!/usr/bin/env sh
37
+ set -eu
38
+ echo "Removing all files from ${WORKSPACE_SOURCE_PATH} ..."
39
+ # Delete any existing contents of the directory if it exists.
40
+ #
41
+ # We don't just "rm -rf ${WORKSPACE_SOURCE_PATH}" because ${WORKSPACE_SOURCE_PATH} might be "/"
42
+ # or the root of a mounted volume.
43
+ if [ -d "${WORKSPACE_SOURCE_PATH}" ] ; then
44
+ # Delete non-hidden files and directories
45
+ rm -rf "${WORKSPACE_SOURCE_PATH:?}"/*
46
+ # Delete files and directories starting with . but excluding ..
47
+ rm -rf "${WORKSPACE_SOURCE_PATH}"/.[!.]*
48
+ # Delete files and directories starting with .. plus any other character
49
+ rm -rf "${WORKSPACE_SOURCE_PATH}"/..?*
50
+ fi
51
+
Original file line number Diff line number Diff line change 10
10
- name : branch
11
11
default : master
12
12
tasks :
13
+ - name : init
14
+ workspaces :
15
+ - name : source
16
+ workspace : pipeline-workspace
17
+ taskRef :
18
+ name : cleanup
19
+
13
20
- name : clone
14
21
workspaces :
15
22
- name : output
21
28
value : $(params.repo-url)
22
29
- name : revision
23
30
value : $(params.branch)
31
+ runAfter :
32
+ - init
24
33
25
34
- name : lint
26
35
workspaces :
Original file line number Diff line number Diff line change 12
12
image : alpine:3
13
13
command : [/bin/echo]
14
14
args : ["$(params.message)"]
15
+
16
+ ---
17
+ apiVersion : tekton.dev/v1beta1
18
+ kind : Task
19
+ metadata :
20
+ name : cleanup
21
+ spec :
22
+ description : This task will clean up a workspace by deleting all of the files.
23
+ workspaces :
24
+ - name : source
25
+ steps :
26
+ - name : remove
27
+ image : alpine:3
28
+ env :
29
+ - name : WORKSPACE_SOURCE_PATH
30
+ value : $(workspaces.source.path)
31
+ workingDir : $(workspaces.source.path)
32
+ securityContext :
33
+ runAsNonRoot : false
34
+ runAsUser : 0
35
+ script : |
36
+ #!/usr/bin/env sh
37
+ set -eu
38
+ echo "Removing all files from ${WORKSPACE_SOURCE_PATH} ..."
39
+ # Delete any existing contents of the directory if it exists.
40
+ #
41
+ # We don't just "rm -rf ${WORKSPACE_SOURCE_PATH}" because ${WORKSPACE_SOURCE_PATH} might be "/"
42
+ # or the root of a mounted volume.
43
+ if [ -d "${WORKSPACE_SOURCE_PATH}" ] ; then
44
+ # Delete non-hidden files and directories
45
+ rm -rf "${WORKSPACE_SOURCE_PATH:?}"/*
46
+ # Delete files and directories starting with . but excluding ..
47
+ rm -rf "${WORKSPACE_SOURCE_PATH}"/.[!.]*
48
+ # Delete files and directories starting with .. plus any other character
49
+ rm -rf "${WORKSPACE_SOURCE_PATH}"/..?*
50
+ fi
51
+
15
52
---
16
53
apiVersion : tekton.dev/v1beta1
17
54
kind : Task
Original file line number Diff line number Diff line change 11
11
- name : branch
12
12
default : master
13
13
tasks :
14
+ - name : init
15
+ workspaces :
16
+ - name : source
17
+ workspace : pipeline-workspace
18
+ taskRef :
19
+ name : cleanup
20
+
14
21
- name : clone
15
22
workspaces :
16
23
- name : output
22
29
value : $(params.repo-url)
23
30
- name : revision
24
31
value : $(params.branch)
32
+ runAfter :
33
+ - init
25
34
26
35
- name : lint
27
36
workspaces :
Original file line number Diff line number Diff line change 12
12
image : alpine:3
13
13
command : [/bin/echo]
14
14
args : ["$(params.message)"]
15
+
16
+ ---
17
+ apiVersion : tekton.dev/v1beta1
18
+ kind : Task
19
+ metadata :
20
+ name : cleanup
21
+ spec :
22
+ description : This task will clean up a workspace by deleting all of the files.
23
+ workspaces :
24
+ - name : source
25
+ steps :
26
+ - name : remove
27
+ image : alpine:3
28
+ env :
29
+ - name : WORKSPACE_SOURCE_PATH
30
+ value : $(workspaces.source.path)
31
+ workingDir : $(workspaces.source.path)
32
+ securityContext :
33
+ runAsNonRoot : false
34
+ runAsUser : 0
35
+ script : |
36
+ #!/usr/bin/env sh
37
+ set -eu
38
+ echo "Removing all files from ${WORKSPACE_SOURCE_PATH} ..."
39
+ # Delete any existing contents of the directory if it exists.
40
+ #
41
+ # We don't just "rm -rf ${WORKSPACE_SOURCE_PATH}" because ${WORKSPACE_SOURCE_PATH} might be "/"
42
+ # or the root of a mounted volume.
43
+ if [ -d "${WORKSPACE_SOURCE_PATH}" ] ; then
44
+ # Delete non-hidden files and directories
45
+ rm -rf "${WORKSPACE_SOURCE_PATH:?}"/*
46
+ # Delete files and directories starting with . but excluding ..
47
+ rm -rf "${WORKSPACE_SOURCE_PATH}"/.[!.]*
48
+ # Delete files and directories starting with .. plus any other character
49
+ rm -rf "${WORKSPACE_SOURCE_PATH}"/..?*
50
+ fi
51
+
15
52
---
16
53
apiVersion : tekton.dev/v1beta1
17
54
kind : Task
You can’t perform that action at this time.
0 commit comments