docker / build-push-action

GitHub Action to build and push Docker images with Buildx
https://github.com/marketplace/actions/build-and-push-docker-images
Apache License 2.0
4.1k stars 525 forks source link

ulimit Option Error when Set to Default [] #1164

Closed vikranth-t closed 2 days ago

vikranth-t commented 4 days ago

Description

I'm encountering an issue with the docker/build-push-action GitHub Action when using the ulimit option. If the ulimit option is set to its default value [], the action fails with an error. This behavior is problematic when using this action in a reusable workflow template that must accommodate different requirements across various use cases.

Steps to Reproduce:

Expected Behavior: The workflow should successfully build and push the Docker image without errors when the ulimit option is set to its default value [].

Actual Behavior: The workflow fails with an error related to the ulimit option when it is set to [].

Example Workflow:

name: Build and Push Docker Image

on:
  workflow_call:
    inputs:
      ulimit:
        required: false
        type: string
        default: "[]"

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

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

      - name: Login to DockerHub
        uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      - name: Build and Push
        uses: docker/build-push-action@v6
        with:
          context: .
          push: true
          tags: user/repo:latest
          ulimit: ${{ inputs.ulimit }}  # This causes the error
Logs:
Error: invalid argument "[]" for "--ulimit" flag: invalid ulimit argument: []

Additional Information:

This issue impacts the flexibility of reusable workflow templates that need to handle different ulimit configurations dynamically.

It would be helpful if the action could allow the ulimit option to be safely left blank or set to [] without causing errors.

crazy-max commented 4 days ago

Define the ulimit option as default (ulimit: []).

[] is not a valid value. If you want to use default ulimit you should just set an empty val.