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

consider changing the Docker image to capture stdout #267

Open
fdiblen opened this issue Jan 26, 2022 · 1 comment
Open

consider changing the Docker image to capture stdout #267

fdiblen opened this issue Jan 26, 2022 · 1 comment

Comments

@fdiblen
Copy link
Member

fdiblen commented Jan 26, 2022

Currently it is not possible to use the stdout of Docker image in a GitHub action. This would be useful if one wants to do some tests based on stdout but not only exit codes.

I was able to do that by making the changes below.

1- add `docker-entrypoint.sh`` to set action output variable

#!/bin/sh
set -e

echo "arguments: $@"
step_stdout=$(exec cffconvert "$@")
echo $step_stdout
echo "::set-output name=step_stdout::$step_stdout"

2- modify the Dockerfile to use entrypoint shell script

FROM python:3.9-alpine
RUN apk --no-cache add build-base
RUN python3 -m pip install cffconvert==2.0.0
WORKDIR /app
COPY ./docker-entrypoint.sh /app/
ENTRYPOINT ["/app/docker-entrypoint.sh"]

The changes I made in the GitHub action can be seen here:
https://github.com/citation-file-format/cffconvert-github-action/compare/livetest-stdout

You can see an job with stdout here:
https://github.com/citation-file-format/cffconvert-github-action/runs/4922731817?check_suite_focus=true

@jspaaks
Copy link
Member

jspaaks commented Feb 4, 2022

My preference would be to first investigate if we can make these changes in the github action, as opposed to changing what's in the docker image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants