artifact_diff

package module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 12 Imported by: 0

README

Artifact Diff

Compare directories and zip/jar artifacts.

Artifact Diff helps to create reports in plain text, so a generic diff tool can highlight differences between two paths or archives.

Reports will be written in JSON, and YAML format.

Our use case was a migration of our build environment. We wanted to ensure that the new artifacts would be equivalent to the previous ones.

Install

The latest release is available at https://github.com/gesellix/artifact-diff/releases/latest.

You may also install the Golang package like this:

go install github.com/gesellix/artifact-diff/cmd/artifact-diff@latest

Usage

Please ensure that the binary is executable and in your $PATH.

artifact-diff -t <report directory> scan -s <path1> [-s pathN]
  • report directory: The reports for path1 and optionally pathN will be written to the report directory
  • path1: A directory or zip-compatible archive to be scanned
  • pathN (optional): Other directories or zip-compatible archives to be scanned

You can use artifact-diff -h to see a complete list of options.

Good to Know

Artifact Diff will extract archives into your $TEMP directory, so that archives inside archives can be examined, too. Please ensure that your storage has enough space for the extracted data. Temporary files will be removed automatically.

Credits

The example code from https://github.com/bitfield/tpg-tools helped to get started with Golang's filesystem abstraction.

License

Copyright (c) 2023 Tobias Gesellchen.

See the LICENSE file in the root directory.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildVersion

func BuildVersion() string

func Gunzip added in v0.3.1

func Gunzip(src, dest string) error

func Md5hash

func Md5hash(text string) string

func Untar added in v0.3.0

func Untar(src, dest string) error

func Unzip

func Unzip(src, dest string) error

Types

type ArtifactInfo

type ArtifactInfo struct {
	Path      string    `json:"path" yaml:"path"`
	Count     int       `json:"count" yaml:"count"`
	FileInfos FileInfos `json:"fileInfos" yaml:"fileInfos"`
}

func CollectFileInfos

func CollectFileInfos(path string) (*ArtifactInfo, error)

func WalkArchive

func WalkArchive(root string, zip string, unarchiver unarchiver) (*ArtifactInfo, error)

func WalkTree

func WalkTree(root string, rootFS fs.FS) (*ArtifactInfo, error)

func (*ArtifactInfo) AddFileInfo

func (d *ArtifactInfo) AddFileInfo(path string, info *FileInfo)

func (*ArtifactInfo) String

func (d *ArtifactInfo) String() string

func (*ArtifactInfo) WithFlattenedAndSortedFileInfos

func (d *ArtifactInfo) WithFlattenedAndSortedFileInfos() *FlatArtifactInfo

type FileInfo

type FileInfo struct {
	Path     string `json:"path" yaml:"path"`
	Filesize int64  `json:"filesize" yaml:"filesize"`
	Checksum string `json:"checksum" yaml:"checksum"`
}

func (*FileInfo) String

func (fi *FileInfo) String() string

type FileInfos

type FileInfos map[string]*FileInfo

func (FileInfos) String

func (i FileInfos) String() string

type FlatArtifactInfo

type FlatArtifactInfo struct {
	Path      string      `json:"path" yaml:"path"`
	Count     int         `json:"count" yaml:"count"`
	FileInfos []*FileInfo `json:"fileInfos" yaml:"fileInfos"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL