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

artifactCleanup - protect artifacts from being deleted matching a regular expression #399

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

martinm82
Copy link

@martinm82 martinm82 commented Oct 6, 2021

This PR is another attempt to contribute this feature and supersedes PR #204.

The main purpose is to protect artifacts from being deleted that match a certain regular expression (keepArtifactsRegex)

Credits go mainly to @wotd, @NorbertGebicki-TomTom

This feature could as well be used to avoid the deletion of metadata files (eg. .timestamp or index.json for Conan artifacts #319)

commit 97ff199
Merge: 56c8308 28a9252
Author: Martin Migasiewicz <616250+martinm82@users.noreply.github.com>
Date:   Fri Oct 1 11:56:36 2021 +0200

    Merge pull request #15 from tt-gf/bugfix/undefined-var

    fix: several fixes around the keepArtifactsRegex feature

commit 28a9252
Author: Martin Migasiewicz <616250+martinm82@users.noreply.github.com>
Date:   Fri Oct 1 11:35:04 2021 +0200

    fix: compile string as Pattern since casting a string stored in json to Pattern is not possible.

    rename job to include the plugin name for easier searching in logs
    avoid using null for repos in case it is not set as otherwise all repositories will be cleaned up
    align default regular expressions, document how to pass an url-encoded regex and add fix for reading the regex in the cleanup execution
    add example explaining a bit the regular expression

commit 56c8308
Merge: 02465a4 012edea
Author: Martin Migasiewicz <616250+martinm82@users.noreply.github.com>
Date:   Wed Jul 21 14:45:29 2021 +0200

    Merge pull request #14 from tt-gf/bugfix/add-missing-docs

    chore(artifactCleanup): document new keep artifacts feature.

commit 012edea
Author: Martin Migasiewicz <martin.migasiewicz@tomtom.com>
Date:   Wed Jul 21 13:10:20 2021 +0200

    chore(artifactCleanup): document new keep artifacts feature.

commit 02465a4
Merge: e96ed42 2d2f2a7
Author: Martin Migasiewicz <616250+martinm82@users.noreply.github.com>
Date:   Wed Jul 21 12:37:39 2021 +0200

    Merge pull request #13 from tt-gf/new-master

    Sync with upstream repository

commit 2d2f2a7
Merge: 31d2423 c633061
Author: Martin Migasiewicz <616250+martinm82@users.noreply.github.com>
Date:   Wed Jul 21 12:07:50 2021 +0200

    Merge pull request #12 from tt-gf/feature/merge-upstream

    Pre-merge of modifications in artifactCleanup and cleanDockerImages user plugins to see whether conflicts were merged wrongly with upstream

commit c633061
Merge: e96ed42 31d2423
Author: Martin Migasiewicz <martin.migasiewicz@tomtom.com>
Date:   Tue Jul 20 15:30:57 2021 +0200

    Merge remote-tracking branch 'upstream/master' into feature/merge-upstream

    # Conflicts:
    #	cleanup/artifactCleanup/artifactCleanup.groovy
    #	cleanup/cleanDockerImages/README.md
    #	cleanup/cleanDockerImages/cleanDockerImages.groovy
    #	cleanup/cleanDockerImages/cleanDockerImages.properties
    #	webhook/README.md
    #	webhook/webhook.groovy

commit e96ed42
Merge: 135df82 e60b0be
Author: Maikel van den Hurk <maikelvandenhurk@hotmail.com>
Date:   Wed Jan 20 09:31:32 2021 +0100

    Merge pull request #10 from NorbertGebicki-TomTom/NAV-32635_fix_for_docker_cleanup

    Nav 32635 fix for docker cleanup

commit e60b0be
Author: Norbert Gebicki <Norbert.Gebicki@tomtom.com>
Date:   Mon Jan 18 11:12:54 2021 +0100

    update for README file

commit 453da5f
Author: Norbert Gebicki <Norbert.Gebicki@tomtom.com>
Date:   Thu Jan 14 13:57:41 2021 +0100

    fixed PR issues

commit bdec65e
Author: Norbert Gebicki <Norbert.Gebicki@tomtom.com>
Date:   Wed Jan 13 10:55:35 2021 +0100

    added new functionality to cleanDockerImages

commit 0afd960
Author: Norbert Gebicki <Norbert.Gebicki@tomtom.com>
Date:   Tue Dec 15 15:11:44 2020 +0100

    added cleanDockerImages plugin

commit 719ef2c
Author: Norbert Gebicki <Norbert.Gebicki@tomtom.com>
Date:   Thu Nov 12 14:26:11 2020 +0100

    fixed artifactory plugin for 7.x version

commit 135df82
Merge: c303f3b 7adb7f0
Author: Maikel van den Hurk <maikelvandenhurk@hotmail.com>
Date:   Mon Sep 14 16:54:17 2020 +0200

    Merge pull request #6 from NorbertGebicki-TomTom/patch-2

    Update artifactCleanup.groovy

commit 7adb7f0
Author: Norbert Gebicki <Norbert.Gebicki@tomtom.com>
Date:   Mon Sep 14 16:43:45 2020 +0200

    fixed counting of artifacts

commit 26b172d
Author: NorbertGebicki-TomTom <63267285+NorbertGebicki-TomTom@users.noreply.github.com>
Date:   Tue Sep 8 15:45:13 2020 +0200

    Update artifactCleanup.groovy

commit b5d3b40
Author: NorbertGebicki-TomTom <63267285+NorbertGebicki-TomTom@users.noreply.github.com>
Date:   Tue Sep 8 15:25:09 2020 +0200

    Update artifactCleanup.groovy

    fixed duplicated count

commit c303f3b
Merge: 5cc0c52 bd78d74
Author: Maikel van den Hurk <maikelvandenhurk@hotmail.com>
Date:   Mon Sep 7 21:14:49 2020 +0200

    Merge pull request #7 from tt-gf/webhook-copy

    feat: Add webhook plugin

commit bd78d74
Author: Maikel van den Hurk <maikelvandenhurk@hotmail.com>
Date:   Mon Sep 7 12:53:57 2020 +0200

    feat: Add webhook plugin
    This plugin is coming directly from https://github.com/jfrog/artifactory-user-plugins

commit 72fb322
Author: NorbertGebicki-TomTom <63267285+NorbertGebicki-TomTom@users.noreply.github.com>
Date:   Wed Aug 19 13:56:00 2020 +0200

    Update artifactCleanup.groovy

commit 5cc0c52
Merge: bae045c 195d694
Author: wotd <ngebicki@gmail.com>
Date:   Fri Jun 1 14:05:31 2018 +0200

    Merge pull request #5 from tt-gf/fix_for_correct_artifacts_list

    fix for removing images only from specific registry

commit 195d694
Author: Norbert Gebicki <norbert.gebicki@tomtom.com>
Date:   Wed May 30 14:42:11 2018 +0200

    fix for removing images only from specific registry

commit bae045c
Merge: 3b4a1b5 45b89c2
Author: wotd <ngebicki@gmail.com>
Date:   Tue May 29 14:42:24 2018 +0200

    Merge pull request #4 from tt-gf/feature/NAVCD-399-Retention-policy-for-docker-images-script

    Feature/retention policy for docker images script

commit 45b89c2
Author: Norbert Gebicki <norbert.gebicki@tomtom.com>
Date:   Tue May 29 13:22:11 2018 +0200

    added properties file for retention policy for docker

commit b6b6590
Author: Norbert Gebicki <norbert.gebicki@tomtom.com>
Date:   Fri May 11 14:34:09 2018 +0200

    plugin for depricating artifacts introduced

commit 3b4a1b5
Merge: e632b56 4726381
Author: wotd <ngebicki@gmail.com>
Date:   Tue Apr 10 13:45:11 2018 +0200

    Merge pull request #2 from tt-gf/refactoring_and_fixing_code_issues

    fixed Martins comments and small code refactoring

commit 4726381
Author: Norbert Gebicki <norbert.gebicki@tomtom.com>
Date:   Tue Apr 10 12:44:06 2018 +0200

    changed variables names: keepRelease, releaseRegex to keepArtifacts and keepArtifactsRegex

commit bcba633
Author: Norbert Gebicki <norbert.gebicki@tomtom.com>
Date:   Tue Apr 10 11:39:33 2018 +0200

    removed commented command

commit 89aaaad
Author: Norbert Gebicki <norbert.gebicki@tomtom.com>
Date:   Mon Apr 9 16:02:38 2018 +0200

    fixed Martins comments and small code refactoring

commit e632b56
Merge: c193576 f5b225d
Author: wotd <ngebicki@gmail.com>
Date:   Fri Apr 6 15:18:43 2018 +0200

    Merge pull request #1 from tt-gf/feature/cleanup_plugin_fix_for_retention

    added possibility to delete artifact with specified name pattern

commit f5b225d
Author: Norbert Gebicki <norbert.gebicki@tomtom.com>
Date:   Fri Apr 6 14:28:43 2018 +0200

    added possibility to delete artifact with specified name pattern
@martinm82
Copy link
Author

Unfortunately this feature has no unit tests since there are no guidelines on how to setup easily an dev environment (the user-plugins-dev-env repo is outdated)

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

Successfully merging this pull request may close these issues.

None yet

1 participant