Skip to content

destroy not deleting files on artifactory cloud #152

@GitarPlayer

Description

@GitarPlayer

here is my config file:

# artifactory-cleanup.yaml
artifactory-cleanup:
  server: https://artifactory.mycompany.cloud:443/artifactory
  # $VAR is auto populated from environment variables
  user: myartuser
  password: myartpass

  policies:
    - name: Keep only the 5 latest Files in a folder
      rules:
        - rule: Repo
          name: "my-docker-repo"
        # Keep these tags for all images
        - rule: ExcludeDockerImages
          masks:
            - "*:latest"
        # Keep 5 docker tags for all images
        - rule: KeepLatestNFilesInFolder
          count: 5

here is the output with no --destroy:
podman run --rm -v "$(pwd)":/app devopshq/artifactory-cleanup:1.0.12 artifactory-cleanup

DEBUG - we would delete 'my-docker-repo/foo/395416' (f4f50deea25de1d51e80b9aee79d80165ac96cc1) - 159M
Deleted artifacts count: 185
Summary size: 31454366659

+------------------------------------------+-------------+------+
| Cleanup Policy                           | Files count | Size |
+------------------------------------------+-------------+------+
| Keep only the 5 latest Files in a folder |     185     | 29G  |
|                                          |             |      |
| Total size: 29G                          |             |      |
+------------------------------------------+-------------+------+

the same with the --destroy flag:
podman run --rm -v "$(pwd)":/app devopshq/artifactory-cleanup:1.0.12 artifactory-cleanup --destroy

DESTROY MODE - delete 'my-docker-repo/foo/395416' (f4f50deea25de1d51e80b9aee79d80165ac96cc1) - 159M
Deleted artifacts count: 186
Summary size: 31639913831

+------------------------------------------+-------------+------+
| Cleanup Policy                           | Files count | Size |
+------------------------------------------+-------------+------+
| Keep only the 5 latest Files in a folder |     186     | 29G  |
|                                          |             |      |
| Total size: 29G                          |             |      |
+------------------------------------------+-------------+------+

and running without the --destroy flag shows the same images again to be deleted and of course in artifactory cloud nothing is deleted:
podman run --rm -v "$(pwd)":/app devopshq/artifactory-cleanup:1.0.12 artifactory-cleanup

DEBUG - we would delete 'my-docker-repo/foo/395416' (f4f50deea25de1d51e80b9aee79d80165ac96cc1) - 159M(f4f50deea25de1d51e80b9aee79d80165ac96cc1) - 159M
Deleted artifacts count: 186
Summary size: 31639913831

+------------------------------------------+-------------+------+
| Cleanup Policy                           | Files count | Size |
+------------------------------------------+-------------+------+
| Keep only the 5 latest Files in a folder |     186     | 29G  |
|                                          |             |      |
| Total size: 29G                          |             |      |
+------------------------------------------+-------------+------+

Interesting is also I use the exact same version to cleanup my onprem artifactory repo. And there it works like a charm. So, I guess it's related to artifactory cloud.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions