File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ func Verify(imageName string) error {
2626 return err
2727 }
2828
29+ fmt .Println ("identity:" , certIdentity )
30+
2931 v := & verify.VerifyCommand {
3032 CertVerifyOptions : options.CertVerifyOptions {
3133 CertIdentity : certIdentity ,
@@ -64,10 +66,18 @@ func certIdentity(imageName string) (string, error) {
6466 }
6567
6668 repo := strings .Join (names [len (names )- 2 :], "/" )
67- ref := d [1 ]
69+ ref := strings .Replace (d [1 ], "-" , "+" , 1 )
70+ repo = overrideRepo (repo )
6871
6972 indentity := fmt .Sprintf (
7073 "https://github.com/%s/.github/workflows/release.yml@refs/tags/%s" , repo , ref )
7174
7275 return indentity , nil
7376}
77+
78+ func overrideRepo (repo string ) string {
79+ if strings .HasPrefix (repo , "rancher/rke2-" ) {
80+ return "rancher/rke2"
81+ }
82+ return repo
83+ }
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ func TestCertificateIdentity(t *testing.T) {
1616 image : "foo/bar:v0.0.7" ,
1717 want : "https://github.com/foo/bar/.github/workflows/release.yml@refs/tags/v0.0.7" ,
1818 },
19+ {
20+ image : "foo/bar:v0.0.7-barfoo2" ,
21+ want : "https://github.com/foo/bar/.github/workflows/release.yml@refs/tags/v0.0.7+barfoo2" ,
22+ },
1923 {
2024 image : "" ,
2125 wantErr : "invalid image name" ,
@@ -48,6 +52,10 @@ func TestCertificateIdentity(t *testing.T) {
4852 image : "tocker.local/bar/foo/bar:v3.14" ,
4953 want : "https://github.com/foo/bar/.github/workflows/release.yml@refs/tags/v3.14" ,
5054 },
55+ {
56+ image : "rancher/rke2-bar:v0.0.7" ,
57+ want : "https://github.com/rancher/rke2/.github/workflows/release.yml@refs/tags/v0.0.7" ,
58+ },
5159 }
5260
5361 for _ , tc := range tests {
You can’t perform that action at this time.
0 commit comments