Parse yml file and update alerts
Project description
Ignore Alerts
Set Ignore status for alert based on input YAML file
- Supported Operating Systems
- Prerequisites
- Installation
- Configuration Parameters
- Usage
- Execution Examples
- Other Section
Supported Operating Systems
- Linux (Bash): CentOS, Debian, Ubuntu
- Windows (PowerShell): 10, 2012, 2016
Prerequisites
- Python 3.9+
- Mend user with admin permissions
Installation
$ pip install mend-ignore-alerts
Note: Depending on whether the package was installed as a root user or not, you need to make sure the package installation location was added to the
$PATH
environment variable.
Configuration Parameters
Note: Parameters can be specified as either command-line arguments, environment variables, or a combination of both.
Command-line arguments take precedence over environment variables.
CLI argument | Env. Variable | Type | Required | Description |
---|---|---|---|---|
‑‑help | switch |
No | Show help and exit | |
‑‑user-key | WS_USERKEY |
string |
Yes | Mend User Key |
‑‑api-key | WS_APIKEY |
string |
Yes | Mend API Key |
‑‑url | WS_URL |
string |
Yes | Mend Server URL |
‑‑yaml | WS_YAML |
string |
Yes | Yaml file's name for parsing in case mode is equal load . If mode is create then Yaml file will be created |
‑‑mode | WS_MODE |
string |
Yes | create or load value |
‑‑ghpat | WS_GHPAT |
string |
No | GitHub PAT |
‑‑ghowner | WS_GHOWNER |
string |
No | GitHub Owner |
‑‑ghrepo | WS_GHREPO |
string |
No | GitHub Repo name |
Usage
Using command-line arguments only:
ignore_alerts --user-key WS_USERKEY --api-key WS_APIKEY --url $WS_WSS_URL --yaml $WS_YAML --mode create
Using environment variables:
export WS_USERKEY=xxxxxxxxxxx
export WS_APIKEY=xxxxxxxxxxx
export WS_URL=https://saas.mend.io
export WS_YAML=waiverexample.yml
ignore_alerts
Note: Either form is accepted. For the rest of the examples, the latter form would be used
Getting waiver file from GitHub Repo:
export WS_USERKEY=xxxxxxxxxxx
export WS_APIKEY=xxxxxxxxxxx
export WS_URL=https://saas.mend.io
export WS_YAML=waiverexample.yml
export WS_GHPAT=xxxxxxxxxxx
export WS_GHOWNER = xxxxxxxxxxx
export WS_GHREPO = TestRepoName
ignore_alerts
Running script as part of CI process: The example of CI yaml file
name: Ignore Alert Workflow
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9']
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: |
pip install mend-ignore-alerts
- name: Run ignore_alert script
env:
WS_APIKEY: ${{ secrets.apikey }}
USER_KEY: ${{ secrets.userkey }}
WS_URL: "saas.mend.io"
YAML: "examplewaiver.yml"
run:
ignore_alerts --url $WS_URL --yaml $YAML --apiKey $WS_APIKEY --user-key $USER_KEY --mode load
The YAML file should be placed in the Repo folder on GitHub
Execution Examples
Note: In the following examples, $WS_USERKEY, $WS_APIKEY, $WS_URL and $WS_MODE are assumed to have been exported as environment variables.
$ ignore_alerts --yaml whaiverexample.yml
Usind examplewaiver.yml file from some Repo
$ ignore_alerts --yaml whaiverexample.yml --ghpat xxxxxxx --ghowner Owner --ghrepo RepoName --mode create
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for mend_ignore_alerts-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86e37d6a64b810dae1437ec9e55f8c064aff3e9a2869ba6914be6a5f8d2d2d09 |
|
MD5 | b6d78a60b4fa9d25931b920c5df48f07 |
|
BLAKE2b-256 | 8fd462ada918e167fce6ce5314cccd6c5694fb6c17c41578117b0307ed64146a |