Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-70044] Add telemetry for activation of optional permissions #7342

Merged
merged 3 commits into from
Nov 11, 2022

Conversation

dwnusbaum
Copy link
Member

@dwnusbaum dwnusbaum commented Nov 8, 2022

See JENKINS-70044.

Note that we would like to backport this change to the LTS. https://www.jenkins.io/download/lts/#backporting-process does not list telemetry explicitly, but otherwise we will have to set activation dates far into the future and then wait for this to be picked up by the next LTS baseline. I recall @daniel-beck mentioning that new telemetry collectors have been backported in the past, but I could not find any discussion of this from a very quick search on the developer mailing list.

Testing done

I tested this PR by replacing Telemetry.ENDPOINT with a link to https://webhook.site, then I called ExtensionList.lookupSingleton(jenkins.telemetry.impl.OptionalPermissions.class).run() from the Jenkins script console and verified that the request showed up with the expected content. I then installed credentials and manage-permission from the Plugin Manager, reran the script, and verified that the credentials-related permissions were included in the payload and that hudson.model.Hudson.Manage was now marked as being enabled.

Sample payload
{
    "components": {
        "bouncycastle-api": "2.26",
        "credentials": "1189.vf61b_a_5e2f62e",
        "instance-identity": "116.vf8f487400980",
        "javax-activation-api": "1.2.0-5",
        "javax-mail-api": "1.6.2-8",
        "jenkins-core": "2.378-SNAPSHOT",
        "manage-permission": "1.0.1",
        "mina-sshd-api-common": "2.9.1-44.v476733c11f82",
        "mina-sshd-api-core": "2.9.1-44.v476733c11f82",
        "sshd": "3.249.v2dc2ea_416e33",
        "structs": "324.va_f5d6774f3a_d"
    },
    "permissions": {
        "com.cloudbees.plugins.credentials.CredentialsProvider.UseItem": false,
        "com.cloudbees.plugins.credentials.CredentialsProvider.UseOwn": false,
        "hudson.model.Computer.ExtendedRead": false,
        "hudson.model.Hudson.Manage": true,
        "hudson.model.Hudson.SystemRead": false,
        "hudson.model.Item.ExtendedRead": false,
        "hudson.model.Item.WipeOut": false,
        "hudson.model.Run.Artifacts": false
    }
}

I did not add any automated tests. TelemetryTest already covers the overall behavior of the Telemetry extension point. I can add a test that checks the output of OptionalPermissions.createContent if reviewers think that would be useful.

Proposed changelog entries

  • Add telemetry for activation of permissions that are not enabled by default.

Proposed upgrade guidelines

N/A

Submitter checklist

  • The Jira issue, if it exists, is well-described.
  • The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples).
    • Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
  • There is automated testing or an explanation as to why this change has no tests.
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.
  • New or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).
  • For dependency updates, there are links to external changelogs and, if possible, full differentials.
  • For new APIs and extension points, there is a link to at least one consumer.

Desired reviewers

@mention

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least two (2) approvals for the pull request and no outstanding requests for change.
  • Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
  • Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
  • Proper changelog labels are set so that the changelog can be generated automatically.
  • If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

Comment on lines +65 to +73
@Override
public LocalDate getStart() {
return LocalDate.of(2022, 11, 1);
}

@Override
public LocalDate getEnd() {
return LocalDate.of(2023, 3, 1);
}
Copy link
Member Author

@dwnusbaum dwnusbaum Nov 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what dates make the most sense. I set the start to 2022-11-01 to facilitate testing. Depending on whether we can backport this and what the LTS schedule is like, maybe 2023-02-01 could be a more conservative end date, but my concern is that many users will refrain from updating during the holiday season and so December and January data will be sparse and perhaps non-representative of the overall userbase.

@daniel-beck
Copy link
Member

daniel-beck commented Nov 8, 2022

I recall @daniel-beck mentioning that new telemetry collectors have been backported in the past, but I could not find any discussion of this from a very quick search on the developer mailing list.

Some past examples I was involved with, basically everything has been backported into LTS:

JENKINS-53768 backported initial telemetry infrastructure into 2.138.2 with @Restricted (discussed and approved in the 2018-09-26 project meeting).
JENKINS-54029 backported Stapler dispatch telemetry into 2.138.3.
JENKINS-57167 backported re-activation of Stapler telemetry into 2.164.3.
JENKINS-67229 backported agent-to-controller file path access logging telemetry into 2.319.1.

I don't know whether there's been an "official" discussion on the topic of backporting eligibility of telemetry. In the initial JEP request for comments thread I wrote,

It's also difficult to say right now how we'd handle LTS releases -- would collectors be eligible for backports? (I say yes, as optional extension points written such that they mostly silently fail.)

but there were no further responses on the topic (at least no active rejections of this).

To me, the backporting requirement basically follows logically from the idea of keeping the collection period short, ideally just a few months to collect less data. Anything less than around 4-6 months or so given the would not result in a broad user base to collect from, making data less meaningful, while specifying very long durations to cover both LTS and weekly will result in the unnecessary collection of data from weekly users. We could specify dates several months into the future, but, aside from causing delays in the projects these collectors would support, that may also cause bugs in the implementation (and we've had those) to only be discovered months after the code has been added to all recent releases, both weekly and LTS, removing our ability to quickly react to regressions reported in weekly releases.

And many past implementations collected data for just this short of a period, producing useful data during that time:

  • security-system-properties (the JEP-214 reference impl) collected for 3 months,
  • AcceptLanguages for 3 months,
  • Stapler (1): ~3.7 months (the re-activation added ~3 months),
  • agent-to-controller file path for just over 3 months once it was merged.

None of these would have been able to cover data from across the user base (i.e., including LTS) without a backport.

Copy link
Member

@daniel-beck daniel-beck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and seems to contain all of the disabled-by-default permissions.

Suggested docs change to make this accurate (we don't actually collect system properties).

@NotMyFault NotMyFault added the rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted label Nov 9, 2022
Copy link
Contributor

@Wadeck Wadeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@NotMyFault NotMyFault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me to backport this into 2.375.1 👍🏻

Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>
@NotMyFault
Copy link
Member

/label ready-for-merge


This PR is now ready for merge. We will merge it after ~24 hours if there is no negative feedback.
Please see the merge process documentation for more information about the merge process.
Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Nov 10, 2022
@NotMyFault NotMyFault merged commit 8b58686 into jenkinsci:master Nov 11, 2022
NotMyFault pushed a commit to NotMyFault/jenkins that referenced this pull request Nov 11, 2022
…enkinsci#7342)

* [JENKINS-70044] Add telemetry for activation of optional permissions

* [JENKINS-70044] Add description.jelly for OptionalPermissions telemetry collector

* [JENKINS-70044] Improve phrasing in description.jelly

Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>

Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>
(cherry picked from commit 8b58686)
@dwnusbaum dwnusbaum deleted the optional-permissions branch November 11, 2022 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants