Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix output #41

Merged
merged 1 commit into from
Mar 1, 2024
Merged
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
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
Loading