Skip to content

Commit

Permalink
Merge pull request #19 from takipi/develop
Browse files Browse the repository at this point in the history
Develop to master for version 1.0.0
  • Loading branch information
ccaspanello authored Jul 8, 2020
2 parents 2016f96 + d971cee commit c27c934
Show file tree
Hide file tree
Showing 35 changed files with 625 additions and 1,750 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ target/*
*/target/*
bin/

# idea
*.iml

# VSC
.settings
.project
.project
.classpath
14 changes: 10 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
FROM maven:3.5.3-jdk-8 as mvn
COPY . .
RUN mvn package
#FROM maven:3.5.3-jdk-8 as mvn
#COPY . .
#RUN mvn package
#
#FROM openjdk:8-jre-slim
#RUN apt update && apt install -y jq curl
#ENV CONCOURSE_RESOURCES=/opt/resource/
#COPY --from=mvn target/concourse-overops.jar /artifact/concourse-overops.jar
#COPY /assets/ ${CONCOURSE_RESOURCES}/

FROM openjdk:8-jre-slim
RUN apt update && apt install -y jq curl
ENV CONCOURSE_RESOURCES=/opt/resource/
COPY --from=mvn target/concourse-overops.jar /artifact/concourse-overops.jar
COPY target/concourse-overops.jar /artifact/concourse-overops.jar
COPY /assets/ ${CONCOURSE_RESOURCES}/
96 changes: 33 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,24 @@ example file name: `overops-resource.yml`

```yaml
resource_types:
- name: overops-resource
type: docker-image
source:
repository: overops/concourse-resource
tag: latest
- name: overops-resource
type: docker-image
source:
repository: overops/concourse-resource
tag: latest

resources:
- name: overops-report
type: overops-resource
source:
overops_url: https://api.overops.com
overops_sid: S111111
overops_api_key: ((overops_api_key))
application_name: App1
deployment_name: Dep1
mark_unstable: true
new_events: true
resurfaced_errors: true
debug: false
- name: overops-report
type: overops-resource
source:
overops_url: https://api.overops.com
overops_sid: S111111
overops_api_key: ((overops_api_key))
application_name: App1
mark_unstable: true
new_events: true
resurfaced_errors: true
debug: true

jobs:
- name: demo
Expand All @@ -44,89 +43,60 @@ jobs:
path: sh
args:
- -exc
- date +%s > ./files/created_file
- date +%s > ./files/deployment_name
outputs:
- name: files
- put: overops-report
inputs:
- files
params:
deployment_name:
file: ./files/created_file
get_params:
mark_unstable: false
deployment_file: ./files/deployment_name
debug: false
```
## Configuration parameters
### Reading parameters from files
The Application Name and the Deployment Name can be provided staticly or dynamically. In most cases the Deployment name is dynamic, in which case you can provide this at build time using the `deployment_file` parameter. The same behavior can be used for the Application Name using the `application_file` parameter. Below describes the behavior for the static and dynamic parameters.

Any parameter can be read from existing file on filesystem with following construction:
`application_name` and `application_file` parameters can be used in combination or individually. If a `application_file` is provided it will overwrite `application_name`.

```yaml
- put: overops-report
inputs:
- files
get_params:
param_name:
file: files/my/file
```
Where `inputs` are existing output from previous steps

### `deployment_name`

`deployment_name` is a parameter that used to version the resources and best to provide it dynamically from file (as example above)
into `params` section.

### All parameters references
`deployment_name` and `deployment_file` parameters can be used in combination or individually. If a `deployment_file` is provided it will overwrite `deployment_name`.

All of the following parameters can be provided globally in the Resource `source` section as well as can be overwritten on per step basis
in the `get_params` section of `put` step.

`deployment_name` is an exception and need to be provided in the `params` section of `put` step, as described in the example above.
All of the following parameters can be provided globally in the Resource `source` section as well as can be overwritten on per step basis in the `params` section of `put` step.

Parameter | Required | Default Value | Description
---------|----------|---------|---------
overops_url | true | --- | The OverOps API Endpoint(Saas: https://api.overops.com)
overops_app_url | false | --- | The OverOps Endpoint to be used with the link options (Saas: https://app.overops.com)
overops_sid | true | --- | The OverOps environment identifier (e.g S4567) to inspect data for this build
overops_api_key | true | --- | API Key for interaction with OverOps API
application_name | true | --- | [Application Name](https://doc.overops.com/docs/naming-your-application-server-deployment) as specified in OverOps
deployment_name | true | --- | [Deployment Name](https://doc.overops.com/docs/naming-your-application-server-deployment) as specified in OverOps
application_name | false | --- | Use this parameter if the application name will be static. [Application Name](https://doc.overops.com/docs/naming-your-application-server-deployment) as specified in OverOps
application_file | false | --- | Use this parameter if the application name will be read from a file (dynamic). This parameter will overwrite the application_name parameter if defined. [Application Name](https://doc.overops.com/docs/naming-your-application-server-deployment) as specified in OverOps
deployment_name | false | --- | Use this parameter if the deployement_name will be static. [Deployment Name](https://doc.overops.com/docs/naming-your-application-server-deployment) as specified in OverOps
deployment_file | false | --- | Use this parameter if the deployement_name will be read from a file (dynamic). This parameter will overwrite the deployment_name parameter if defined. [Deployment Name](https://doc.overops.com/docs/naming-your-application-server-deployment) as specified in OverOps
regex_filter | false | | A way to filter out specific event types from affecting the outcome of the OverOps Reliability report.
mark_unstable | false | false | If set to `true` the build will be failed if any of the above gates are met
link | false | false | If set to `true` a link to the Quality Report will be generated and displayed instead of the Quality Report itself. The parameter `overops_app_url` needs to be set for the link to be generated correctly. Also this option, if set to `true`, voids the mark_unstable option. This link can be used if it is desired to not fail the build and you do not want to wait for the Quality Report to be generated.
print_top_issues | false | 5 | Prints the top X events (as provided by this parameter) with the highest volume of errors detected within the active time window, This is useful when used in conjunction with Max Error Volume to identify the errors which caused a build to fail
new_events | false | false | If any new errors is detected, the build will be marked as failed
resurfaced_errors| false | false | If any resurfaced errors is detected, the build will be marked as failed
max_error_volume | false | 0 | Set the max total error volume allowed. If exceeded the build will be marked as failed
max_unique_errors | false | 0 | Set the max total error volume allowed. If exceeded the build will be marked as failed
critical_exception_types | false | | A comma delimited list of exception types that are deemed as severe regardless of their volume.<br>- If any events of any exceptions listed have a count greater than zero, the build will be marked as unstable. Blank to skip this test.<br>*(For example: `NullPointerException,IndexOutOfBoundsException`)*
active_timespan | false | 0 | The time window inspected to search for new issues and regressions. Set to zero to use the Deployment Name (which would be the current build).<br>_(For example: `1d` [d - day, h - hour, m - minute] would be one day active time window)_
baseline_timespan| false | 0 | The time window against which events in the active window are compared to test for regressions. If this gate is used, baseline time window is required.<br>_(For example: `14d` [d - day, h - hour, m - minute] would be a two week baseline time window.)_
min_volume_threshold| false | 0 | The minimal number of times an event of a non-critical type (e.g. uncaught) must take place to be considered severe.<br> - If a New event has a count greater than the set value, it will be evaluated as severe and could break the build if its event rate is above the Event Rate Threshold.<br> - If an Existing event has a count greater than the set value, it will be evaluated as severe and could break the build if its event rate is above the Event Rate Threshold and the Critical Regression Threshold.<br> - If any event has a count less than the set value, it will not be evaluated as severe and will not break the build.
min_error_rate_threshold| false | 0 | Value in range `0-1`. The minimum rate at which event of a non-critical type (e.g. uncaught) must take place to be considered severe. A rate of 0.1 means the events is allowed to take place <= 10% of the time.<br>- If a New event has a rate greater than the set value, it will be evaluated as severe and could break the build if its event volume is above the Event Volume Threshold. <br>- If an Existing event has a rate greater than the set value, it will be evaluated as severe and could break the build if its event volume is above the Event Volume Threshold and the Critical Regression Threshold.<br>- If an event has a rate less than the set value, it will not be evaluated as severe and will not break the build.
regression_delta | false | 0 | Value in range `0-1`. The change in percentage between an event's rate in the active time span compared to the baseline to be considered a regression. The active time span is the Active Time Window or the Deployment Name (whichever is populated). A rate of 0.1 means the events is allowed to take place <= 10% of the time.<br>- If an Existing event has an error rate delta (active window compared to baseline) greater than the set value, it will be marked as a regression, but will not break the build.
critical_regression_delta | false | 0 | The change in percentage between an event's rate in the active time span compared to the baseline to be considered a critical regression. The active time span is the Active Time Window or the Deployment Name (whichever is populated). A rate of 0.1 means the events is allowed to take place <= 10% of the time.<br>- If an Existing event has an error rate delta (active window compared to baseline) greater than the set value, it will be marked as a severe regression and will break the build.
apply_seasonality | false | false | If peaks have been seen in baseline window, then this would be considered normal and not a regression. Should the plugin identify an equal or matching peak in the baseline time window, or two peaks of greater than 50% of the volume seen in the active window, the event will not be marked as a regression.
show_events_for_passed_gates | false | false | Display events for the quality gates even if the the gates passed.
pass_build_on_exception | false | false | Determines if the build should pass if there are exception/exceptions.
debug | false | false | For advanced debugging purposes only

## ARC Links

The ARC Links inside of the UI display after a build with the OverOps resource are not clickable they must be copy and pasted to be used.

## Behavior

### `check`

Checks OverOps API responsiveness
no-op

### `out`

Creates resource version and triggers the `in` script.

**Always trigger resource via `put` step**
Generates the report based on OverOps events, if `mark_unstable` is set to `true` then it fails the build, until reported issues are fixed.

### `in`

Generates the report based on OverOps events, if `mark_unstable` is set to `true` then fails the build, until reported issues are fixed.
no-op
13 changes: 1 addition & 12 deletions assets/check
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
#!/bin/bash
set -e # exit on error
source $CONCOURSE_RESOURCES/shared

# check if API responds, expected resource versions will be generated on demand by "out" script
url="${OVEROPS_URL}/api/v1/test"
status_code=$(curl -o /dev/null --silent --head --write-out '%{http_code}\n' $url)
if [ $status_code -eq "200" ]
then
jq -n --argjson version "$VERSION_IN" 'if ($version|length > 0) then [$version] else [] end' 3>&1
else
echo "${OVEROPS_URL} responded with unexpected status code $status_code" 1>&2
exit 1
fi
echo "[]"
8 changes: 1 addition & 7 deletions assets/in
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
#!/bin/bash

source $CONCOURSE_RESOURCES/shared

set -e

metadata=$($cmd)

jq -n --argjson metadata "$metadata" --argjson version "$VERSION_IN" '{"version":$version,"metadata":$metadata}' 3>&1
echo '{"version":{}}'
8 changes: 6 additions & 2 deletions assets/out
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@

source $CONCOURSE_RESOURCES/shared

# generate timestamp bases version, which will automatically trigger the "in" script
jq -n --argjson version "$VERSION_OUT" '{"version":$version}' 3>&1
set -e

metadata=$($cmd)
isStable=$?
jq -n --argjson version "$VERSION_IN" '{"version":$version}' 3>&1
exit $isStable
Loading

0 comments on commit c27c934

Please sign in to comment.