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

Allow configuration of artifacts retention time #1152

Closed millotp closed 6 days ago

millotp commented 1 week ago

Contributing guidelines

I've found a bug, and:

Description

Hello,

With the new feature in 6.0.0 to upload build artifacts, the retention time is set to 90 days (source) and is not configurable, which gives warning when the repository already has a default retention.

I like the new feature and would like to keep it, would it be possible to make this configurable, or use the repo default value directly ?

Expected behaviour

No warnings displayed

Actual behaviour

Screenshot 2024-06-24 at 08 46 02

Repository URL

No response

Workflow run URL

No response

YAML workflow

uses: docker/build-push-action@v6.1.0
with:
  file: build/docker/Dockerfile
  context: .
  push: false

Workflow logs

No response

BuildKit logs

No response

Additional info

No response

crazy-max commented 1 week ago

Actual behaviour

Screenshot 2024-06-24 at 08 46 02

Yes we should keep default retention days set in repository settings. I think I will just remove the override here and allow customization with a new env var. Pretty much like https://github.com/actions/upload-artifact/ does.

crazy-max commented 1 week ago

@millotp Should be fixed with https://github.com/docker/build-push-action/pull/1153

You can try with:

Default from repo settings:

uses: crazy-max/docker-build-push-action@export-retention
with:
  file: build/docker/Dockerfile
  context: .
  push: false

Or custom value:

uses: crazy-max/docker-build-push-action@export-retention
with:
  file: build/docker/Dockerfile
  context: .
  push: false
env:
  DOCKER_BUILD_EXPORT_RETENTION_DAYS: 2
millotp commented 5 days ago

Thanks for the speedy fix !