feat: Add Go module and workspace test fixtures

- Created expected JSON files for Go modules and workspaces.
- Added go.mod and go.sum files for example projects.
- Implemented private module structure with expected JSON output.
- Introduced vendored dependencies with corresponding expected JSON.
- Developed PostgresGraphJobStore for managing graph jobs.
- Established SQL migration scripts for graph jobs schema.
- Implemented GraphJobRepository for CRUD operations on graph jobs.
- Created IGraphJobRepository interface for repository abstraction.
- Added unit tests for GraphJobRepository to ensure functionality.
This commit is contained in:
StellaOps Bot
2025-12-06 20:04:03 +02:00
parent a6f1406509
commit 05597616d6
178 changed files with 12022 additions and 4545 deletions

View File

@@ -0,0 +1,97 @@
{
"components": [
{
"analyzerId": "golang",
"componentKey": "golang::source::example.com/myproject::(devel)",
"name": "example.com/myproject",
"type": "golang",
"version": "(devel)",
"metadata": {
"go.version": "1.21",
"modulePath": "example.com/myproject",
"modulePath.main": "example.com/myproject",
"provenance": "source"
},
"evidence": [
{
"kind": "File",
"source": "go.mod",
"locator": "go.mod",
"value": "example.com/myproject"
}
]
},
{
"analyzerId": "golang",
"purl": "pkg:golang/github.com/gin-gonic/gin@v1.9.1",
"name": "github.com/gin-gonic/gin",
"type": "golang",
"version": "v1.9.1",
"metadata": {
"dependency.direct": "true",
"modulePath": "github.com/gin-gonic/gin",
"moduleSum": "h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=",
"moduleVersion": "v1.9.1",
"provenance": "source",
"registry": "proxy.golang.org"
},
"evidence": [
{
"kind": "Metadata",
"source": "go.mod",
"locator": "go.mod",
"value": "github.com/gin-gonic/gin@v1.9.1",
"hash": "h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg="
}
]
},
{
"analyzerId": "golang",
"purl": "pkg:golang/github.com/stretchr/testify@v1.8.4",
"name": "github.com/stretchr/testify",
"type": "golang",
"version": "v1.8.4",
"metadata": {
"dependency.indirect": "true",
"modulePath": "github.com/stretchr/testify",
"moduleSum": "h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQzsRs2+AEW5Cjls=",
"moduleVersion": "v1.8.4",
"provenance": "source",
"registry": "proxy.golang.org"
},
"evidence": [
{
"kind": "Metadata",
"source": "go.mod",
"locator": "go.mod",
"value": "github.com/stretchr/testify@v1.8.4",
"hash": "h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQzsRs2+AEW5Cjls="
}
]
},
{
"analyzerId": "golang",
"purl": "pkg:golang/golang.org/x/crypto@v0.14.0",
"name": "golang.org/x/crypto",
"type": "golang",
"version": "v0.14.0",
"metadata": {
"dependency.direct": "true",
"modulePath": "golang.org/x/crypto",
"moduleSum": "h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=",
"moduleVersion": "v0.14.0",
"provenance": "source",
"registry": "proxy.golang.org"
},
"evidence": [
{
"kind": "Metadata",
"source": "go.mod",
"locator": "go.mod",
"value": "golang.org/x/crypto@v0.14.0",
"hash": "h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc="
}
]
}
]
}

View File

@@ -0,0 +1,15 @@
module example.com/myproject
go 1.21
require (
github.com/gin-gonic/gin v1.9.1
github.com/stretchr/testify v1.8.4 // indirect
golang.org/x/crypto v0.14.0
)
replace github.com/old/package => github.com/new/package v1.0.0
exclude github.com/bad/package v0.0.1
retract v1.0.0

View File

@@ -0,0 +1,6 @@
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL+YQDe/2MxBPCZnqLcr7CQMpkSiQlrsZl1mOjBms=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQzsRs2+AEW5Cjls=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=

View File

@@ -0,0 +1,90 @@
{
"components": [
{
"analyzerId": "golang",
"componentKey": "golang::source::example.com/module-a::(devel)",
"name": "example.com/module-a",
"type": "golang",
"version": "(devel)",
"metadata": {
"go.version": "1.22",
"modulePath": "example.com/module-a",
"modulePath.main": "example.com/module-a",
"provenance": "source"
},
"evidence": [
{
"kind": "File",
"source": "go.mod",
"locator": "module-a/go.mod",
"value": "example.com/module-a"
}
]
},
{
"analyzerId": "golang",
"componentKey": "golang::source::example.com/module-b::(devel)",
"name": "example.com/module-b",
"type": "golang",
"version": "(devel)",
"metadata": {
"go.version": "1.22",
"modulePath": "example.com/module-b",
"modulePath.main": "example.com/module-b",
"provenance": "source"
},
"evidence": [
{
"kind": "File",
"source": "go.mod",
"locator": "module-b/go.mod",
"value": "example.com/module-b"
}
]
},
{
"analyzerId": "golang",
"purl": "pkg:golang/github.com/google/uuid@v1.4.0",
"name": "github.com/google/uuid",
"type": "golang",
"version": "v1.4.0",
"metadata": {
"dependency.direct": "true",
"modulePath": "github.com/google/uuid",
"moduleVersion": "v1.4.0",
"provenance": "source",
"registry": "proxy.golang.org"
},
"evidence": [
{
"kind": "Metadata",
"source": "go.mod",
"locator": "module-a/go.mod",
"value": "github.com/google/uuid@v1.4.0"
}
]
},
{
"analyzerId": "golang",
"purl": "pkg:golang/github.com/sirupsen/logrus@v1.9.3",
"name": "github.com/sirupsen/logrus",
"type": "golang",
"version": "v1.9.3",
"metadata": {
"dependency.direct": "true",
"modulePath": "github.com/sirupsen/logrus",
"moduleVersion": "v1.9.3",
"provenance": "source",
"registry": "proxy.golang.org"
},
"evidence": [
{
"kind": "Metadata",
"source": "go.mod",
"locator": "module-b/go.mod",
"value": "github.com/sirupsen/logrus@v1.9.3"
}
]
}
]
}

View File

@@ -0,0 +1,6 @@
go 1.22
use (
./module-a
./module-b
)

View File

@@ -0,0 +1,5 @@
module example.com/module-a
go 1.22
require github.com/google/uuid v1.4.0

View File

@@ -0,0 +1,5 @@
module example.com/module-b
go 1.22
require github.com/sirupsen/logrus v1.9.3

View File

@@ -0,0 +1,95 @@
{
"components": [
{
"analyzerId": "golang",
"componentKey": "golang::source::gitlab.mycompany.com/internal/myservice::(devel)",
"name": "gitlab.mycompany.com/internal/myservice",
"type": "golang",
"version": "(devel)",
"metadata": {
"go.version": "1.21",
"modulePath": "gitlab.mycompany.com/internal/myservice",
"modulePath.main": "gitlab.mycompany.com/internal/myservice",
"provenance": "source"
},
"evidence": [
{
"kind": "File",
"source": "go.mod",
"locator": "go.mod",
"value": "gitlab.mycompany.com/internal/myservice"
}
]
},
{
"analyzerId": "golang",
"purl": "pkg:golang/git.internal.corp/lib/utils@v2.0.0",
"name": "git.internal.corp/lib/utils",
"type": "golang",
"version": "v2.0.0",
"metadata": {
"dependency.direct": "true",
"moduleCategory": "private",
"modulePath": "git.internal.corp/lib/utils",
"moduleVersion": "v2.0.0",
"private": "true",
"provenance": "source",
"registry": "git.internal.corp"
},
"evidence": [
{
"kind": "Metadata",
"source": "go.mod",
"locator": "go.mod",
"value": "git.internal.corp/lib/utils@v2.0.0"
}
]
},
{
"analyzerId": "golang",
"purl": "pkg:golang/github.com/gin-gonic/gin@v1.9.1",
"name": "github.com/gin-gonic/gin",
"type": "golang",
"version": "v1.9.1",
"metadata": {
"dependency.direct": "true",
"modulePath": "github.com/gin-gonic/gin",
"moduleVersion": "v1.9.1",
"provenance": "source",
"registry": "proxy.golang.org"
},
"evidence": [
{
"kind": "Metadata",
"source": "go.mod",
"locator": "go.mod",
"value": "github.com/gin-gonic/gin@v1.9.1"
}
]
},
{
"analyzerId": "golang",
"purl": "pkg:golang/gitlab.mycompany.com/shared/common@v1.0.0",
"name": "gitlab.mycompany.com/shared/common",
"type": "golang",
"version": "v1.0.0",
"metadata": {
"dependency.direct": "true",
"moduleCategory": "private",
"modulePath": "gitlab.mycompany.com/shared/common",
"moduleVersion": "v1.0.0",
"private": "true",
"provenance": "source",
"registry": "gitlab.mycompany.com"
},
"evidence": [
{
"kind": "Metadata",
"source": "go.mod",
"locator": "go.mod",
"value": "gitlab.mycompany.com/shared/common@v1.0.0"
}
]
}
]
}

View File

@@ -0,0 +1,9 @@
module gitlab.mycompany.com/internal/myservice
go 1.21
require (
github.com/gin-gonic/gin v1.9.1
gitlab.mycompany.com/shared/common v1.0.0
git.internal.corp/lib/utils v2.0.0
)

View File

@@ -0,0 +1,71 @@
{
"components": [
{
"analyzerId": "golang",
"componentKey": "golang::source::example.com/vendored-app::(devel)",
"name": "example.com/vendored-app",
"type": "golang",
"version": "(devel)",
"metadata": {
"go.version": "1.21",
"modulePath": "example.com/vendored-app",
"modulePath.main": "example.com/vendored-app",
"provenance": "source"
},
"evidence": [
{
"kind": "File",
"source": "go.mod",
"locator": "go.mod",
"value": "example.com/vendored-app"
}
]
},
{
"analyzerId": "golang",
"purl": "pkg:golang/github.com/pkg/errors@v0.9.1",
"name": "github.com/pkg/errors",
"type": "golang",
"version": "v0.9.1",
"metadata": {
"dependency.direct": "true",
"modulePath": "github.com/pkg/errors",
"moduleVersion": "v0.9.1",
"provenance": "source",
"registry": "proxy.golang.org",
"vendored": "true"
},
"evidence": [
{
"kind": "Metadata",
"source": "vendor",
"locator": "go.mod",
"value": "github.com/pkg/errors@v0.9.1"
}
]
},
{
"analyzerId": "golang",
"purl": "pkg:golang/golang.org/x/text@v0.14.0",
"name": "golang.org/x/text",
"type": "golang",
"version": "v0.14.0",
"metadata": {
"dependency.indirect": "true",
"modulePath": "golang.org/x/text",
"moduleVersion": "v0.14.0",
"provenance": "source",
"registry": "proxy.golang.org",
"vendored": "true"
},
"evidence": [
{
"kind": "Metadata",
"source": "vendor",
"locator": "go.mod",
"value": "golang.org/x/text@v0.14.0"
}
]
}
]
}

View File

@@ -0,0 +1,8 @@
module example.com/vendored-app
go 1.21
require (
github.com/pkg/errors v0.9.1
golang.org/x/text v0.14.0 // indirect
)

View File

@@ -0,0 +1,7 @@
# github.com/pkg/errors v0.9.1
## explicit
github.com/pkg/errors
# golang.org/x/text v0.14.0
## explicit; go 1.18
golang.org/x/text/transform
golang.org/x/text/unicode/norm