Repository navigation
Expand file tree
/
Copy pathaction.yaml
More file actions
56 lines (55 loc) · 2.41 KB
/
Copy pathaction.yaml
File metadata and controls
56 lines (55 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Visualize google cloud build graph
description: Create a graph of google cloud build steps by gcb-visualizer
inputs:
gcb-visualizer-version:
description: 'The version of https://github.com/RyanSiu1995/gcb-visualizer, starts with "v"'
required: false
default: v1.0.1
search-directories:
description: 'Comma separated list of dictionaries that cloudbuild.yaml files are searched'
required: false
default: .
filename-find-pattern:
description: 'Custom pattern for the "cloudbuild.yaml" file name. This value is used as a parameter of `find -name`. See: https://man7.org/linux/man-pages/man1/find.1.html'
required: false
default: cloudbuild.yaml
output-directory-relative-path:
description: 'Output directory of the output visualized image files. This value is used as a relative path from the path of the directory of the cloudbuild.yaml'
required: false
default: images
output-filetype:
description: 'The file extension of the output visualized image files. See https://github.com/RyanSiu1995/gcb-visualizer#current-features to check available options'
required: false
default: png
runs:
using: "composite"
steps:
- shell: bash
name: Install gcb-visualizer
env:
GCB_VISUALIZER_VERSION: "${{ inputs.gcb-visualizer-version}}"
run: |
set -o errexit
curl -L "https://github.com/RyanSiu1995/gcb-visualizer/releases/download/${GCB_VISUALIZER_VERSION}/gcb-visualizer.ubuntu.zip" -o /tmp/gcb-visualizer.ubuntu.zip
unzip /tmp/gcb-visualizer.ubuntu.zip -d /tmp
- shell: bash
name: run gcb-visualizer
env:
SEARCH_DIRECTORIES: "${{ inputs.search-directories }}"
FILENAME_FIND_PATTERN: "${{ inputs.filename-find-pattern }}"
OUTPUT_DIRECTORY_RELATIVE_PATH: "${{ inputs.output-directory-relative-path }}"
OUTPUT_FILETYPE: "${{ inputs.output-filetype }}"
run: |
set -o errexit
dirs=(${SEARCH_DIRECTORIES//,/ })
for dir in ${dirs[@]}
do
for srcpath in $(find "$dir" -name "$FILENAME_FIND_PATTERN")
do
destdir="$(dirname $srcpath)/${OUTPUT_DIRECTORY_RELATIVE_PATH}"
destpath="$destdir/$(basename $srcpath).${OUTPUT_FILETYPE}"
mkdir -p $destdir
echo "Visualize '$srcpath' as an image '$destpath'" 2>&1
/tmp/gcb-visualizer visualize $srcpath -o $destpath
done
done