Skip to content

Commit

Permalink
feat(OX-5077) added support for partial flag
Browse files Browse the repository at this point in the history
  • Loading branch information
dummygithubaccount committed Jan 7, 2024
1 parent dc88f59 commit b6a6d05
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
27 changes: 22 additions & 5 deletions images/entrypoint-oxeye-scan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ secret=$4
workspace_id=$5
release=$6
excludes=$7

if [ -z $release ]; then
release="release"
fi
partial=$8

# Get Bearer ToKen
bearerToken=$(curl -s -X POST --location "https://${host}/api/auth/api-token" \
Expand Down Expand Up @@ -57,4 +54,24 @@ curl -s -o /app/scm_scan.py --location "https://${host}/api/scm/script?provider=
--header "Authorization: Bearer ${bearerToken}"

# RUN SCM Scan Script
python /app/scm_scan.py --host $host --repo-token $token --client-id $client_id --secret $secret --workspace-id $workspace_id --release $release --excludes "$excludes"
default_flags="--host $host
--repo-token $token
--client-id $client_id
--secret $secret
--workspace-id $workspace_id"

scm_scan_flags=$default_flags

if [ -n "$release" ]; then
scm_scan_flags="$scm_scan_flags --release $release"
fi

if [ -n "$excludes" ]; then
scm_scan_flags="$scm_scan_flags --excludes $excludes"
fi

if [ "$partial" == "true" ]; then
scm_scan_flags="$scm_scan_flags --partial"
fi

python /app/scm_scan.py $scm_scan_flags
2 changes: 0 additions & 2 deletions images/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
logging==0.4.9.6
requests==2.31.0
uuid==1.30
pydantic==2.4.2
gitpython==3.1.40
5 changes: 5 additions & 0 deletions oxeye-scan/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ inputs:
excludes:
description: List of directores to be excluded from scan
required: false
partial:
description: Scan only changes
required: false
default: 'false'
runs:
using: docker
image: docker://ghcr.io/ox-eye/github-actions/oxeye-scan:v0.0.23
Expand All @@ -35,3 +39,4 @@ runs:
- ${{ inputs.workspace-id }}
- ${{ inputs.release }}
- ${{ inputs.excludes }}
- ${{ inputs.partial }}
3 changes: 2 additions & 1 deletion oxeye-scan/gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ variables:
OXEYE_SCAN_WORKSPACE_ID: ''
OXEYE_SCAN_RELEASE: ''
OXEYE_SCAN_EXCLUDES: ''
OXEYE_SCAN_PARTIAL: 'false'
oxeye_code_scan:
stage: oxeye_code_scan
image:
Expand All @@ -16,4 +17,4 @@ oxeye_code_scan:
- /bin/sh
- '-c'
script:
- /entrypoint.sh ${OXEYE_SCAN_GITLAB_TOKEN} ${OXEYE_SCAN_OXEYE_URL} ${OXEYE_SCAN_CLIENT_ID} ${OXEYE_SCAN_SECRET} ${OXEYE_SCAN_WORKSPACE_ID} "${OXEYE_SCAN_RELEASE}" "${OXEYE_SCAN_EXCLUDES}"
- /entrypoint.sh ${OXEYE_SCAN_GITLAB_TOKEN} ${OXEYE_SCAN_OXEYE_URL} ${OXEYE_SCAN_CLIENT_ID} ${OXEYE_SCAN_SECRET} ${OXEYE_SCAN_WORKSPACE_ID} "${OXEYE_SCAN_RELEASE}" "${OXEYE_SCAN_EXCLUDES}" "${OXEYE_SCAN_PARTIAL}"

0 comments on commit b6a6d05

Please sign in to comment.