I have this job, and it builds the docker container and pushes correctly
jobs:
build-postgres:
runs-on: ubuntu-latest
timeout-minutes: 2
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v1
- uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- uses: ./.github/actions/git-short-ref
id: ref
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- uses: aws-actions/amazon-ecr-login@v1
id: login-ecr
- run: echo -n ::set-output name=tag::"${{ steps.login-ecr.outputs.registry }}/cloud-stack/postgres:${{ steps.ref.outputs.ref }}"
id: tag
- uses: docker/build-push-action@v2
id: build
with:
context: postgres
file: postgres/Dockerfile
load: true
tags: ${{ steps.tag.outputs.tag }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- run: docker push ${{ steps.tag.outputs.tag }}
but in this job where I go to rely on the needs
output of the previous job it doesn’t work, it’s just empty.
test-migrations:
needs: [build-postgres, build-migrations]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v1
- uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- uses: aws-actions/amazon-ecr-login@v1
id: login-ecr
- run: docker network create skynet
- run: |
set -e
export ID=$(docker run \
--publish 5432:5432 \
--network skynet \
--network-alias db.host \
--env-file .github/env/postgres \
--detach ${{ needs.build-postgres.outputs.tag }} )
echo -n "::set-output name=container-id::$ID"
shell: bash
id: pg-run
I don’t see a problem with my code, but there must be, what am I don’t wrong?