Skip to content

Commit

Permalink
fix: fix output
Browse files Browse the repository at this point in the history
Signed-off-by: Sertac Ozercan <[email protected]>
  • Loading branch information
sozercan committed Mar 1, 2024
1 parent eeead82 commit c2a5f00
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG copa_version

# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh
COPY entrypoint.sh /entrypoint.sh

# Install required packages
RUN apt-get update && \
Expand Down
10 changes: 6 additions & 4 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ runs:
id: copa-action
shell: bash
run : |
set -x
# check for copa version input, else use latest
if [ -z "${{ inputs.copa-version }}" ]; then
latest_tag=$(curl --retry 5 -s "https://api.github.com/repos/project-copacetic/copacetic/releases/latest" | jq -r '.tag_name')
Expand All @@ -51,13 +53,13 @@ runs:
connection="buildx"
# check for other methods of connection
if [ -n "{{ inputs.custom-socket }}"]; then
if [ ! -z "${{ inputs.custom-socket }}" ]; then
socket="${{ inputs.custom-socket }}"
connection="custom-socket"
elif [ -n "${{ inputs.buildkit-version }}" ]; then
elif [ ! -z "${{ inputs.buildkit-version }}" ]; then
docker run --net=host --detach --rm --privileged -p 127.0.0.1:8888:8888 --name buildkitd --entrypoint buildkitd moby/buildkit:${{ inputs.buildkit-version }} --addr tcp://0.0.0.0:8888
connection="buildkit-container"
fi
# run copa-action based on inputs
docker run --net=host --mount=type=bind,source=$(pwd),target=/data --mount=type=bind,source="$socket",target="/var/run/docker.sock" --mount=type=bind,source=$GITHUB_OUTPUT,target=$GITHUB_OUTPUT -e GITHUB_OUTPUT --name=copa-action "ghcr.io/project-copacetic/copa-action:v$version" ${{ inputs.image }} ${{ inputs.image-report }} ${{ inputs.patched-tag }} ${{ inputs.timeout }} "$connection" ${{ inputs.format }} {{ inputs.output }}
docker run --net=host --mount=type=bind,source=$(pwd),target=/data --mount=type=bind,source="$socket",target="/var/run/docker.sock" --mount=type=bind,source=$GITHUB_OUTPUT,target=$GITHUB_OUTPUT -e GITHUB_OUTPUT --name=copa-action "ghcr.io/project-copacetic/copa-action:v$version" ${{ inputs.image }} ${{ inputs.image-report }} ${{ inputs.patched-tag }} ${{ inputs.timeout }} ${connection} ${{ inputs.format }} ${{ inputs.output }}
6 changes: 3 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh

set -ex;

Expand All @@ -8,7 +8,7 @@ patched_tag=$3
timeout=$4
connection_format=$5
format=$6
output_file=$7
output_file=$7

# parse image into image name
image_no_tag=$(echo "$image" | cut -d':' -f1)
Expand Down Expand Up @@ -47,4 +47,4 @@ then
else
echo "Error patching image $image with copa"
exit 1
fi
fi

0 comments on commit c2a5f00

Please sign in to comment.