Skip to content

Commit 7ed3b27

Browse files
committed
feat: change container package fields
1 parent b6916d2 commit 7ed3b27

File tree

6 files changed

+30
-50
lines changed

6 files changed

+30
-50
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/google/uuid v1.6.0
1313
github.com/hashicorp/go-hclog v1.6.3
1414
github.com/nats-io/nats.go v1.36.0
15-
github.com/opengovern/og-util v1.5.3
15+
github.com/opengovern/og-util v1.6.3
1616
github.com/opengovern/opencomply v0.475.2
1717
github.com/opengovern/resilient-bridge v0.0.0-20241223164127-85ad8f42a67d
1818
github.com/shurcooL/githubv4 v0.0.0-20240727222349-48295856cce7

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,8 +675,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
675675
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
676676
github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug=
677677
github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM=
678-
github.com/opengovern/og-util v1.5.3 h1:u6sMV95nOBl0NaQ+qSO0oVWQVjS81fovmmzOmzXPkHQ=
679-
github.com/opengovern/og-util v1.5.3/go.mod h1:ob8RSaNZG3RWnLH3lDXQaVpIf+B8Ry7ds3twYlDJPp0=
678+
github.com/opengovern/og-util v1.6.3 h1:QMF+OAEG2O1TzUVVKb7W5jpC8YWFaGfQFMUZzDO8qCg=
679+
github.com/opengovern/og-util v1.6.3/go.mod h1:ob8RSaNZG3RWnLH3lDXQaVpIf+B8Ry7ds3twYlDJPp0=
680680
github.com/opengovern/opencomply v0.475.2 h1:JHs12+mhJb9HzFZYMLLgw079PRa+qLKntugvwWiCVL0=
681681
github.com/opengovern/opencomply v0.475.2/go.mod h1:FsJTfdLz+DDRAzW2/KyCFRxVxM89jMysP7ZfQjaS8+A=
682682
github.com/opengovern/resilient-bridge v0.0.0-20241223164127-85ad8f42a67d h1:OnoG1Za89armxN1ZlEbr/eKvAdbRN6UGKXCFxee58s0=

pkg/sdk/es/resources_clients.go

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6727,18 +6727,16 @@ func (p ContainerPackagePaginator) NextPage(ctx context.Context) ([]ContainerPac
67276727
}
67286728

67296729
var listContainerPackageFilters = map[string]string{
6730-
"created_at": "Description.CreatedAt",
6731-
"digest": "Description.Digest",
6732-
"html_url": "Description.HTMLURL",
6733-
"id": "Description.ID",
6734-
"manifest": "Description.Manifest",
6735-
"media_type": "Description.MediaType",
6736-
"metadata": "Description.Metadata",
6737-
"name": "Description.Name",
6738-
"package_html_url": "Description.PackageHTMLURL",
6739-
"package_uri": "Description.PackageURI",
6740-
"total_size": "Description.TotalSize",
6741-
"updated_at": "Description.UpdatedAt",
6730+
"created_at": "Description.CreatedAt",
6731+
"digest": "Description.Digest",
6732+
"id": "Description.ID",
6733+
"manifest": "Description.Manifest",
6734+
"media_type": "Description.MediaType",
6735+
"metadata": "Description.Metadata",
6736+
"name": "Description.Name",
6737+
"package_url": "Description.PackageUrl",
6738+
"total_size": "Description.TotalSize",
6739+
"updated_at": "Description.UpdatedAt",
67426740
}
67436741

67446742
func ListContainerPackage(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) {
@@ -6802,18 +6800,16 @@ func ListContainerPackage(ctx context.Context, d *plugin.QueryData, _ *plugin.Hy
68026800
}
68036801

68046802
var getContainerPackageFilters = map[string]string{
6805-
"created_at": "Description.CreatedAt",
6806-
"digest": "Description.Digest",
6807-
"html_url": "Description.HTMLURL",
6808-
"id": "Description.ID",
6809-
"manifest": "Description.Manifest",
6810-
"media_type": "Description.MediaType",
6811-
"metadata": "Description.Metadata",
6812-
"name": "Description.Name",
6813-
"package_html_url": "Description.PackageHTMLURL",
6814-
"package_uri": "Description.PackageURI",
6815-
"total_size": "Description.TotalSize",
6816-
"updated_at": "Description.UpdatedAt",
6803+
"created_at": "Description.CreatedAt",
6804+
"digest": "Description.Digest",
6805+
"id": "Description.ID",
6806+
"manifest": "Description.Manifest",
6807+
"media_type": "Description.MediaType",
6808+
"metadata": "Description.Metadata",
6809+
"name": "Description.Name",
6810+
"package_url": "Description.PackageUrl",
6811+
"total_size": "Description.TotalSize",
6812+
"updated_at": "Description.UpdatedAt",
68176813
}
68186814

68196815
func GetContainerPackage(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) {

provider/describer/container_package.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func deduplicateVersionOutputsByDigest(resources []models.Resource, versionID in
205205

206206
// If we already have this digest, append to AdditionalPackageURIs
207207
if existing, exists := dedupMap[dk]; exists {
208-
existing.AdditionalPackageURIs = append(existing.AdditionalPackageURIs, cpd.PackageURI)
208+
existing.AdditionalPackageURIs = append(existing.AdditionalPackageURIs, cpd.PackageURL)
209209
} else {
210210
dedupMap[dk] = &cpd
211211
}
@@ -300,13 +300,10 @@ func fetchAndAssembleOutput(
300300
ov := model.ContainerPackageDescription{
301301
ID: version.ID,
302302
Digest: actualDigest, // store the real Docker digest
303-
GHVersionName: version.Name, // store the GH "version.Name" if desired
304-
PackageURI: imageRef,
305303
AdditionalPackageURIs: []string{}, // Will be appended after dedup
306-
PackageHTMLURL: version.PackageHTMLURL,
307304
CreatedAt: version.CreatedAt,
308305
UpdatedAt: version.UpdatedAt,
309-
HTMLURL: version.HTMLURL,
306+
PackageURL: version.HTMLURL,
310307
Name: imageRef,
311308
MediaType: string(desc.Descriptor.MediaType),
312309
TotalSize: totalSize,

provider/model/model.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,13 +1462,11 @@ type ContainerMetadata struct {
14621462

14631463
type ContainerPackageDescription struct {
14641464
ID int
1465-
Digest string
1466-
PackageURI string
1467-
PackageHTMLURL string
1465+
Digest string
14681466
CreatedAt string
14691467
UpdatedAt string
1470-
HTMLURL string
1471-
Name string
1468+
PackageURL string
1469+
Name string
14721470
MediaType string
14731471
TotalSize int64
14741472
Metadata ContainerMetadata
@@ -1478,7 +1476,6 @@ type ContainerPackageDescription struct {
14781476

14791477
// The GitHub "version.Name" or tag,
14801478
// if you want to store that separately from the real Docker digest.
1481-
GHVersionName string `json:"gh_version_name,omitempty"`
14821479

14831480
// When deduplicating, any subsequent tags for the same (ID,digest)
14841481
// can be appended here.

steampipe-plugin-github/github/table_github_container_package.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,6 @@ func tableGitHubContainerPackage() *plugin.Table {
2828
Type: proto.ColumnType_STRING,
2929
Transform: transform.FromField("Description.Digest"),
3030
Description: "Digest of the package."},
31-
{
32-
Name: "package_uri",
33-
Type: proto.ColumnType_STRING,
34-
Transform: transform.FromField("Description.PackageURI"),
35-
Description: "URI of the package."},
36-
{
37-
Name: "package_html_url",
38-
Type: proto.ColumnType_STRING,
39-
Transform: transform.FromField("Description.PackageHTMLURL"),
40-
Description: "HTML URL of the package."},
4131
{
4232
Name: "created_at",
4333
Type: proto.ColumnType_STRING,
@@ -49,9 +39,9 @@ func tableGitHubContainerPackage() *plugin.Table {
4939
Transform: transform.FromField("Description.UpdatedAt"),
5040
Description: "Timestamp when the package was last updated."},
5141
{
52-
Name: "html_url",
42+
Name: "package_url",
5343
Type: proto.ColumnType_STRING,
54-
Transform: transform.FromField("Description.HTMLURL"),
44+
Transform: transform.FromField("Description.PackageUrl"),
5545
Description: "HTML URL for the package."},
5646
{
5747
Name: "name",

0 commit comments

Comments
 (0)