Skip to content

Commit

Permalink
fix(workflows): move polaris action in repo and fix for v4
Browse files Browse the repository at this point in the history
  • Loading branch information
js-timbirkett committed Aug 8, 2021
1 parent bb0b08d commit a1b9c39
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 2 deletions.
13 changes: 13 additions & 0 deletions .github/actions/setup-polaris/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM alpine:3.14

RUN apk add --no-cache \
bash \
ca-certificates \
curl \
wget \
tar \
jq

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
22 changes: 22 additions & 0 deletions .github/actions/setup-polaris/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Install polaris'
description: 'Download a specific polaris version'

inputs:
version:
description: 'version of polaris'
required: true
default: 'latest'

runs:
using: 'docker'
image: './Dockerfile'
args:
- ${{ inputs.version }}

outputs:
version:
description: 'Version of polaris installed'

branding:
icon: 'download-cloud'
color: 'gray-dark'
19 changes: 19 additions & 0 deletions .github/actions/setup-polaris/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
if [[ -z "$INPUT_VERSION" ]]; then
echo "Missing polaris version information"
exit 1
fi
polaris version | grep "$INPUT_VERSION" &> /dev/null
if [ $? == 0 ]; then
echo "Polaris $INPUT_VERSION is already installed! Exiting gracefully."
exit 0
else
echo "Installing polaris to path."
fi
TARGET_FILE="polaris.tar.gz"
curl -LJ -vvv -o $TARGET_FILE 'https://github.com/FairwindsOps/polaris/releases/download/'"$INPUT_VERSION"'/polaris_linux_amd64.tar.gz'
mkdir polaris
tar -xzf $TARGET_FILE -C polaris
rm $TARGET_FILE
echo "polaris" >> $GITHUB_PATH
echo "::set-output name=version::$INPUT_VERSION"
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
version: v3.4.0

- name: Install Polaris
uses: fairwindsops/polaris/.github/actions/setup-polaris@master
uses: .github/actions/setup-polaris
with:
version: 3.2.1
version: 4.0.7

- name: Polaris Audit
run: |
Expand Down

0 comments on commit a1b9c39

Please sign in to comment.