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 4659df1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 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
8 changes: 4 additions & 4 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,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 }}
10 changes: 5 additions & 5 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 All @@ -28,15 +28,15 @@ case "$connection_format" in
docker buildx create --name=copa-action
docker buildx use --default copa-action
connection="--addr buildx://copa-action"
;;
;;
# through a running buildkit container over tcp
"buildkit-container")
connection="--addr tcp://127.0.0.1:8888"
;;
;;
# through the default docker buildkit endpoint enabled with a custom socket
"custom-socket")
connection=""
;;
;;
esac

# run copa to patch image
Expand Down

0 comments on commit 4659df1

Please sign in to comment.