Open petemoore opened 5 years ago
The character limit is 38 now.
Note that there is another threat to uniqueness: we want to prevent, for example, someone creating an org named taskcluster-generic
and a repo named worker
and getting the same schedulerId as taskcluster/generic-worker.
Oops, I thought I marked for @owlishDeveloper's review but it's not a PR. Anyway, please take a look!
This issue has been extracted (and slightly rewritten) from this comment of issue #16.
Tasks created by
taskcluster-github
have"schedulerId": "taskcluster-github"
.To cancel a
taskcluster-github
-created task requires scopequeue:cancel-task:taskcluster-github/<taskGroupId>/<taskId>
. SincetaskGroupId
andtaskId
do not follow a repo-specific naming pattern, the scopequeue:cancel-task:taskcluster-github/*
is the only scope assignment that serves the general purpose of being able to cancel anytaskcluster-github
task for a given repo, without the possibility to restrict this to an individual github repo.By using unique github scheduler ids per repo, this limitation would be lifted. If tasks created for repo
github.com/foo/bar
were to have (e.g.)"schedulerId": "github-foo-bar"
, then to cancel a task, a client would need to havequeue:cancel-task:github-foo-bar/<taskGroupId>/<taskId>
rather thanqueue:cancel-task:taskcluster-github/<taskGroupId>/<taskId>
so it would be relatively straightforward to grantqueue:cancel-task:github-foo-bar/*
to roles/clients that should be able to cancel any task for only this repo. They would then not be able to cancel tasks for other github repos, as they currently can now.Note, one complication is that
schedulerId
s are currently limited to^([a-zA-Z0-9-_]*)$
with a maximum limit of 38 chars, so the github org/user + repository name cannot be simply embedded in theschedulerId
since this will not necessarily comply with the requiredschedulerId
pattern. We should therefore define theschedulerId
as a function of the org/user and repo name, that satisfies the following properties:schedulerId
that conforms to the required regexp forschedulerId
.schedulerId
that is unique per repo.schedulerId
(i.e. the function is reverse-engineerable), or if not, it is a simple and well-defined lexical function that users could implement themselves to predict theschedulerId
in any tooling they may wish to create.One example of such a function (in this illustration written in go) could be the
schedulerId
function below: