@@ -29,6 +29,7 @@ func TestRepositoriesConfig_Validate(t *testing.T) {
2929 {
3030 name : "valid state" ,
3131 config : & RepositoriesConfig {
32+ ImageSHA : "example-sha" ,
3233 Repositories : []* RepositoryConfig {
3334 {
3435 Name : "google-cloud-foo" ,
@@ -37,11 +38,11 @@ func TestRepositoriesConfig_Validate(t *testing.T) {
3738 },
3839 },
3940 },
40- wantErr : false ,
4141 },
4242 {
4343 name : "valid full name" ,
4444 config : & RepositoriesConfig {
45+ ImageSHA : "example-sha" ,
4546 Repositories : []* RepositoryConfig {
4647 {
4748 FullName : "https://github.com/googleapis/google-cloud-foo" ,
@@ -50,11 +51,11 @@ func TestRepositoriesConfig_Validate(t *testing.T) {
5051 },
5152 },
5253 },
53- wantErr : false ,
5454 },
5555 {
5656 name : "missing name" ,
5757 config : & RepositoriesConfig {
58+ ImageSHA : "example-sha" ,
5859 Repositories : []* RepositoryConfig {
5960 {
6061 SecretName : "google-cloud-foo-github-token" ,
@@ -67,6 +68,7 @@ func TestRepositoriesConfig_Validate(t *testing.T) {
6768 {
6869 name : "missing secret name" ,
6970 config : & RepositoriesConfig {
71+ ImageSHA : "example-sha" ,
7072 Repositories : []* RepositoryConfig {
7173 {
7274 Name : "google-cloud-foo" ,
@@ -79,6 +81,7 @@ func TestRepositoriesConfig_Validate(t *testing.T) {
7981 {
8082 name : "missing commands" ,
8183 config : & RepositoriesConfig {
84+ ImageSHA : "example-sha" ,
8285 Repositories : []* RepositoryConfig {
8386 {
8487 Name : "google-cloud-foo" ,
@@ -91,6 +94,7 @@ func TestRepositoriesConfig_Validate(t *testing.T) {
9194 {
9295 name : "empty commands" ,
9396 config : & RepositoriesConfig {
97+ ImageSHA : "example-sha" ,
9498 Repositories : []* RepositoryConfig {
9599 {
96100 Name : "google-cloud-foo" ,
@@ -104,6 +108,7 @@ func TestRepositoriesConfig_Validate(t *testing.T) {
104108 {
105109 name : "invalid command" ,
106110 config : & RepositoriesConfig {
111+ ImageSHA : "example-sha" ,
107112 Repositories : []* RepositoryConfig {
108113 {
109114 Name : "google-cloud-foo" ,
@@ -114,6 +119,11 @@ func TestRepositoriesConfig_Validate(t *testing.T) {
114119 },
115120 wantErr : true ,
116121 },
122+ {
123+ name : "empty image sha" ,
124+ config : & RepositoriesConfig {},
125+ wantErr : true ,
126+ },
117127 } {
118128 t .Run (test .name , func (t * testing.T ) {
119129 if err := test .config .Validate (); (err != nil ) != test .wantErr {
@@ -132,14 +142,16 @@ func TestParseRepositoriesConfig(t *testing.T) {
132142 }{
133143 {
134144 name : "valid state" ,
135- content : `repositories:
145+ content : `librarian-image-sha: example-sha
146+ repositories:
136147 - name: google-cloud-python
137148 github-token-secret-name: google-cloud-python-github-token
138149 supported-commands:
139150 - generate
140151 - stage-release
141152` ,
142153 want : & RepositoriesConfig {
154+ ImageSHA : "example-sha" ,
143155 Repositories : []* RepositoryConfig {
144156 {
145157 Name : "google-cloud-python" ,
@@ -151,7 +163,8 @@ func TestParseRepositoriesConfig(t *testing.T) {
151163 },
152164 {
153165 name : "valid state with full name" ,
154- content : `repositories:
166+ content : `librarian-image-sha: example-sha
167+ repositories:
155168 - name: google-cloud-python
156169 full-name: https://github.com/some-org/google-cloud-python
157170 github-token-secret-name: google-cloud-python-github-token
@@ -160,6 +173,7 @@ func TestParseRepositoriesConfig(t *testing.T) {
160173 - stage-release
161174` ,
162175 want : & RepositoriesConfig {
176+ ImageSHA : "example-sha" ,
163177 Repositories : []* RepositoryConfig {
164178 {
165179 Name : "google-cloud-python" ,
@@ -172,7 +186,8 @@ func TestParseRepositoriesConfig(t *testing.T) {
172186 },
173187 {
174188 name : "valid state with branch" ,
175- content : `repositories:
189+ content : `librarian-image-sha: example-sha
190+ repositories:
176191 - name: google-cloud-python
177192 branch: preview
178193 github-token-secret-name: google-cloud-python-github-token
@@ -181,6 +196,7 @@ func TestParseRepositoriesConfig(t *testing.T) {
181196 - stage-release
182197` ,
183198 want : & RepositoriesConfig {
199+ ImageSHA : "example-sha" ,
184200 Repositories : []* RepositoryConfig {
185201 {
186202 Name : "google-cloud-python" ,
@@ -193,7 +209,8 @@ func TestParseRepositoriesConfig(t *testing.T) {
193209 },
194210 {
195211 name : "invalid yaml" ,
196- content : `repositories:
212+ content : `librarian-image-sha: example-sha
213+ repositories:
197214 - name: google-cloud-python
198215 github-token-secret-name: google-cloud-python-github-token # bad indent
199216 supported-commands:
@@ -205,7 +222,8 @@ func TestParseRepositoriesConfig(t *testing.T) {
205222 },
206223 {
207224 name : "validation error" ,
208- content : `repositories:
225+ content : `librarian-image-sha: example-sha
226+ repositories:
209227 - name: google-cloud-python
210228 github-token-secret-name: google-cloud-python-github-token
211229 # missing supported-commands
0 commit comments