Skip to content

Commit

Permalink
ci - doc building redux (cloud-custodian#3355)
Browse files Browse the repository at this point in the history
  • Loading branch information
kapilt authored Jan 14, 2019
1 parent 02e7536 commit 5514488
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 44 deletions.
4 changes: 4 additions & 0 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ jobs:
BUILD_REASON: $(Build.Reason)
BUILD_BRANCH: $(Build.SourceBranchName)

- script: make sphinx
displayName: "Docs Build"
condition: "eq(variables['python.version'], '3.7')"

- task: PublishTestResults@2
displayName: "Publish Test Results Azure"
inputs:
Expand Down
32 changes: 16 additions & 16 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#build:
# documentation:
# image: python:2.7
# commands:
# - git config --global user.email "[email protected]"
# - git config --global user.name "Custodian CI"
# - pip install tox
# - tox -e docs
# - git remote update origin --prune
# - make ghpages
# - git branch
# # switch back to master post doc-build
# - git checkout master
# when:
# event: push
# branch: master
build:
documentation:
image: python:2.7
commands:
- git config --global user.email "[email protected]"
- git config --global user.name "Custodian CI"
- pip install tox
- tox -e docs
- git remote update origin --prune
- make ghpages
- git branch
# switch back to master post doc-build
- git checkout master
when:
event: push
branch: master

#deploy:
# # sphinx documentation build / per documentation build section
Expand Down
4 changes: 1 addition & 3 deletions docs/Makefile.sphinx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Makefile for Sphinx documentation
#

VIRTUALENV = $(shell echo $$VIRTUAL_ENV | awk -F "/" '{print $$NF}')

ifndef VIRTUALENV
VIRTUALENV = py27
VIRTUALENV = py37
endif

# You can set these variables from the command line.
Expand Down
22 changes: 14 additions & 8 deletions docs/source/azure/advanced/appinsightslogging.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
.. _azure_appinsightslogging:

App Insights Logging & Metrics
===================
==============================

Writing Custodian Logs to Azure App Insights
----------------------------------------------
--------------------------------------------

Custodian can optionally upload its logs in realtime to App Insights, if a log group is specified.
Each policy’s log output contains policy name, subscription id and execution id properties.
Custodian can optionally upload its logs in realtime to App Insights,
if a log group is specified. Each policy’s log output contains policy
name, subscription id and execution id properties.

Usage example using instrumentation key:

Expand All @@ -23,15 +24,20 @@ Usage example using resource name:
Writing Custodian Metrics to Azure App Insights
----------------------------------------------
-----------------------------------------------

By default Cloud Custodian generates App Insights metrics on each policy for the number of resources that matched the set of filters, the time to retrieve and filter the resources, and the time to execute actions.
By default Cloud Custodian generates App Insights metrics on each
policy for the number of resources that matched the set of filters,
the time to retrieve and filter the resources, and the time to execute
actions.

Additionally some filters and actions may generate their own metrics.

You can specify the instrumentation key or resource group and resource names, similar to Logs output.
You can specify the instrumentation key or resource group and resource
names, similar to Logs output.

In order to enable metrics output, the metrics flag needs to be specified when running Cloud Custodian:
In order to enable metrics output, the metrics flag needs to be
specified when running Cloud Custodian:

.. code-block:: sh
Expand Down
29 changes: 14 additions & 15 deletions docs/source/usecases/elbgarbagecollection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ and configured.
actions:
- type: mark-for-op
tag: maid_status
msg: "Unused ELB No Instances: {op}@{action_date}"
op: delete
days: 14
- type: notify
Expand All @@ -37,16 +36,16 @@ and configured.
subject: "ELB - No Instances Attached - [custodian {{ account }} - {{ region }}]"
violation_desc: "No Instances Are Attached To The Following ELB(s):"
action_desc: |
"Actions Taken: The unused ELBs have been marked for deletion in 14 if they
remain unused. If you still need the ELBs listed below, please attach instances
to them, otherwise please delete them if not needed anymore."
Actions Taken: The unused ELBs have been marked for deletion in 14 if they
remain unused. If you still need the ELBs listed below, please attach instances
to them, otherwise please delete them if not needed anymore.
to:
- [email protected]
- resource-owner
- [email protected]
- resource-owner
transport:
type: sqs
queue: https://sqs.us-east-1.amazonaws.com/12345678900/cloud-custodian-mailer
region: us-east-1
type: sqs
queue: https://sqs.us-east-1.amazonaws.com/12345678900/cloud-custodian-mailer
region: us-east-1
- name: elb-unmark-if-in-use
resource: elb
Expand All @@ -56,7 +55,7 @@ and configured.
filters:
- "tag:maid_status": not-null
- not:
- Instances: []
- Instances: []
actions:
- type: remove-tag
tags: [maid_status]
Expand All @@ -78,9 +77,9 @@ and configured.
violation_desc: "No Instances Are Attached To ELB for over 14 days:"
action_desc: "Actions Taken: The ELB has been deleted"
to:
- [email protected]
- resource-owner
- [email protected]
- resource-owner
transport:
type: sqs
queue: https://sqs.us-east-1.amazonaws.com/12345678900/cloud-custodian-mailer
region: us-east-1
type: sqs
queue: https://sqs.us-east-1.amazonaws.com/12345678900/cloud-custodian-mailer
region: us-east-1
3 changes: 2 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
coverage>=4.2
nose==1.3.7
mock==2.0.0
Sphinx==1.7.6
Sphinx==1.8.3
Pygments==2.3.0
placebo==0.8.1
flake8==3.5.0
redis
Expand Down
2 changes: 1 addition & 1 deletion tools/c7n_sphinxext/c7n_sphinxext/c7n_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from docutils.parsers.rst.directives import unchanged

from sphinx.errors import SphinxError
from sphinx.directives import Directive
from sphinx.directives import SphinxDirective as Directive
from sphinx.util.nodes import nested_parse_with_titles

from .templates import TEMPLATE_C7N_SCHEMA
Expand Down

0 comments on commit 5514488

Please sign in to comment.