Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArtifactCleanupPlugin: cron not triggered with multiple policies #344

Closed
brikendr opened this issue Dec 3, 2020 · 8 comments
Closed

ArtifactCleanupPlugin: cron not triggered with multiple policies #344

brikendr opened this issue Dec 3, 2020 · 8 comments

Comments

@brikendr
Copy link

brikendr commented Dec 3, 2020

Hi,

I am using the artifact cleanup user plugin on our artifactory instance to artifacts from various repositories (generic, conan, python etc). I had to create two different policies where the first one is to delete artifacts older than one month and the second one is to delete artifacts older than a week. Here is an example of my json file:

{
  "policies": [
    {
      "cron": "0 1 0 * * ?",
      "repos": [
        "repository_A",
        "repository_B"
      ],
      "timeUnit": "month",
      "timeInterval": 1,
      "dryRun": false,
      "paceTimeMS": 500,
      "disablePropertiesSupport": true
    },
    {
      "cron": "0 2 0 * * ?",
      "repos": [
        "repository_C"
      ],
      "timeUnit": "day",
      "timeInterval": 7,
      "dryRun": false,
      "paceTimeMS": 500,
      "disablePropertiesSupport": true
    }
  ]
}

As you can see i have configured in a way that the first cron is executed at 01:00 AM every night and the second one at 02:00AM respectively.

Here is a snippet of the artifactory log after the update was completed and plugins were reloaded:

artifactory_ssd2 | 2020-12-02 08:05:07,576 [pool-150-thread-1] [INFO ] (o.j.c.ConfigWrapperImpl:342) - [Node ID: 573d0b92cf0a]  detected local  modify for config 'artifactory/config/plugins/artifactCleanup.groovy'
artifactory_ssd2 | 2020-12-02 08:06:59,747 [http-nio-8081-exec-1547] [INFO ] (o.a.a.p.GroovyRunnerImpl:249) - Script 'artifactCleanup.groovy' has changed. Reloading all scripts
artifactory_ssd2 | 2020-12-02 08:06:59,830 [http-nio-8081-exec-1547] [INFO ] (o.a.a.p.GroovyRunnerImpl:301) - Loading script from 'artifactCleanup.groovy'.
artifactory_ssd2 | 2020-12-02 08:07:00,094 [http-nio-8081-exec-1547] [INFO ] (artifactCleanup     :-2) - Schedule job policy list: [[cron:0 1 0 * * ?, disablePropertiesSupport:true, dryRun:false, paceTimeMS:500, repos:[repository_A, repository_B], timeInterval:1, timeUnit:month], [cron:0 2 0 * * ?, disablePropertiesSupport:true, dryRun:false, paceTimeMS:500, repos:[repository_C], timeInterval:7, timeUnit:day]]
artifactory_ssd2 | 2020-12-02 08:07:00,109 [http-nio-8081-exec-1547] [INFO ] (o.a.a.p.GroovyRunnerImpl:345) - Script 'artifactCleanup' loaded.

After waiting a day, i see that the last written log from the artifactCleanup plugin is the one above. So there was basically no cron trigger scheduled at all.

Groovy script has been updated to latest master from 03.12.2020. Any help would be appreciated. Thanks

@cschyma
Copy link
Contributor

cschyma commented Feb 18, 2021

I confirm having the same problem with the latest Groovy script as of now and Artifactory 7.9.0.

@cschyma
Copy link
Contributor

cschyma commented Feb 19, 2021

Please vote for this bug to be fixed at https://www.jfrog.com/jira/browse/RTFACT-24307 as JFrog is prioritizing by community feedback. Right now there isn't even a ETA set for solving this bug.

@vesubramanian
Copy link

Where is this policy defined? It's not mentioned anywhere in the documentation? How can we set this plugin to run automatically based on a schedule?

@martinm82
Copy link

@brikendr are you using an HA cluster? I had a similar problem and after enabling full logging (debug) on Artifactory I realised that I forgot to set the primary flag to true in system.yaml.

@brikendr
Copy link
Author

@martinm82 no we are not using HA cluster at the moment.

@cschyma
Copy link
Contributor

cschyma commented Oct 11, 2021

Is this supposed to be fixed by now? https://www.jfrog.com/jira/browse/RTFACT-24307 was set to resolved but I don't see any new changes after 3rd of Dec 2020 at https://github.com/jfrog/artifactory-user-plugins/commits/master/cleanup/artifactCleanup.

@quinh
Copy link

quinh commented Sep 5, 2024

I've the same issue, but my config only has one policy and not even with one it's being triggered.

@harendrar8095
Copy link
Collaborator

Thanks for bringing this up!

If you’re encountering issues with the cleanup plugin, we recommend moving to our new product feature designed to handle cleanup tasks more effectively. This feature has reached General Availability (GA) and offers enhanced capabilities for maintaining and managing artifacts.

You can find more information and guidance on using this new feature in our GA documentation.

We’re closing this ticket since it’s an older one, but please feel free to reopen it if you have further questions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants