Skip to content

Commit

Permalink
[JENKINS-71876] Add "NOTIFY_COMMIT_ACCESS_CONTROL" examples (jenkinsc…
Browse files Browse the repository at this point in the history
…i#1641)

* Update documentation for setting NOTIFY_COMMIT_ACCESS_CONTROL system property

* fixed spacing

* Updated README file

* Remove GitPod configuration

* Use disabled-for-polling in examples

Since `disabled` is not recommneded, let's use a little more favorable
example to allow anonymous notifyCommit so long as the request only
invokes polling.

Include links that provide more information to describe system properties
and Groovy post inititalization scripts.

* Add prefix text for system property

Move mode descriptions before method description

* Retain indentation for code fragment

* Remove groovy specific formatting from example

Looks better without it

* Move return value description earlier

---------

Co-authored-by: Mark Waite <[email protected]>
  • Loading branch information
sirine707 and MarkEWaite authored Aug 21, 2024
1 parent da6948a commit c380f5b
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ If polling finds a change worthy of a build, a build will be triggered.
This allows a notify script to remain the same for all Jenkins jobs.
Or if you have multiple repositories under a single repository host application (such as Gitosis), you can share a single post-receive hook script with all the repositories.

When notifyCommit is successful, the list of triggered projects is returned.

The `token` parameter is required by default as a security measure, but can be disabled by the following link:https://www.jenkins.io/doc/book/managing/system-properties/[system property]:

....
Expand All @@ -337,7 +339,27 @@ It has two modes:
* `disabled` - Fully disables the access token mechanism and allows all requests to `notifyCommit`
to be unauthenticated. *This option is insecure and is not recommended.*

When notifyCommit is successful, the list of triggered projects is returned.
You can set the `NOTIFY_COMMIT_ACCESS_CONTROL` value with either a link:https://www.jenkins.io/doc/book/managing/system-properties/[system property] or a link:https://www.jenkins.io/doc/book/managing/groovy-hook-scripts/[Groovy hook script].

[[using-a-system-property-push-notification]]
Using a system property::

The `NOTIFY_COMMIT_ACCESS_CONTROL` value can be set from the command line that starts Jenkins.
This method is useful for environments where initial Jenkins settings are managed with command line arguments.
+
....
java -Dhudson.plugins.git.GitStatus.NOTIFY_COMMIT_ACCESS_CONTROL=disabled-for-polling -jar jenkins.war
....

[[using-a-groovy-script-push-notification]]
Using a Groovy script::

The `NOTIFY_COMMIT_ACCESS_CONTROL` value can be set using a Groovy script placed in the `init.groovy.d` subdirectory of the Jenkins home directory.
This method is useful for environments where Jenkins settings are managed with link:https://www.jenkins.io/doc/book/managing/groovy-hook-scripts/#post-initialization-script-init-hook[Groovy post-initialization scripts].
+
----
hudson.plugins.git.GitStatus.NOTIFY_COMMIT_ACCESS_CONTROL='disabled-for-polling'
----

[#enabling-jgit]
=== Enabling JGit
Expand Down

0 comments on commit c380f5b

Please sign in to comment.