forked from jenkinsci/jenkins-charm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new quiet-down and cancel-quiet-down actions to the charm
- Loading branch information
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
restart: | ||
description: Wait for all jobs to be completed and restart jenkins. | ||
upgrade: | ||
description: Upgrade jenkins package when using bundle. | ||
description: Upgrade jenkins package when using bundle. | ||
quiet-down: | ||
description: Put Jenkins in a Quiet mode. In that mode Jenkins doesn’t start any build. | ||
cancel-quiet-down: | ||
description: Cancel quiet mode. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/local/sbin/charm-env python3 | ||
|
||
from charmhelpers.core.hookenv import ( | ||
action_fail, | ||
action_set, | ||
) | ||
|
||
from charms.apt import status_set | ||
|
||
from charms.layer.jenkins.api import Api | ||
|
||
|
||
def cancel_quiet_down(): | ||
api = Api() | ||
api.cancel_quiet_down() | ||
status_set("active", "Jenkins is running") | ||
action_set({'output': "Quiet mode has been cancelled", | ||
'outcome': 'Success'}) | ||
|
||
|
||
try: | ||
cancel_quiet_down() | ||
except Exception as e: | ||
action_fail("Failed to put jenkins in Quiet mode: {}".format(str(e))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/local/sbin/charm-env python3 | ||
|
||
from charmhelpers.core.hookenv import ( | ||
action_fail, | ||
action_set, | ||
) | ||
|
||
from charms.apt import status_set | ||
|
||
from charms.layer.jenkins.api import Api | ||
|
||
|
||
def quiet_down(): | ||
api = Api() | ||
api.quiet_down() | ||
status_set("maintenance", "Jenkins is in Quiet mode") | ||
action_set({'output': "Jenkins has been put in Quiet mode", | ||
'outcome': 'Success'}) | ||
|
||
|
||
try: | ||
quiet_down() | ||
except Exception as e: | ||
action_fail("Failed to put jenkins in Quiet mode: {}".format(str(e))) |