You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Copy the .deb and .rpm file to specific repository
2
2
3
-
This worker will copy .deb and .rpm files from given repository set to specified repository.
3
+
This worker script is designed to handle package copy operations between repositories in a JFrog Artifactory environment. It monitors specified repositories for newly created `.deb` and `.rpm` files, parses the file paths using a predefined layout, and copies the files to designated target repositories.
4
4
5
-
NOTE: Don't forget to add source repositories in the worker's filters.
5
+
## Features
6
6
7
-
Also you should add following exclude patterns: repodata/**_tmp_/** and dists/**.
7
+
-**Automatic Copying**: Detects newly created `.deb` and `.rpm` files in specified repositories and copies them to their respective destination repositories.
8
+
-**Debian Metadata Update**: Updates Debian package properties before copying to ensure compliance with repository configurations.
9
+
-**Retry Mechanism**: Implements a retry mechanism for handling transient errors during HTTP requests.
10
+
-**Logging**: Provides informative logs for monitoring operations, including successes and failures.
8
11
12
+
## Workflow
13
+
14
+
1.**Supported Repositories**:
15
+
- Source repositories for `.deb` files: `["debian"]`
16
+
- Source repositories for `.rpm` files: `["rpm"]`
17
+
- Destination for `.deb` files: `["debian-dest"]`
18
+
- Destination for `.rpm` files: `["rpm-dest"]`
19
+
20
+
2.**Debian Metadata Update**:
21
+
For `.deb` files, the script updates properties such as:
This worker code is used to clean Docker repositories based on configured cleanup policies.
3
+
This worker script is designed to clean Docker repositories hosted in Artifactory based on configurable cleanup policies. It is useful for managing storage and maintaining repository hygiene.
5
4
6
-
Configuration
7
-
-------------
5
+
---
8
6
9
-
-`dockerRepos`: A list of Docker repositories to clean. If a repo is not in
10
-
this list, it will not be cleaned.
11
-
-`byDownloadDate`: An optional boolean flag (true/false).
12
-
***false** (default): retention will take into account only **creation** date of the image
13
-
(technically, its manifest file). This is the original behaviour.
14
-
***true**: identify images to remove by their **last download date** or failing that,
15
-
last **update** date. This mode of operation has been inspired by the 'artifactCleanup'
16
-
plugin.
7
+
## Key Features
17
8
18
-
For example:
9
+
- Cleans Docker repositories based on:
10
+
- Maximum age of images
11
+
- Maximum number of image versions
12
+
- Supports cleanup based on:
13
+
- Image creation date
14
+
- Last download date
15
+
- Provides optional dry-run mode for safe execution.
16
+
- Handles complex repositories with multiple Docker files.
17
+
- Logs processed repositories and cleanup details for transparency.
18
+
19
+
20
+
## Configuration
21
+
---
22
+
The worker accepts the following configuration parameters:
23
+
24
+
### Required Parameters
25
+
26
+
***`dockerRepos`**: A list of Docker repositories to clean. Only repositories listed here will be processed.
Cleanup policies are specified as labels on the Docker image. Currently, this
31
-
plugin supports the following policies:
57
+
### Cleanup Policies
58
+
59
+
Cleanup policies are defined using labels in the Docker image. The worker supports the following policies:
32
60
33
-
-`maxDays`: The maximum number of days a Docker image can exist in an
34
-
Artifactory repository. Any images older than this will be deleted.
35
-
* when `byDownloadDate=true`: images downloaded or updated within last `maxDays` will
36
-
be preserved
37
-
-`maxCount`: The maximum number of versions of a particular image which should
38
-
exist. For example, if there are 10 versions of a Docker image and `maxCount`
39
-
is set to 6, the oldest 4 versions of the image will be deleted.
40
-
* when `byDownloadDate=true`: image age will be determined by first checking
41
-
the _Last Downloaded Date_ and _Modification Date_ will be checked only when this image has never
42
-
been downloaded.
61
+
***`maxDays`**: Specifies the maximum number of days an image can exist in the repository. Older images will be deleted.
62
+
63
+
* When `byDownloadDate=true`: Images downloaded or updated within the last `maxDays` will be preserved.
64
+
65
+
***`maxCount`**: Specifies the maximum number of image versions to retain. Excess versions will be deleted, starting with the oldest.
66
+
67
+
* When `byDownloadDate=true`: Image age is determined first by the _Last Downloaded Date_ and then by the _Modification Date_ if the image has never been downloaded.
68
+
43
69
44
-
To set these labels for an image, add them to the Dockerfile before building:
70
+
### Adding Cleanup Labels to Docker Images
45
71
46
-
```dockerfile
72
+
Labels can be added to the Dockerfile before building the image. For example:
When a Docker image is deployed, Artifactory will automatically create
52
-
properties reflecting each of its labels. These properties are read by the
53
-
worker in order to decide on the cleanup policy for the image.
79
+
When deployed, these labels are automatically converted into properties in Artifactory. The worker reads these properties to determine the cleanup policy for each image.
80
+
81
+
Execution
82
+
---------
83
+
84
+
### JFrog CLI
54
85
55
86
Cleanup can be triggered using the JFrog CLI. For example:
0 commit comments