Repository navigation
Closed
Description
Behaviour
From this README.md, steps.meta.outputs.tags is typed as a String.
However, when trying to use the Docker image built in a following step,
when a new image as been built,
steps.meta.outputs.tags value seems to be <image>:<tag>\n<image>:latest
This \n character causes calls to docker run ... ${{ steps.meta.outputs.tags }} to fail,
as the CI shell interprets the string following the newline as a command that does not exist.
Steps to reproduce this issue
- Clone https://github.com/voyages-sncf-technologies/vboard
- Create a new tag
- Observe the Actions pipeline result
Expected behaviour
I tried to use ${{ steps.meta.outputs.tags[0] }} instead,
but this gets inetrpreted as an empty string (on non-tag builds at least).
Actual behaviour
Neither ${{ steps.meta.outputs.tags }} nor ${{ steps.meta.outputs.tags[0] }}
can actually be used in a docker command following usage of docker/metadata-action@v3 & docker/build-push-action@v2
Configuration
- Repository URL (if public): https://github.com/voyages-sncf-technologies/vboard
- Build URL (if public): https://github.com/voyages-sncf-technologies/vboard/runs/3883855145?check_suite_focus=true
docker-build-push-ws:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/metadata-action@v3
id: meta
with:
images: vboard/vboard-ws
- uses: docker/login-action@v1
if: startsWith(github.ref, 'refs/tags/')
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/build-push-action@v2
with:
context: vboard-ws
push: ${{ startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Validating the image built can start without any error
run: docker run -e SPRING_PROFILES_ACTIVE=test -e EXIT_AFTER_INIT=true ${{ steps.meta.outputs.tags }}Logs
Metadata
Metadata
Assignees
Labels
No labels
Activity
crazy-max commentedon Oct 15, 2021
@Lucas-C
You can change the tags separator with the
sep-tagsinput.I would suggest to use the
versionoutput instead:See https://github.com/crazy-max/docker-fail2ban/blob/master/.github/workflows/build.yml
Lucas-C commentedon Oct 15, 2021
Thank you for your answer @crazy-max !
I think this will perfectly solve my issue.
I cannot create a new tag right now, but I'm confident it should do the trick.
ivoba commentedon Nov 23, 2021
@Lucas-C did you solve this?
I have the same problem and
steps.meta.outputs.versionseems not to be the solution here.Ok nevermind, i just returned to
tags: ${{ steps.meta.outputs.tags }}and it works now.Must been something else.