@@ -1526,12 +1526,57 @@ func Test_runVerifyGithubAttestation(t *testing.T) {
15261526 bcrPublisherBuilderID := "https://github.com/bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml"
15271527
15281528 tests := []struct {
1529- name string
1530- artifact string
1531- source string
1532- builderID string
1533- err error
1529+ name string
1530+ artifact string
1531+ source string
1532+ sourceTag * string
1533+ sourceVersionTag * string
1534+ builderID string
1535+ err error
15341536 }{
1537+ {
1538+ name : "module.bazel using publishing builder" ,
1539+ artifact : "MODULE.bazel" ,
1540+ source : "github.com/aspect-build/rules_lint" ,
1541+ builderID : bcrPublisherBuilderID ,
1542+ },
1543+ {
1544+ name : "module.bazel using publishing builder and source tag" ,
1545+ artifact : "MODULE-on-tag.bazel" ,
1546+ source : "github.com/aspect-build/rules_lint" ,
1547+ sourceTag : pString ("v1.3.4" ),
1548+ builderID : bcrPublisherBuilderID ,
1549+ },
1550+ {
1551+ name : "module.bazel using publishing builder and incorrect source tag" ,
1552+ artifact : "MODULE-on-tag.bazel" ,
1553+ source : "github.com/aspect-build/rules_lint" ,
1554+ sourceTag : pString ("v1.3.5" ),
1555+ builderID : bcrPublisherBuilderID ,
1556+ err : serrors .ErrorMismatchTag ,
1557+ },
1558+ {
1559+ name : "module.bazel using publishing builder and source versioned tag" ,
1560+ artifact : "MODULE-on-tag.bazel" ,
1561+ source : "github.com/aspect-build/rules_lint" ,
1562+ sourceVersionTag : pString ("v1.3.4" ),
1563+ builderID : bcrPublisherBuilderID ,
1564+ },
1565+ {
1566+ name : "module.bazel using publishing builder and partial source versioned tag" ,
1567+ artifact : "MODULE-on-tag.bazel" ,
1568+ source : "github.com/aspect-build/rules_lint" ,
1569+ sourceVersionTag : pString ("v1.3" ),
1570+ builderID : bcrPublisherBuilderID ,
1571+ },
1572+ {
1573+ name : "module.bazel using publishing builder and incorrect source versioned tag" ,
1574+ artifact : "MODULE-on-tag.bazel" ,
1575+ source : "github.com/aspect-build/rules_lint" ,
1576+ sourceVersionTag : pString ("v1.3.5" ),
1577+ builderID : bcrPublisherBuilderID ,
1578+ err : serrors .ErrorMismatchVersionedTag ,
1579+ },
15351580 {
15361581 name : "module.bazel using publishing builder" ,
15371582 artifact : "MODULE.bazel" ,
@@ -1574,9 +1619,11 @@ func Test_runVerifyGithubAttestation(t *testing.T) {
15741619 // we treat these single entry *.intoto.jsonl bundles as single attestations
15751620 attestationPath := fmt .Sprintf ("%s.intoto.jsonl" , artifactPath )
15761621 cmd := verify.VerifyGithubAttestationCommand {
1577- AttestationPath : attestationPath ,
1578- BuilderID : & tt .builderID ,
1579- SourceURI : tt .source ,
1622+ AttestationPath : attestationPath ,
1623+ BuilderID : & tt .builderID ,
1624+ SourceTag : tt .sourceTag ,
1625+ SourceVersionTag : tt .sourceVersionTag ,
1626+ SourceURI : tt .source ,
15801627 }
15811628
15821629 _ , err := cmd .Exec (context .Background (), artifactPath )
0 commit comments