Skip to content

Commit

Permalink
[RSDK-9086] Move from git lfs to artifact (#23)
Browse files Browse the repository at this point in the history
* Initial artifact impl

* Point to new storage dir

* Use artifact clean to delete tmp storage files

* Remove git lfs files

* Config fix

* Add const for artifact path

* Use artifactStoragePath in config tests
  • Loading branch information
seanavery authored Oct 22, 2024
1 parent bacbbed commit a4aa3ab
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 23 deletions.
12 changes: 12 additions & 0 deletions .artifact/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"cache": "cache",
"root": "data",
"source_store":
{
"type": "google_storage",
"bucket": "viam-artifacts"
},
"ignore": [
".DS_Store"
]
}
26 changes: 26 additions & 0 deletions .artifact/tree.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"2024-09-06_15-00-03.mp4": {
"hash": "51ddfed2c6edf7068d4baafa424d2d13",
"size": 3797453
},
"2024-09-06_15-00-33.mp4": {
"hash": "d96670498a068faa95a407e8a57ca864",
"size": 3778888
},
"2024-09-06_15-01-03.mp4": {
"hash": "a4a27063cdab70eb928c975a1ade9365",
"size": 3786918
},
"2024-09-06_15-01-33.mp4": {
"hash": "dfcf4f6acfb42ea15abf08d8264f5a5d",
"size": 3798806
},
"2024-09-06_15-02-03.mp4": {
"hash": "f49319e1bb705f6db371888b3300888c",
"size": 3779515
},
"malformed_file_name.mp4": {
"hash": "6c62272e07bb014262b821756295c58d",
"size": 0
}
}
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ endif
CGO_CFLAGS := -I$(FFMPEG_BUILD)/include
GOFLAGS := -buildvcs=false
export PKG_CONFIG_PATH=$(FFMPEG_BUILD)/lib/pkgconfig
export PATH := $(PATH):$(shell go env GOPATH)/bin

.PHONY: lint tool-install test clean module

Expand Down Expand Up @@ -91,7 +92,10 @@ ifeq ($(SOURCE_OS),darwin)
brew update && brew install ffmpeg
endif
endif
git lfs pull
ifeq ($(shell which artifact > /dev/null 2>&1; echo $$?), 1)
go install go.viam.com/utils/artifact/cmd/artifact@latest
endif
artifact pull
cp $(BIN_OUTPUT_PATH)/video-store bin/video-store
go test -v ./tests/
rm bin/video-store
Expand Down
5 changes: 3 additions & 2 deletions tests/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const (
videoStoreComponentName = "video-store-1"
testStoragePath = "/tmp/video-storage"
testUploadPath = "/tmp/video-upload"
artifactStoragePath = "../.artifact/data"
)

func setupViamServer(ctx context.Context, configStr string) (robot.Robot, error) {
Expand Down Expand Up @@ -57,13 +58,13 @@ func cleanVideoStoreDir() error {
if err != nil {
return err
}
videoStoreDir := filepath.Join(currentDir, "video-storage")
videoStoreDir := filepath.Join(currentDir, artifactStoragePath)
err = os.Chdir(videoStoreDir)
if err != nil {
return err
}
defer os.Chdir(currentDir) // Ensure we change back to the original directory
cmd := exec.Command("git", "clean", "-fdx")
cmd := exec.Command("artifact", "clean")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
Expand Down
3 changes: 1 addition & 2 deletions tests/fetch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import (
)

func TestFetchDoCommand(t *testing.T) {
storageRelativePath := "./video-storage"
storagePath, err := filepath.Abs(storageRelativePath)
storagePath, err := filepath.Abs(artifactStoragePath)
test.That(t, err, test.ShouldBeNil)
fullModuleBinPath, err := getModuleBinPath()
test.That(t, err, test.ShouldBeNil)
Expand Down
3 changes: 1 addition & 2 deletions tests/save_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import (
)

func TestSaveDoCommand(t *testing.T) {
storageRelativePath := "./video-storage"
storagePath, err := filepath.Abs(storageRelativePath)
storagePath, err := filepath.Abs(artifactStoragePath)
test.That(t, err, test.ShouldBeNil)
fullModuleBinPath, err := getModuleBinPath()
test.That(t, err, test.ShouldBeNil)
Expand Down
3 changes: 0 additions & 3 deletions tests/video-storage/2024-09-06_15-00-03.mp4

This file was deleted.

3 changes: 0 additions & 3 deletions tests/video-storage/2024-09-06_15-00-33.mp4

This file was deleted.

3 changes: 0 additions & 3 deletions tests/video-storage/2024-09-06_15-01-03.mp4

This file was deleted.

3 changes: 0 additions & 3 deletions tests/video-storage/2024-09-06_15-01-33.mp4

This file was deleted.

3 changes: 0 additions & 3 deletions tests/video-storage/2024-09-06_15-02-03.mp4

This file was deleted.

Empty file.

0 comments on commit a4aa3ab

Please sign in to comment.