Skip to content

Test before push using remote composite actions does not push loaded image #1407

Description

@jslusher

I have two separate composite actions available in my Github org remotely.

Build composite action relevant code:

    - name: Log in to Docker Hub
      uses: docker/login-action@v3
      with:
        username: ${{ inputs.dockerhub-username }}
        password: ${{ inputs.dockerhub-password }}

    - name: Set Image Tag
      id: docker-meta
      uses: docker/metadata-action@v5
      with:
        images: myorg/${{ inputs.docker-image }}
        tags: |
          type=raw,value={{date 'YYYYMMDDHHmmss'}}-{{sha}},enable=${{ github.event_name == 'push' }}
          type=raw,value=PR-${{github.event.number}}-${{github.event.pull_request.head.sha}},enable=${{ github.event_name == 'pull_request' }}

    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v3

    - name: Docker Build and Export
      uses: docker/build-push-action@v6
      with:
        context: ${{ inputs.docker-context }}
        file: ${{ inputs.docker-file }}
        load: true
        push: false
        secret-envs: pip-index-url=PIP_INDEX_URL
        tags: ${{ steps.docker-meta.outputs.tags }}

Deploy composite action relevant code

    - name: Log in to Docker Hub
      uses: docker/login-action@v3
      with:
        username: ${{ inputs.dockerhub-username }}
        password: ${{ inputs.dockerhub-password }}

    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v3

    - name: Build and push
      uses: docker/build-push-action@v6
      with:
        context: ${{ inputs.docker-context }}
        file: ${{ inputs.docker-file }}
        push: true
        tags: ${{ inputs.docker-image }}

Calling GHA workflow using composite actions

      - name: Docker Build
        id: docker-build
        uses: myorg/workflows/docker-build@build-and-deploy-composites
        with:
          docker-image: myimage
          dockerhub-username: ${{ vars.DOCKER_HUB_USERNAME }}
          dockerhub-password: ${{ secrets.DOCKER_HUB_PASSWORD }}

      - name: TEST Docker Image Tag
        run: echo "Docker image tag is ${{ steps.docker-build.outputs.tags }}"

      - name: Docker Push
        uses: myorg/workflows/docker-push-and-cd-deploy@build-and-deploy-composites
        with:
          docker-image: ${{ steps.docker-build.outputs.tags }}
          dockerhub-username: ${{ vars.DOCKER_HUB_USERNAME }}
          dockerhub-password: ${{ secrets.DOCKER_HUB_PASSWORD }}

When I test this configuration, the Docker Push step does not use the image loaded in the Docker Build step. Is this to be expected? Is there any way to get it to use the loaded image or is this a limitation of composite actions?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions