Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: scheduler/appengine/catalog/catalog.go

Issue 2993793004: [scheduler]: ACLs phase 2 - warn if Job/Trigger don't have ACLs. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | scheduler/appengine/catalog/catalog_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. 1 // Copyright 2015 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 276 }
277 flavor := JobFlavorTriggered 277 flavor := JobFlavorTriggered
278 if schedule != "triggered" { 278 if schedule != "triggered" {
279 flavor = JobFlavorPeriodic 279 flavor = JobFlavorPeriodic
280 } 280 }
281 acls, err := acl.ValidateTaskAcls(knownAclSets, job.GetAclSets() , job.GetAcls()) 281 acls, err := acl.ValidateTaskAcls(knownAclSets, job.GetAclSets() , job.GetAcls())
282 if err != nil { 282 if err != nil {
283 logging.Errorf(c, "Failed to compute task ACLs: %s/%s: % s", projectID, id, err) 283 logging.Errorf(c, "Failed to compute task ACLs: %s/%s: % s", projectID, id, err)
284 continue 284 continue
285 } 285 }
286 // TODO(tandrii): remove this once this warning stops firing.
287 if len(acls.Owners) == 0 || len(acls.Readers) == 0 {
288 logging.Warningf(c, "Missing some ACLs on %s/%s: R=%d O= %d", projectID, id, len(acls.Owners), len(acls.Readers))
289 }
286 out = append(out, Definition{ 290 out = append(out, Definition{
287 JobID: fmt.Sprintf("%s/%s", projectID, job.Id), 291 JobID: fmt.Sprintf("%s/%s", projectID, job.Id),
288 Acls: *acls, 292 Acls: *acls,
289 Flavor: flavor, 293 Flavor: flavor,
290 Revision: meta.Revision, 294 Revision: meta.Revision,
291 RevisionURL: revisionURL, 295 RevisionURL: revisionURL,
292 Schedule: schedule, 296 Schedule: schedule,
293 Task: packed, 297 Task: packed,
294 }) 298 })
295 } 299 }
(...skipping 19 matching lines...) Expand all
315 } 319 }
316 schedule := trigger.Schedule 320 schedule := trigger.Schedule
317 if schedule == "" { 321 if schedule == "" {
318 schedule = defaultTriggerSchedule 322 schedule = defaultTriggerSchedule
319 } 323 }
320 acls, err := acl.ValidateTaskAcls(knownAclSets, trigger.GetAclSe ts(), trigger.GetAcls()) 324 acls, err := acl.ValidateTaskAcls(knownAclSets, trigger.GetAclSe ts(), trigger.GetAcls())
321 if err != nil { 325 if err != nil {
322 logging.Errorf(c, "Failed to compute task ACLs: %s/%s: % s", projectID, id, err) 326 logging.Errorf(c, "Failed to compute task ACLs: %s/%s: % s", projectID, id, err)
323 continue 327 continue
324 } 328 }
329 // TODO(tandrii): remove this once this warning stops firing.
330 if len(acls.Owners) == 0 || len(acls.Readers) == 0 {
331 logging.Warningf(c, "Missing some ACLs on %s/%s: R=%d O= %d", projectID, id, len(acls.Owners), len(acls.Readers))
332 }
325 out = append(out, Definition{ 333 out = append(out, Definition{
326 JobID: fmt.Sprintf("%s/%s", projectID, trigger.Id) , 334 JobID: fmt.Sprintf("%s/%s", projectID, trigger.Id) ,
327 Acls: *acls, 335 Acls: *acls,
328 Flavor: JobFlavorTrigger, 336 Flavor: JobFlavorTrigger,
329 Revision: meta.Revision, 337 Revision: meta.Revision,
330 RevisionURL: revisionURL, 338 RevisionURL: revisionURL,
331 Schedule: schedule, 339 Schedule: schedule,
332 Task: packed, 340 Task: packed,
333 }) 341 })
334 } 342 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 field := v.Field(i) 473 field := v.Field(i)
466 if field.Type() == taskType { 474 if field.Type() == taskType {
467 field.Set(reflect.ValueOf(task)) 475 field.Set(reflect.ValueOf(task))
468 return proto.Marshal(&wrapper) 476 return proto.Marshal(&wrapper)
469 } 477 }
470 } 478 }
471 // This can happen only if TaskDefWrapper wasn't updated when a new task type 479 // This can happen only if TaskDefWrapper wasn't updated when a new task type
472 // was added. This is a developer's mistake, not a config mistake. 480 // was added. This is a developer's mistake, not a config mistake.
473 return nil, fmt.Errorf("could not find a field of type %T in TaskDefWrap per", task) 481 return nil, fmt.Errorf("could not find a field of type %T in TaskDefWrap per", task)
474 } 482 }
OLDNEW
« no previous file with comments | « no previous file | scheduler/appengine/catalog/catalog_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698