@@ -10,125 +10,3 @@ jobs:
1010 steps :
1111 - name : Checkout the repository
1212 uses : actions/checkout@v4.1.0
13-
14- - name : Create source file
15- run : |
16- echo "testcode"> source.py
17-
18- # Test Failure on missing client-id and secret
19- - name : Run With Empty Client And Secret
20- id : empty_client_secret
21- continue-on-error : true
22- uses : ./
23- with :
24- project_name : ${{ github.event.repository.name }}-tests
25- base_uri : https://fake.com
26- cx_client_id : " "
27- cx_client_secret : " "
28- - name : Check If Authentication Failed
29- if : ${{contains( steps.empty_client_secret.outcome, 'success')}}
30- run : |
31- echo "The authentication must fail if invalid client id or password is used"
32- echo "${{ steps.empty_client_secret.outcome}}"
33- exit 1
34-
35- # Test valid input
36- - name : Valid Scenario
37- id : valid_scenario
38- continue-on-error : true
39- uses : ./
40- with :
41- project_name : ${{ github.event.repository.name }}-tests
42- base_uri : ${{ secrets.CX_BASE_URI }}
43- cx_tenant : ${{ secrets.CX_TENANT }}
44- cx_client_id : ${{ secrets.CX_CLIENT_ID }}
45- cx_client_secret : ${{ secrets.CX_CLIENT_SECRET }}
46- additional_params : --file-include *.sh,Dockerfile --scan-types kics --report-format summaryJSON
47- - name : Check If Scan Failed
48- if : ${{ contains( steps.valid_scenario.outcome, 'success') == false}}
49- run : |
50- echo "The action outcome should be success."
51- echo "${{ steps.valid_scenario.outcome}}"
52- exit 1
53- - name : Check If Output Scan ID Is Empty
54- if : steps.valid_scenario.outputs.cxScanID == ''
55- run : |
56- echo "Scan ID empty."
57- exit 1
58- - name : Print Output Scan ID
59- run : |
60- echo "${{ steps.valid_scenario.outputs.cxScanID }}"
61- - name : Check If Output Log Is Empty
62- if : steps.valid_scenario.outputs.cxcli == ''
63- run : |
64- echo "Output log empty."
65- exit 1
66- - name : Print CLI Output
67- run : |
68- echo "${{ steps.valid_scenario.outputs.cxcli }}"
69-
70- # Test failure when wrong preset name
71- - name : Test With Wrong Preset Name
72- id : preset_name_test
73- continue-on-error : true
74- uses : ./
75- with :
76- project_name : ${{ github.event.repository.name }}-tests
77- base_uri : ${{ secrets.CX_BASE_URI }}
78- cx_tenant : ${{ secrets.CX_TENANT }}
79- cx_client_id : ${{ secrets.CX_CLIENT_ID }}
80- cx_client_secret : ${{ secrets.CX_CLIENT_SECRET }}
81- additional_params : --sast-preset-name ChekmarxDefaultFake --scan-types sast
82- - name : Check If Preset Name Scan Completed
83- if : ${{contains( steps.preset_name_test.outcome, 'success')}}
84- run : |
85- echo "The cli should fail. Wrong preset name provided"
86- echo "${{ steps.preset_name_test.outcome}}"
87- exit 1
88-
89- # Test source path input
90- - name : Create subfolder and add file
91- run : |
92- mkdir -p my_source_dir
93- echo "This is a test file for Checkmarx scanning" > my_source_dir/test-file.sh
94- echo "FROM alpine:latest" > my_source_dir/Dockerfile
95-
96- - name : Valid Scenario With Source Path
97- id : valid_scenario_source_path
98- continue-on-error : true
99- uses : ./
100- with :
101- project_name : ${{ github.event.repository.name }}-tests
102- base_uri : ${{ secrets.CX_BASE_URI }}
103- cx_tenant : ${{ secrets.CX_TENANT }}
104- cx_client_id : ${{ secrets.CX_CLIENT_ID }}
105- cx_client_secret : ${{ secrets.CX_CLIENT_SECRET }}
106- source_dir : " ./my_source_dir"
107- additional_params : --file-include *.sh,Dockerfile --scan-types kics --report-format summaryJSON
108-
109- - name : Check If Scan Failed
110- if : ${{ contains( steps.valid_scenario_source_path.outcome, 'success') == false}}
111- run : |
112- echo "The action outcome should be success."
113- echo "${{ steps.valid_scenario_source_path.outcome}}"
114- exit 1
115-
116- - name : Check If Output Scan ID Is empty
117- if : steps.valid_scenario_source_path.outputs.cxScanID == ''
118- run : |
119- echo "Scan ID empty."
120- exit 1
121-
122- - name : Print Output Scan ID
123- run : |
124- echo "${{ steps.valid_scenario_source_path.outputs.cxScanID }}"
125-
126- - name : Check If Output Log Is Empty
127- if : steps.valid_scenario_source_path.outputs.cxcli == ''
128- run : |
129- echo "Output log empty."
130- exit 1
131-
132- - name : Print cCLI Output
133- run : |
134- echo "${{ steps.valid_scenario_source_path.outputs.cxcli }}"
0 commit comments