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.2.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60ce3909ccc4adaf3db8c54fd26d22727babb77ee8846985d6701c3871f93695 |
|
MD5 | 3a1547cecdf3af0f9022551d2da4363a |
|
BLAKE2b-256 | 45fbb1db2239ffbe11ca184fca3163ce79f967d4341fe261e1b52e056f7a4490 |