koudaiii/qucli

Feature Request: Enable repositorynotification api

snoby opened this issue ยท 4 comments

snoby commented

It would be a great benefit if when using qucli if after i create my repository and add my users and robot accounts, if I could also add a webhook and the webhook destination through qucli. This can be accomplished with the

repositorynotification : List, create and manage repository events/notifications.

rest api.
Referenced from here: quay Rest Api

Thank you for feature request. It's great idea ๐Ÿ˜„

I will check Quay Rest api.

ref https://docs.quay.io/api/swagger/#!/repositorynotification/createRepoNotification

NotificationCreateRequest {
  eventConfig (object): JSON config information for the specific event of notification,
  title (string, optional): The human-readable title of the notification,
  config (object): JSON config information for the specific method of notification,
  event (string): The event on which the notification will respond,
  method (string): The method of notification (such as email or web callback)
}

image

It is hard for me to understand NotificationCreateRequest type of values. ๐Ÿ˜ข

snoby commented

Yes I agree - their API is not good when creating a webhook for a repository

I've created a ticket on their documentation repository: coreos/quay-docs#97

Released v0.6.5

$ brew update
$ brew upgrade qucli

https://github.com/koudaiii/qucli#get

$ qucli get koudaiii/test
Repository:
	quay.io/koudaiii/test
Visibility:
	private
Permissions:
	koudaiii(admin)
Notifications:
	b0736be9-f0eb-4c3c-8d33-2e331b1e5b0f	Some title	repo_push	map[]	slack	map[url:https://hooks.slack.com/service/some/token/here]

add-notification

Add notification in repository with some options.

  • webhook method
$ qucli add-notification koudaiii/test --event="repo_push" --method="webhook" --url="http://url/goes/here"
Added! 	3c3c142c-2161-42ae-9414-39c787386b5c		repo_push	map[]	webhook	map[url:http://url/goes/here]	in quay.io/koudaiii/test
  • slack method
$ qucli add-notification koudaiii/test --event="repo_push" --method="slack" --url="https://hooks.slack.com/service/{some}/{token}/{here}"
Added! 	61ae254f-89f0-4a36-a439-9b78004f2ab0		repo_push	map[]	slack	map[url:https://hooks.slack.com/service/{some}/{token}/{here}]	in quay.io/koudaiii/test
  • options
$ qucli add-notification
qucli supported only Quay.io
Usage: add-notification
  qucli add-notification koudaiii/qucli --event="repo_push" --method="webhook" --url="http://url/goes/here"

Option:
  --event string        set 'evnet'.  ['repo_push', 'build_queued', 'build_start', 'build_success', 'build_failure', 'build_cancelled', 'vulnerability_found'].
  --level string        if you use 'vulnerability_found' evnet, A vulnerability must have a severity of the chosen level (highest level is 0).[0-6]
  --ref string          if you use event excluding 'repo_push' event, an optional regular expression for matching the git branch or tag git ref. If left blank, the notification will fire for all builds.(refs/heads/somebranch)|(refs/tags/sometag)
  --method string       set 'method'.  ['webhook', 'slack', 'email'].
  --email string        if you use 'email' method, set E-mail address. 'test@example.com'.
  --url string          if you use 'webhook' or 'slack' method, set url. 'http://url/goes/here' or 'https://hooks.slack.com/service/{some}/{token}/{here}'.
  --title string        The title for a notification is an optional field for a human-readable title for the notification.

test-notification

https://github.com/koudaiii/qucli#test-notification

Test notification from repository.

$ qucli test-notification koudaiii/qucli 0c91e746-9d9e-4845-8dff-3c0995976dfa
Test Notification! 0c91e746-9d9e-4845-8dff-3c0995976dfa notification in quay.io/koudaiii/qucli

delete-notification

https://github.com/koudaiii/qucli#delete-notification

Delete notification from repository.

$ ./bin/qucli delete-notification koudaiii/test 3c3c142c-2161-42ae-9414-39c787386b5c
Deleted! 3c3c142c-2161-42ae-9414-39c787386b5c notification in quay.io/koudaiii/test
snoby commented

Justed tested the functionality and it works wonderfully!