Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions images/entrypoint-oxeye-scan.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

set -e
set -ex

if [ "$#" -lt 5 ]; then
echo "Error - Missing argument. Please verify your configuration, or contact support@oxeye.io"
Expand All @@ -15,9 +15,31 @@ workspace_id=$5
release=$6
excludes=$7
partial=$8
scheme=$9

echo "Home: $HOME"
if [ "$scheme" = "http" ]; then
config_dir="/root/.oxeye"
config_file="$config_dir/config"
mkdir -p "$config_dir"
echo "scheme: http" > "$config_file"
cat $config_file
else
scheme="https"
fi

if [ "$scheme" = "http" ]; then
config_dir="$HOME/.oxeye"
config_file="$config_dir/config"
mkdir -p "$config_dir"
echo "scheme: http" > "$config_file"
cat $config_file
else
scheme="https"
fi

# Get Bearer ToKen
bearerToken=$(curl -s -X POST --location "https://${host}/api/auth/api-token" \
bearerToken=$(curl -s -X POST --location "${scheme}://${host}/api/auth/api-token" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data "{
Expand Down Expand Up @@ -48,17 +70,18 @@ fi
git config --global --add safe.directory "*"

# Download Script
curl -s -o /app/scm_scan.py --location "https://${host}/api/scm/script?provider=${cicd_tool}" \
curl -s -o /app/scm_scan.py --location "${scheme}://${host}/api/scm/script?provider=${cicd_tool}" \
--header "Content-Type: application/json" \
--header "Accept: application/octet-stream" \
--header "Authorization: Bearer ${bearerToken}"

# RUN SCM Scan Script
default_flags="--host $host
default_flags="--host $host
--repo-token $token
--client-id $client_id
--secret $secret
--workspace-id $workspace_id"
--workspace-id $workspace_id
--scheme $scheme"

scm_scan_flags=$default_flags

Expand All @@ -74,4 +97,4 @@ if [ "$partial" == "false" ]; then
scm_scan_flags="$scm_scan_flags --full"
fi

python /app/scm_scan.py $scm_scan_flags
python /app/scm_scan.py $scm_scan_flags || cat "/tmp/scm.log"
7 changes: 6 additions & 1 deletion oxeye-scan/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ inputs:
description: Scan only changes
required: false
default: 'false'
scheme:
description: scheme for host variable
required: false
default: 'https'
runs:
using: docker
image: docker://ghcr.io/ox-eye/github-actions/oxeye-scan:v0.0.30
image: docker://ghcr.io/ox-eye/github-actions/oxeye-scan:scm-add_schema_var
args:
- ${{ inputs.token }}
- ${{ inputs.host }}
Expand All @@ -40,3 +44,4 @@ runs:
- ${{ inputs.release }}
- ${{ inputs.excludes }}
- ${{ inputs.partial }}
- ${{ inputs.scheme }}