Parse yml file and update alerts
Project description
Ignore Alerts
Set Ignore status for alert based on whaiver Yaml
- 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_WSS_URL |
string |
Yes | Mend Server URL |
‑‑yaml | WS_WAIVER |
string |
Yes | Filename of Yaml file for parsing |
‑‑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_WAIVER
Using environment variables:
export WS_USERKEY=xxxxxxxxxxx
export WS_APIKEY=xxxxxxxxxxx
export WS_URL=https://saas.mend.io
export WS_WAYVER=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_WAYVER=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
The YAML file should be placed in the Repo folder on GitHub
Execution Examples
Note: In the following examples, $WS_USERKEY, $WS_APIKEY and $WS_URL 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
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.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4131b15c0bdea1fe302bdc3736164bcb4601450e3c5ad3c4b8479d67b4241e03 |
|
MD5 | 16ff5d8c5d68ed2a91e3125a70b910a1 |
|
BLAKE2b-256 | 96f03bef940621edee43e955e5993be244624c058af9d19ce0068d76632b84a6 |