Skip to content

Commit be51be6

Browse files
authored
Merge pull request #3 from Qualys/release/1.0.2
Release/1.0.2
2 parents 1e3a341 + 07f6cb1 commit be51be6

2 files changed

Lines changed: 39 additions & 3 deletions

File tree

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,38 @@ jobs:
176176
3. `Qualys URL, Qualys Username , Qualys Password` to be added in `secrets` and provided as `environment variables` to the Qualys IaC GitHub action.
177177
4. Self-hosted runners must use a Linux operating system and have Docker installed to run this action.
178178

179+
## Optional environment variable
180+
| Parameter | Description | Required | Default Value | Parameter Type |
181+
| -----------| -------------------------------------------------------------------------------------------------------- | ------------- | ------------- | ------------- |
182+
| failBuild | This parameter enables marking the workflow as failed or successful based on user input.<br> <b>Parameter Behavior:</b><br><ol><li><b>true -</b><ul><li>If the control check fails → the workflow will be marked as Failed</li><li>If the control check passes → the workflow will be marked as Passed</li></ul></li><li><b>false -</b><ul><li>The workflow will always be marked as Passed, regardless of whether the control check passes or fails.</li></ul></li></ol> | No | true | Variable |
183+
184+
### Example - `failBuild` set to `false`
185+
```yaml
186+
name: Qualys IAC Scan
187+
on:
188+
push:
189+
branches:
190+
- main
191+
jobs:
192+
Qualys_iac_scan:
193+
runs-on: ubuntu-latest
194+
name: Qualys IaC Scan
195+
steps:
196+
- name: Checkout
197+
uses: actions/checkout@v2
198+
with:
199+
fetch-depth: 0
200+
201+
- name: Qualys IAC scan action step
202+
uses: Qualys/github_action_qiac@main
203+
id: qiac
204+
env:
205+
URL: ${{ secrets.URL }}
206+
UNAME: ${{ secrets.USERNAME }}
207+
PASS: ${{ secrets.PASSWORD }}
208+
failBuild: false
209+
```
210+
179211
## GitHub action Parameters
180212

181213
| Parameter | Description | Required | Default | Type |

resultParser.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import sys, json
1+
import sys, json, os
22

33
def print_error_message(result):
44
error_message = ""
@@ -32,9 +32,13 @@ def print_failed_checks(output):
3232
failed_checks = False
3333
for result in output.get("result"):
3434
failed_checks = print_error_message(result)
35+
failBuild = os.getenv("failBuild", "true").lower() == "true"
3536
if failed_checks:
36-
exit(-1)
37-
37+
if failBuild :
38+
print("Pipeline status will be - Failed")
39+
exit(-1)
40+
else:
41+
print("Pipeline status will be - Successful")
3842

3943
# Press the green button in the gutter to run the script.
4044
if __name__ == '__main__':

0 commit comments

Comments
 (0)