Skip to content

Commit 1599c47

Browse files
committed
object type info in object metadata in xray
Signed-off-by: Kyle Quest <[email protected]>
1 parent ce04df9 commit 1599c47

File tree

7 files changed

+152
-129
lines changed

7 files changed

+152
-129
lines changed

pkg/app/master/command/build/flags.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,39 +34,39 @@ const (
3434
FlagIncludeExeFile = "include-exe-file"
3535
FlagIncludeShell = "include-shell"
3636

37-
FlagIncludeDirBins = "include-dir-bins"
37+
FlagIncludeDirBins = "include-dir-bins"
3838
FlagIncludeDirBinsUsage = "Keep binaries in the target directory (executables or shared objects) and their dependencies, which could be in other locations"
3939

40-
FlagIncludeWorkdir = "include-workdir"
40+
FlagIncludeWorkdir = "include-workdir"
4141
FlagIncludeWorkdirUsage = "Keep files in working directory"
4242

4343
//TBD
4444
FlagWorkdirExclude = "workdir-exclude"
4545
FlagWorkdirExcludeUsage = "Exclude filter for artifacts when working directory is included"
4646

4747
FlagIncludeAppImageAddCopyAll = "include-app-image-addcopy-all" //TBD
48-
FlagIncludeAppImageRun = "include-app-image-run" //TBD
48+
FlagIncludeAppImageRun = "include-app-image-run" //TBD
4949

50-
FlagIncludeAppImageAll = "include-app-image-all"
51-
FlagIncludeAppImageAllUsage = "Keep everything in the app part of the container image"
50+
FlagIncludeAppImageAll = "include-app-image-all"
51+
FlagIncludeAppImageAllUsage = "Keep everything in the app part of the container image"
5252

53-
FlagAppImageStartInst = "app-image-start-instruction"
54-
FlagAppImageStartInstUsage = "Instruction (prefix) that indicates where the app starts in the container image"
53+
FlagAppImageStartInst = "app-image-start-instruction"
54+
FlagAppImageStartInstUsage = "Instruction (prefix) that indicates where the app starts in the container image"
5555

5656
FlagAppImageStartLayerCount = "app-image-start-layer-count" //TBD
5757

58-
FlagAppImageStartInstGroup = "app-image-start-instruction-group"
58+
FlagAppImageStartInstGroup = "app-image-start-instruction-group"
5959
FlagAppImageStartInstGroupUsage = "Instruction group (reverse) index that indicates where the app starts in the container image"
6060

61-
FlagAppImageStartDetect = "app-image-start-detect" //TBD
61+
FlagAppImageStartDetect = "app-image-start-detect" //TBD
6262

6363
FlagAppImageDockerfile = "app-image-dockerfile" //TODO: make it work with FlagBuildFromDockerfile too
64-
FlagAppImageDockerfileUsage = "Path to app image Dockerfile (used to determine where the application part of the image starts)"
64+
FlagAppImageDockerfileUsage = "Path to app image Dockerfile (used to determine where the application part of the image starts)"
6565

66-
FlagIncludePathsCreportFile = "include-paths-creport-file"
66+
FlagIncludePathsCreportFile = "include-paths-creport-file"
6767
FlagIncludePathsCreportFileUsage = "Keep files from the referenced creport"
6868

69-
FlagIncludeOSLibsNet = "include-oslibs-net"
69+
FlagIncludeOSLibsNet = "include-oslibs-net"
7070
FlagIncludeOSLibsNetUsage = "Keep the common networking OS libraries"
7171

7272
FlagIncludeSSHClient = "include-ssh-client"

pkg/app/master/command/merge/handler.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -446,18 +446,3 @@ func tarFromMap(logger *log.Entry, outputPath string, tarMap map[string]*tfInfo)
446446

447447
return out.Name(), nil
448448
}
449-
450-
func TarTypeName(flag byte) string {
451-
switch flag {
452-
case tar.TypeDir:
453-
return "dir"
454-
case tar.TypeReg, tar.TypeRegA:
455-
return "file"
456-
case tar.TypeSymlink:
457-
return "symlink"
458-
case tar.TypeLink:
459-
return "hardlink"
460-
default:
461-
return fmt.Sprintf("%v", flag)
462-
}
463-
}

pkg/app/sensor/artifact/artifact.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -769,21 +769,21 @@ func (p *store) prepareArtifacts() {
769769

770770
bprops.Flags = p.getArtifactFlags(bpath)
771771

772-
fsType := "unknown"
772+
fsType := report.UnknownArtifactTypeName
773773
switch {
774774
case bpathFileInfo.Mode().IsRegular():
775-
fsType = "file"
775+
fsType = report.FileArtifactTypeName
776776
p.rawNames[bpath] = bprops
777777
//use a separate file map, so we can save them last
778778
//in case we are dealing with intermediate symlinks
779779
//and to better track what bin deps are not covered by dynamic analysis
780780
p.saFileMap[bpath] = bprops
781781
case (bpathFileInfo.Mode() & os.ModeSymlink) != 0:
782-
fsType = "symlink"
782+
fsType = report.SymlinkArtifactTypeName
783783
p.linkMap[bpath] = bprops
784784
p.rawNames[bpath] = bprops
785785
default:
786-
fsType = "unexpected"
786+
fsType = report.UnexpectedArtifactTypeName
787787
log.Debugf("prepareArtifacts.binArtifacts[bsa] - unexpected ft - %s", bpath)
788788
}
789789

0 commit comments

Comments
 (0)