@o3r/artifactory-tools 11.0.0-next.0 → 11.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -91
- package/package.json +29 -26
- package/src/cli/artifact-cleaner.js +14 -14
- package/src/cli/artifact-cleaner.js.map +1 -1
- package/src/cli/pr-artifact-cleaner.js +21 -55
- package/src/cli/pr-artifact-cleaner.js.map +1 -1
- package/src/cli/artifact-retriever.d.ts +0 -3
- package/src/cli/artifact-retriever.d.ts.map +0 -1
- package/src/cli/artifact-retriever.js +0 -223
- package/src/cli/artifact-retriever.js.map +0 -1
- package/src/helpers/gavc-response/gavc-response.interfaces.d.ts +0 -47
- package/src/helpers/gavc-response/gavc-response.interfaces.d.ts.map +0 -1
- package/src/helpers/gavc-response/gavc-response.interfaces.js +0 -2
- package/src/helpers/gavc-response/gavc-response.interfaces.js.map +0 -1
- package/src/helpers/gavc-response/index.d.ts +0 -2
- package/src/helpers/gavc-response/index.d.ts.map +0 -1
- package/src/helpers/gavc-response/index.js +0 -2
- package/src/helpers/gavc-response/index.js.map +0 -1
- package/src/helpers/index.d.ts +0 -2
- package/src/helpers/index.d.ts.map +0 -1
- package/src/helpers/index.js +0 -2
- package/src/helpers/index.js.map +0 -1
- package/src/public_api.d.ts +0 -2
- package/src/public_api.d.ts.map +0 -1
- package/src/public_api.js +0 -2
- package/src/public_api.js.map +0 -1
package/README.md
CHANGED
|
@@ -5,120 +5,83 @@
|
|
|
5
5
|
|
|
6
6
|
## Description
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
[](https://www.npmjs.com/package/@o3r/artifactory-tools)
|
|
9
|
+
[](https://www.npmjs.com/package/@o3r/artifactory-tools)
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
This module provides various tools for the supported repository manager [JFrog](https://jfrog.com/artifactory/), including deleting old artifacts and deleting a specified amount of PR build artifacts.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
## Artifact cleaner (JFrog)
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Gets an artifact from Artifactory: artifact-group, artifact-name and artifact-version are mandatory
|
|
18
|
-
|
|
19
|
-
Options:
|
|
20
|
-
|
|
21
|
-
--registry <url> Registry URL. It is ignored for Azure Artifacts.
|
|
22
|
-
--repository-manager <manager> Artifact repository manager. Supported managers are JFrog, Azure Artifacts (default: JFrog)
|
|
23
|
-
--organization <organization> Azure Artifacts organization
|
|
24
|
-
--project <project> Azure Artifacts project
|
|
25
|
-
--feed <feed> Azure Artifacts feed
|
|
26
|
-
-a, --artifact-name <version> Artifact name
|
|
27
|
-
-v, --artifact-version <version> Artifact version
|
|
28
|
-
-g, --artifact-group <group> Artifact group name
|
|
29
|
-
-r, --artifact-repos <repositories> Artifact repositories (default: )
|
|
30
|
-
-u, --username <username> Artifactory username (default from ARTIFACTORY_USERNAME)
|
|
31
|
-
-p, --password <password> Artifactory user password (default from ARTIFACTORY_PASSWORD)
|
|
32
|
-
-o, --out <path> Output file name (default: ./built/${name}.jar)
|
|
33
|
-
--use-package-version Use the package version as artifact version
|
|
34
|
-
-h, --help output usage information
|
|
35
|
-
```
|
|
15
|
+
Cleans old artifacts from JFrog artifactory repositories. Based on the provided (or default) milliseconds value, this script will delete artifacts created before the specified date
|
|
16
|
+
and artifacts that have not been downloaded since the specified date. The search for the artifacts to delete is limited to the specified repositories.
|
|
36
17
|
|
|
37
|
-
|
|
18
|
+
Further information can be found in the JFrog documentation [here](https://jfrog.com/help/r/jfrog-rest-apis/artifacts-not-downloaded-since).
|
|
38
19
|
|
|
39
|
-
###
|
|
20
|
+
### Usage
|
|
40
21
|
|
|
41
22
|
```shell
|
|
42
|
-
artifact-
|
|
23
|
+
o3r-artifact-cleaner [options]
|
|
43
24
|
```
|
|
44
25
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
```
|
|
26
|
+
The required options include:
|
|
27
|
+
* the JFrog artifactory URL (`--artifactory-url`)
|
|
28
|
+
* the authentication (`--basicAuth <basicAuth>`)
|
|
29
|
+
* the artifact repositories to clean up (`--repositories <repositories>`)
|
|
50
30
|
|
|
51
|
-
|
|
31
|
+
### Options
|
|
52
32
|
|
|
53
|
-
|
|
54
|
-
|
|
33
|
+
| Option | Alias | Value Type | Default Value | Description |
|
|
34
|
+
|----------------------------------------------------------|:-----:|----------------------|---------------------------------|------------------------------------------------------------------------------------------------|
|
|
35
|
+
| `--artifactory-url <artifactoryUrl>` <br> **(Required)** | | `string` | | JFrog artifactory URL |
|
|
36
|
+
| `--basicAuth <basicAuth>` <br> **(Required)** | `-b` | `string` | | Base64 encoding of username:password (password already encrypted from artifactory UI) |
|
|
37
|
+
| `--repositories <repositories>` <br> **(Required)** | `-r` | `string` | | Artifact repositories to clean up (comma separated) <br> ex: `'repo1,repo2'` |
|
|
38
|
+
| `--dry-run <dryRun>` | | `boolean` | `false` | List all files that would be deleted without actually deleting them |
|
|
39
|
+
| `--duration-kept <durationKept>` | `-d` | `number` or `string` | `604800000` <br> (i.e., 7 days) | All artifacts older than this value (in ms) or not downloaded since this value will be deleted |
|
|
40
|
+
| `--type-filter <typeFilter>` | `-t` | `string` | `'tgz,json'` | List of artifact types that should be deleted (comma separated) <br> ex: `'jar,tgz'` |
|
|
41
|
+
| `--help` | `-h` | | | Output usage information |
|
|
55
42
|
|
|
56
|
-
###
|
|
43
|
+
### Example
|
|
57
44
|
|
|
58
45
|
```shell
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Execute dependency tests
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Options:
|
|
65
|
-
|
|
66
|
-
-u, --username <username> Git username
|
|
67
|
-
-p, --password <password> Git user password
|
|
68
|
-
-w, --workspace <path> Path to the folder containing the repository to clone
|
|
69
|
-
--workspace-project <path> Path to the project root folder inside the workspace
|
|
70
|
-
-b, --build <tasks> Tasks to run to build the dependency
|
|
71
|
-
-t, --test <tasks> Tasks to run to test the dependency
|
|
72
|
-
-P, --project <path> Project root path
|
|
73
|
-
--include <packages> Packages to include in the process
|
|
74
|
-
--exclude <packages> Packages to exclude from the process
|
|
75
|
-
--no-lerna Disable lerna file parsing
|
|
76
|
-
--no-trustedVersionNumber Determine if the version number is trusted (used for version number generated in Pull Request)
|
|
46
|
+
yarn o3r-artifact-cleaner --artifactory-url "https://jfrog.io/repoName" -b thisismybase64tokenwithuserandencryptedpassword
|
|
77
47
|
```
|
|
78
48
|
|
|
79
|
-
## Artifact cleaner
|
|
49
|
+
## PR Artifact cleaner (JFrog)
|
|
80
50
|
|
|
81
|
-
Cleans old artifacts from
|
|
51
|
+
Cleans old PR artifacts from JFrog by using the build version that is present in the path. If the build version is not present in the path, this tool cannot be used.
|
|
52
|
+
Based on the provided (or default) days value, this script will delete artifacts created before the specified date, within the provided repository matching the provided path.
|
|
53
|
+
|
|
54
|
+
Further information can be found in the JFrog documentation [here](https://jfrog.com/help/r/jfrog-rest-apis/artifactory-query-language-aql).
|
|
82
55
|
|
|
83
56
|
### Usage
|
|
84
57
|
|
|
85
58
|
```shell
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
Cleans old artifacts from artifactory repositories, base 64 encoding of username:password is mandatory
|
|
89
|
-
|
|
90
|
-
Options:
|
|
91
|
-
|
|
92
|
-
--artifactory-url <artifactoryUrl> Artifact URL (Required)
|
|
93
|
-
-a, --duration-kept <durationKept> All the artifact which have been created since more time than this value(ms) will be deleted (Default to 10080000ms (i.e. 7 days))
|
|
94
|
-
-r, --repositories <repositories> Artifact repositories to clean up (coma separated) ex : npm-otter-pr,npm-refx-pr (Default to npm-otter-pr)
|
|
95
|
-
-t, --type-filter <typeFilter> List of artifact type that should be deleted coma separated (ex: jar,tgz) (Default : tgz)
|
|
96
|
-
--dry-run <dryRun> List all files that should be deleted without actually deleting them. (Default to false)
|
|
97
|
-
-h, --help Output usage information
|
|
98
|
-
|
|
99
|
-
Example : yarn o3r-artifact-cleaner -b thisismybase64tokenwithuserandencryptedpassword
|
|
59
|
+
o3r-pr-artifact-cleaner [options]
|
|
100
60
|
```
|
|
101
61
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
62
|
+
The required options include:
|
|
63
|
+
* the JFrog artifactory URL (`--artifactory-url <artifactoryUrl>`)
|
|
64
|
+
* a method of authentication (`--api-key <apiKey>` or `--basicAuth <base64>`)
|
|
65
|
+
* the artifact repository to clean up (`--repository <repository>`)
|
|
66
|
+
* the artifact paths to clean up (`--path <path>`)
|
|
67
|
+
|
|
68
|
+
### Options
|
|
69
|
+
|
|
70
|
+
| Option | Alias | Value Type | Default Value | Description |
|
|
71
|
+
|----------------------------------------------------------|:-----:|------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
72
|
+
| `--artifactory-url <artifactoryUrl>` <br> **(Required)** | `-u` | `string` | | JFrog artifactory URL |
|
|
73
|
+
| `--path <path>` <br> **(Required)** | `-p` | `string` | | Artifact paths to clean up (using matcher from AQL language). Be careful not to include release artifacts in the path. <br> ex: `sample/path/*-PR-*` |
|
|
74
|
+
| `--repository <repository>` <br> **(Required)** | `-r` | `string` | | Artifact repository to clean up |
|
|
75
|
+
| `--api-key <apiKey>` | `-a` | `string` | | Artifactory API key of the user that can be used to log in |
|
|
76
|
+
| `--basicAuth <base64>` | `-b` | `string` | | Base64 encoding of username:password (password already encrypted from artifactory UI) |
|
|
77
|
+
| `--dry-run <dryRun>` | | `boolean` | `false` | List all files that would be deleted without actually deleting them |
|
|
78
|
+
| `--duration-kept <durationKept>` | `-d` | `number` | `1` | All artifacts older than this value (in days) will be deleted |
|
|
79
|
+
| `--pr-builds <prBuilds>` | `-n` | `number` | `1` | Number of PR build artifacts that will be kept |
|
|
80
|
+
| `--verbose` | `-v` | | | Display the executed AQL query |
|
|
81
|
+
| `--help` | `-h` | | | Output usage information |
|
|
82
|
+
|
|
83
|
+
### Example
|
|
107
84
|
|
|
108
85
|
```shell
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
Cleans old artifacts from artifactory repositories, base 64 encoding of username:password is mandatory
|
|
112
|
-
|
|
113
|
-
Options:
|
|
114
|
-
|
|
115
|
-
-u, --artifactory-url <artifactoryUrl> Artifact URL
|
|
116
|
-
-d, --duration-kept <durationKept> Only artifacts which are older than this value (in days) will be deleted. (Default to 1 day)
|
|
117
|
-
-r, --repository <repository> Artifact repository to clean up. (Default to dga-maven-built-adt-nce)
|
|
118
|
-
-pr, --pr-versions <prVersions> Number of pr versions that will be kept. (Default to 2 last versions)
|
|
119
|
-
--dry-run <dryRun> List all files that should be deleted without actually deleting them. (Default to false)
|
|
120
|
-
-p, --path <path> Artifact paths to cleanup use matcher from AQL language. Be careful that the path do not include release artifacts (Default to com/amadeus/retailing/*-PR-*)
|
|
121
|
-
-h, --help Output usage information
|
|
122
|
-
|
|
123
|
-
Example : yarn o3r-pr-artifact-cleaner -b thisismybase64tokenwithuserandencryptedpassword
|
|
86
|
+
yarn o3r-pr-artifact-cleaner --artifactory-url "https://jfrog.io/repoName" -b thisismybase64tokenwithuserandencryptedpassword
|
|
124
87
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/artifactory-tools",
|
|
3
|
-
"version": "11.0.0-next.
|
|
3
|
+
"version": "11.0.0-next.2",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
4
7
|
"description": "Various artifactory tools",
|
|
5
8
|
"keywords": [
|
|
6
9
|
"otter",
|
|
@@ -16,48 +19,48 @@
|
|
|
16
19
|
"build:builders": "tsc -b tsconfig.builders.json --pretty && yarn generate-cjs-manifest"
|
|
17
20
|
},
|
|
18
21
|
"bin": {
|
|
19
|
-
"o3r-artifact-cleaner": "src/cli/artifact-cleaner.js",
|
|
20
|
-
"o3r-artifact-
|
|
21
|
-
"o3r-pr-artifact-cleaner": "src/cli/pr-artifact-cleaner.js"
|
|
22
|
+
"o3r-artifact-cleaner": "./src/cli/artifact-cleaner.js",
|
|
23
|
+
"o3r-pr-artifact-cleaner": "./src/cli/pr-artifact-cleaner.js"
|
|
22
24
|
},
|
|
23
25
|
"dependencies": {
|
|
24
|
-
"commander": "^
|
|
26
|
+
"commander": "^12.0.0",
|
|
25
27
|
"fs-extra": "^11.0.0",
|
|
26
28
|
"request": "^2.88.0",
|
|
27
|
-
"
|
|
28
|
-
"tslib": "^2.5.3",
|
|
29
|
+
"tslib": "^2.6.2",
|
|
29
30
|
"winston": "^3.8.2"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@angular-devkit/core": "~17.0
|
|
33
|
-
"@angular-devkit/schematics": "~17.0
|
|
34
|
-
"@angular-eslint/eslint-plugin": "~17.
|
|
35
|
-
"@babel/core": "~7.
|
|
36
|
-
"@babel/preset-typescript": "~7.
|
|
33
|
+
"@angular-devkit/core": "~17.3.0",
|
|
34
|
+
"@angular-devkit/schematics": "~17.3.0",
|
|
35
|
+
"@angular-eslint/eslint-plugin": "~17.3.0",
|
|
36
|
+
"@babel/core": "~7.24.0",
|
|
37
|
+
"@babel/preset-typescript": "~7.24.0",
|
|
37
38
|
"@compodoc/compodoc": "^1.1.19",
|
|
38
|
-
"@nx/eslint-plugin": "~
|
|
39
|
-
"@nx/jest": "~
|
|
40
|
-
"@o3r/build-helpers": "^11.0.0-next.
|
|
41
|
-
"@o3r/eslint-plugin": "^11.0.0-next.
|
|
39
|
+
"@nx/eslint-plugin": "~18.3.0",
|
|
40
|
+
"@nx/jest": "~18.3.0",
|
|
41
|
+
"@o3r/build-helpers": "^11.0.0-next.2",
|
|
42
|
+
"@o3r/eslint-plugin": "^11.0.0-next.2",
|
|
43
|
+
"@stylistic/eslint-plugin-ts": "^1.5.4",
|
|
42
44
|
"@types/fs-extra": "^11.0.0",
|
|
43
45
|
"@types/jest": "~29.5.2",
|
|
44
46
|
"@types/node": "^20.0.0",
|
|
45
47
|
"@types/request": "^2.48.7",
|
|
46
48
|
"@types/request-promise-native": "^1.0.18",
|
|
47
|
-
"@typescript-eslint/eslint-plugin": "
|
|
48
|
-
"@typescript-eslint/parser": "^
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
|
50
|
+
"@typescript-eslint/parser": "^7.2.0",
|
|
49
51
|
"cpy-cli": "^5.0.0",
|
|
50
|
-
"eslint": "^8.
|
|
51
|
-
"eslint-import-resolver-node": "^0.3.
|
|
52
|
-
"eslint-plugin-jest": "~27.
|
|
53
|
-
"eslint-plugin-jsdoc": "~48.
|
|
52
|
+
"eslint": "^8.57.0",
|
|
53
|
+
"eslint-import-resolver-node": "^0.3.9",
|
|
54
|
+
"eslint-plugin-jest": "~27.9.0",
|
|
55
|
+
"eslint-plugin-jsdoc": "~48.2.1",
|
|
54
56
|
"eslint-plugin-prefer-arrow": "~1.2.3",
|
|
55
|
-
"eslint-plugin-unicorn": "^
|
|
57
|
+
"eslint-plugin-unicorn": "^51.0.1",
|
|
56
58
|
"jest": "~29.7.0",
|
|
57
59
|
"jest-junit": "~16.0.0",
|
|
58
|
-
"nx": "~
|
|
59
|
-
"ts-jest": "~29.1.
|
|
60
|
-
"
|
|
60
|
+
"nx": "~18.3.0",
|
|
61
|
+
"ts-jest": "~29.1.2",
|
|
62
|
+
"ts-node": "~10.9.2",
|
|
63
|
+
"typescript": "~5.4.2"
|
|
61
64
|
},
|
|
62
65
|
"engines": {
|
|
63
66
|
"node": ">=16.0.0"
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { program } from 'commander';
|
|
3
|
-
import * as request from 'request-promise-native';
|
|
4
3
|
import * as winston from 'winston';
|
|
5
4
|
program
|
|
6
5
|
.description('Clean old artifacts from artifactory repositories')
|
|
7
6
|
.requiredOption('--artifactory-url <artifactoryUrl>', 'Artifactory URL')
|
|
8
|
-
.
|
|
9
|
-
.
|
|
10
|
-
.option('-
|
|
11
|
-
.option('--
|
|
12
|
-
.option('-
|
|
7
|
+
.requiredOption('-b, --basicAuth <basicAuth>', 'Base64 encoding of username:password (password already encrypted from artifactory UI)')
|
|
8
|
+
.requiredOption('-r, --repositories <repositories>', 'Artifact repositories to clean up (comma separated) ex: \'repo1,repo2\'', (repos) => repos.split(','))
|
|
9
|
+
.option('-d, --duration-kept <durationKept>', 'All artifacts older than this value (in ms) will be deleted. (Default: 604800000 ms, i.e., 7 days)', (v) => +v, 604800000)
|
|
10
|
+
.option('-t, --type-filter <typeFilter>', 'List of artifact types that should be deleted (comma separated) ex: \'jar,tgz\' (Default: [\'tgz\',\'json\'])', (type) => type.split(','), ['tgz', 'json'])
|
|
11
|
+
.option('--dry-run <dryRun>', 'List all files that would be deleted without actually deleting them', false)
|
|
13
12
|
.parse(process.argv);
|
|
14
13
|
const opts = program.opts();
|
|
15
14
|
const logger = winston.createLogger({
|
|
@@ -31,10 +30,6 @@ const matchFilter = (fullUrl, types) => {
|
|
|
31
30
|
logger.info(`${fullUrl} dropped because it doesn't match any of the patterns`);
|
|
32
31
|
return false;
|
|
33
32
|
};
|
|
34
|
-
if (!opts.basicAuth) {
|
|
35
|
-
logger.error('Authentication is mandatory, please specify a base 64 encoded user:password');
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
33
|
let url = opts.artifactoryUrl;
|
|
39
34
|
const options = {
|
|
40
35
|
headers: {
|
|
@@ -48,11 +43,16 @@ url += (url.endsWith('/') ? '' : '/') +
|
|
|
48
43
|
logger.info(`Url called : ${url}`);
|
|
49
44
|
void (async () => {
|
|
50
45
|
logger.info(`Requesting old artifacts using ${url}`);
|
|
51
|
-
|
|
46
|
+
let responseSearch;
|
|
47
|
+
let responseSearchObj;
|
|
48
|
+
try {
|
|
49
|
+
responseSearch = await fetch(url, options);
|
|
50
|
+
responseSearchObj = await responseSearch.json();
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
52
53
|
logger.warn('No result found ', e);
|
|
53
54
|
process.exit(0);
|
|
54
|
-
}
|
|
55
|
-
const responseSearchObj = JSON.parse(responseSearch);
|
|
55
|
+
}
|
|
56
56
|
/** uris will contain the list of all artifacts that need to be deleted */
|
|
57
57
|
const uris = responseSearchObj.results
|
|
58
58
|
.map((res) => res.uri)
|
|
@@ -61,7 +61,7 @@ void (async () => {
|
|
|
61
61
|
for (const uri of uris) {
|
|
62
62
|
logger.info(`Deleting ${uri}...`);
|
|
63
63
|
if (!opts.dryRun) {
|
|
64
|
-
const response = await
|
|
64
|
+
const response = await fetch(uri, { ...options, method: 'DELETE' });
|
|
65
65
|
logger.info(response);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-cleaner.js","sourceRoot":"","sources":["../../../src/cli/artifact-cleaner.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"artifact-cleaner.js","sourceRoot":"","sources":["../../../src/cli/artifact-cleaner.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO;KACJ,WAAW,CAAC,mDAAmD,CAAC;KAChE,cAAc,CAAC,oCAAoC,EAAE,iBAAiB,CAAC;KACvE,cAAc,CAAC,6BAA6B,EAAE,uFAAuF,CAAC;KACtI,cAAc,CACb,mCAAmC,EACnC,yEAAyE,EACzE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CACpC;KACA,MAAM,CAAC,oCAAoC,EAAE,oGAAoG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC;KACxK,MAAM,CACL,gCAAgC,EAChC,+GAA+G,EAC/G,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAA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,CAAC;QACxB,CAAC;IACH,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { program } from 'commander';
|
|
3
|
-
import * as request from 'request-promise-native';
|
|
4
3
|
import * as winston from 'winston';
|
|
5
4
|
program
|
|
6
5
|
.description('Clean pr artifacts from artifactory repositories')
|
|
7
6
|
.requiredOption('-u, --artifactory-url <artifactoryUrl>', 'Artifactory URL')
|
|
8
|
-
.
|
|
9
|
-
.
|
|
10
|
-
.option('-
|
|
11
|
-
.option('-
|
|
12
|
-
.option('--dry-run', 'List all files that
|
|
7
|
+
.requiredOption('-r, --repository <repositoryName>', 'Artifact repository to clean up.')
|
|
8
|
+
.requiredOption('-p, --path <path>', 'Artifact paths to clean up (using matcher from AQL language). Be careful not to include release artifacts in the path.')
|
|
9
|
+
.option('-d, --duration-kept <numberOfDays>', 'All artifacts older than this value (in days) will be deleted.', (v) => +v, 1)
|
|
10
|
+
.option('-n, --pr-builds <prBuilds>', 'Number of PR build artifacts that will be kept.', (v) => +v, 1)
|
|
11
|
+
.option('--dry-run', 'List all files that would be deleted without actually deleting them', false)
|
|
13
12
|
.option('-a, --api-key <apiKey>', 'Artifactory API Key of the user that can be used to log in')
|
|
14
|
-
.option('-b, --basicAuth <base64>', '
|
|
15
|
-
.option('-v, --verbose', '
|
|
13
|
+
.option('-b, --basicAuth <base64>', 'Base64 encoding of username:password (password already encrypted from artifactory UI)')
|
|
14
|
+
.option('-v, --verbose', 'Display the executed AQL query')
|
|
16
15
|
.parse(process.argv);
|
|
17
16
|
const programOptions = program.opts();
|
|
18
17
|
const winstonOptions = {
|
|
@@ -33,7 +32,7 @@ const logger = winston.createLogger({
|
|
|
33
32
|
]
|
|
34
33
|
});
|
|
35
34
|
if (!programOptions.basicAuth && !programOptions.apiKey) {
|
|
36
|
-
logger.error('Authentication is mandatory, please specify a
|
|
35
|
+
logger.error('Authentication is mandatory, please specify a base64 encoded user:password with the -b parameter or an ApiKey with the -a parameter');
|
|
37
36
|
process.exit(1);
|
|
38
37
|
}
|
|
39
38
|
if (programOptions.basicAuth && programOptions.apiKey) {
|
|
@@ -45,7 +44,7 @@ const authHeader = programOptions.basicAuth ? { Authorization: `Basic ${programO
|
|
|
45
44
|
let url = programOptions.artifactoryUrl;
|
|
46
45
|
url += (url.endsWith('/') ? '' : '/') + 'api/search/aql';
|
|
47
46
|
const ageInDays = programOptions.durationKept;
|
|
48
|
-
const
|
|
47
|
+
const prBuilds = programOptions.prBuilds;
|
|
49
48
|
const repository = programOptions.repository;
|
|
50
49
|
const path = programOptions.path;
|
|
51
50
|
const options = {
|
|
@@ -67,61 +66,28 @@ const options = {
|
|
|
67
66
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
68
67
|
logger.debug(`AQL search executed : ${options.body}`);
|
|
69
68
|
logger.info(`Url called : ${url}`);
|
|
70
|
-
/**
|
|
71
|
-
* @param result
|
|
72
|
-
* @param result.repo
|
|
73
|
-
* @param result.path
|
|
74
|
-
* @param result.name
|
|
75
|
-
* @param pathWithoutBuildNumber
|
|
76
|
-
*/
|
|
77
|
-
function getUniqueId(result, pathWithoutBuildNumber) {
|
|
78
|
-
let mapId;
|
|
79
|
-
if (result.path.indexOf('.') !== -1 && result.path.indexOf('-') !== -1) {
|
|
80
|
-
const splittedPath = result.path.split('/');
|
|
81
|
-
const partialPathWithBuildNumber = splittedPath.find((currentPath) => currentPath.indexOf('.') !== -1);
|
|
82
|
-
if (partialPathWithBuildNumber) {
|
|
83
|
-
const splittedPartialPathWithDot = partialPathWithBuildNumber.split('.');
|
|
84
|
-
splittedPartialPathWithDot.splice(splittedPartialPathWithDot.length - 1, 1);
|
|
85
|
-
mapId = splittedPartialPathWithDot.join('.');
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
const splittedName = result.name.split('.');
|
|
89
|
-
const splittedNameDash = splittedName[splittedName.length - 2].split('-');
|
|
90
|
-
splittedNameDash.splice(0, 1);
|
|
91
|
-
splittedName[splittedName.length - 2] = splittedNameDash.join('-');
|
|
92
|
-
const nameWithoutBuildNumber = splittedName.join('.');
|
|
93
|
-
mapId = pathWithoutBuildNumber + '/' + nameWithoutBuildNumber;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
mapId = pathWithoutBuildNumber + result.name;
|
|
98
|
-
}
|
|
99
|
-
return mapId;
|
|
100
|
-
}
|
|
101
69
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
102
70
|
(async () => {
|
|
103
71
|
logger.info(`Requesting old artifacts using ${url}`);
|
|
104
72
|
let responseSearch;
|
|
73
|
+
let responseSearchObj;
|
|
105
74
|
try {
|
|
106
|
-
responseSearch = await
|
|
75
|
+
responseSearch = await fetch(url, { method: 'POST', headers: authHeader, body: options.body });
|
|
76
|
+
responseSearchObj = await responseSearch.json();
|
|
107
77
|
}
|
|
108
|
-
catch {
|
|
109
|
-
logger.warn('No result found %o',
|
|
78
|
+
catch (e) {
|
|
79
|
+
logger.warn('No result found %o', e);
|
|
110
80
|
process.exit(0);
|
|
111
81
|
}
|
|
112
|
-
const responseSearchObj = JSON.parse(responseSearch);
|
|
113
82
|
/** uris will contain the list of all artifacts that need to be deleted */
|
|
114
83
|
const mapOfKeptItems = new Map();
|
|
115
84
|
const mapOfKeptResult = new Map();
|
|
116
85
|
const resultToDelete = [];
|
|
117
86
|
const sortedResult = responseSearchObj.results.sort((a, b) => b.name.localeCompare(a.name));
|
|
118
87
|
for (const result of sortedResult) {
|
|
119
|
-
const
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
const pathWithoutBuildNumber = splittedPath.slice(0, -1).join('.');
|
|
123
|
-
const currentBuildNumber = +splittedPath[splittedPath.length - 1];
|
|
124
|
-
const mapId = getUniqueId(result, pathWithoutBuildNumber);
|
|
88
|
+
const splitPath = result.name.split('.');
|
|
89
|
+
const mapId = splitPath.slice(0, -2).join('.');
|
|
90
|
+
const currentBuildNumber = +splitPath[splitPath.length - 2];
|
|
125
91
|
const buildNumbers = mapOfKeptItems.get(mapId);
|
|
126
92
|
if (!buildNumbers) {
|
|
127
93
|
mapOfKeptItems.set(mapId, [currentBuildNumber]);
|
|
@@ -135,11 +101,11 @@ function getUniqueId(result, pathWithoutBuildNumber) {
|
|
|
135
101
|
isBuildNumberHigherThanExisting = isBuildNumberHigherThanExisting && (value < currentBuildNumber);
|
|
136
102
|
});
|
|
137
103
|
if (!isBuildNumberAlreadyInMap) {
|
|
138
|
-
if (buildNumbers.length >=
|
|
104
|
+
if (buildNumbers.length >= prBuilds && !isBuildNumberHigherThanExisting) {
|
|
139
105
|
resultToDelete.push(result);
|
|
140
106
|
}
|
|
141
107
|
else {
|
|
142
|
-
if (buildNumbers.length >=
|
|
108
|
+
if (buildNumbers.length >= prBuilds && isBuildNumberHigherThanExisting) {
|
|
143
109
|
const buildNumberToRemove = buildNumbers.shift();
|
|
144
110
|
if (buildNumberToRemove) {
|
|
145
111
|
const resultsToRemove = mapOfKeptResult.get(`${mapId}${buildNumberToRemove}`);
|
|
@@ -164,11 +130,11 @@ function getUniqueId(result, pathWithoutBuildNumber) {
|
|
|
164
130
|
}
|
|
165
131
|
}
|
|
166
132
|
logger.debug('Map of build that will be kept: %o', mapOfKeptItems);
|
|
167
|
-
const filesToDelete = resultToDelete.map((data) => programOptions.artifactoryUrl + repository + '/' + data.path + '/' + data.name);
|
|
133
|
+
const filesToDelete = resultToDelete.map((data) => programOptions.artifactoryUrl + (programOptions.artifactoryUrl.endsWith('/') ? '' : '/') + repository + '/' + data.path + '/' + data.name);
|
|
168
134
|
for (const uri of filesToDelete) {
|
|
169
135
|
logger.info(`Deleting ${uri}...`);
|
|
170
136
|
if (!programOptions.dryRun) {
|
|
171
|
-
const response = await
|
|
137
|
+
const response = await fetch(uri, { method: 'DELETE', headers: authHeader });
|
|
172
138
|
logger.info(response);
|
|
173
139
|
}
|
|
174
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-artifact-cleaner.js","sourceRoot":"","sources":["../../../src/cli/pr-artifact-cleaner.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"pr-artifact-cleaner.js","sourceRoot":"","sources":["../../../src/cli/pr-artifact-cleaner.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO;KACJ,WAAW,CAAC,kDAAkD,CAAC;KAC/D,cAAc,CAAC,wCAAwC,EAAE,iBAAiB,CAAC;KAC3E,cAAc,CAAC,mCAAmC,EAAE,kCAAkC,CAAC;KACvF,cAAc,CAAC,mBAAmB,EAAE,wHAAwH,CAAC;KAC7J,MAAM,CAAS,oCAAoC,EAAE,gEAAgE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;KACpI,MAAM,CAAS,4BAA4B,EAAE,iDAAiD,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;KAC7G,MAAM,CAAC,WAAW,EAAE,qEAAqE,EAAE,KAAK,CAAC;KACjG,MAAM,CAAC,wBAAwB,EAAE,4DAA4D,CAAC;KAC9F,MAAM,CAAC,0BAA0B,EAAE,uFAAuF,CAAC;KAC3H,MAAM,CAAC,eAAe,EAAE,gCAAgC,CAAC;KACzD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;AACtC,MAAM,cAAc,GAAG;IACrB,OAAO,EAAE;QACP,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAC5B,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,EAC5B,OAAO,CAA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cAAc,CAAC,GAAG,CACtC,CAAC,IAAI,EAAE,EAAE,CAAE,cAAc,CAAC,cAAyB,GAAG,CAAC,cAAc,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,CAChK,CAAC;IACF,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;QAChC,MAAM,CAAC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;YAC3B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAC,CAAC,CAAC;YAC3E,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-retriever.d.ts","sourceRoot":"","sources":["../../../src/cli/artifact-retriever.ts"],"names":[],"mappings":""}
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { program } from 'commander';
|
|
3
|
-
import * as fse from 'fs-extra';
|
|
4
|
-
import * as http from 'node:http';
|
|
5
|
-
import * as https from 'node:https';
|
|
6
|
-
import * as fs from 'node:fs';
|
|
7
|
-
import * as path from 'node:path';
|
|
8
|
-
import * as request from 'request-promise-native';
|
|
9
|
-
import * as winston from 'winston';
|
|
10
|
-
const SUPPORTED_REPOSITORY_MANAGERS = ['JFrog', 'Azure Artifacts'];
|
|
11
|
-
program
|
|
12
|
-
.description('Get an artifact from an Artifact repository manager')
|
|
13
|
-
.requiredOption('--registry <url>', 'Registry URL. It is ignored for Azure Artifacts.')
|
|
14
|
-
.option('--repository-manager <manager>', `Artifact repository manager. Supported managers are ${SUPPORTED_REPOSITORY_MANAGERS.join(', ')}`, 'JFrog')
|
|
15
|
-
.option('--organization <organization>', 'Azure Artifacts organization', undefined)
|
|
16
|
-
.option('--project <project>', 'Azure Artifacts project', undefined)
|
|
17
|
-
.option('--feed <feed>', 'Azure Artifacts feed', undefined)
|
|
18
|
-
.option('-a, --artifact-name <name>', 'Artifact name', undefined)
|
|
19
|
-
.option('-v, --artifact-version <version>', 'Artifact version', undefined)
|
|
20
|
-
.option('-g, --artifact-group-id <group>', 'Artifact group id', undefined)
|
|
21
|
-
.option('-r, --artifact-repos <repositories>', 'Artifact repositories', (repos) => repos.split(','), [])
|
|
22
|
-
.option('-u, --username <username>', 'Artifactory username', 'mvn-readonly')
|
|
23
|
-
.option('-p, --password <password>', 'Artifactory user password')
|
|
24
|
-
.option('--password_env_var <password_env_var>', 'Artifactory user password environment var', undefined)
|
|
25
|
-
.option('-o, --out <path>', 'Output file name (default: ./built/${name}.jar)', undefined)
|
|
26
|
-
.option('--silent', 'Prevent exit code 1 if artifact not found (Usage example : dep-checker with post-install scripts', false)
|
|
27
|
-
.option('--verbose', 'Display debug log message')
|
|
28
|
-
.option('--use-package-version', 'Use the package version as artifact version')
|
|
29
|
-
.parse(process.argv);
|
|
30
|
-
const opts = program.opts();
|
|
31
|
-
const logger = winston.createLogger({
|
|
32
|
-
level: opts.verbose ? 'debug' : 'info',
|
|
33
|
-
format: winston.format.simple(),
|
|
34
|
-
transports: new winston.transports.Console()
|
|
35
|
-
});
|
|
36
|
-
if (!SUPPORTED_REPOSITORY_MANAGERS.includes(opts.repositoryManager)) {
|
|
37
|
-
logger.error(`Unsupported repository manager: ${opts.repositoryManager}`);
|
|
38
|
-
process.exit(10);
|
|
39
|
-
}
|
|
40
|
-
if (opts.repositoryManager === 'Azure Artifacts') {
|
|
41
|
-
if (!opts.organization) {
|
|
42
|
-
logger.error('No organization specified for Azure Artifacts');
|
|
43
|
-
process.exit(11);
|
|
44
|
-
}
|
|
45
|
-
if (!opts.project) {
|
|
46
|
-
logger.error('No project specified for Azure Artifacts');
|
|
47
|
-
process.exit(12);
|
|
48
|
-
}
|
|
49
|
-
if (!opts.feed) {
|
|
50
|
-
logger.error('No feed specified for Azure Artifacts');
|
|
51
|
-
process.exit(13);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (!opts.artifactVersion && !opts.usePackageVersion) {
|
|
55
|
-
logger.error('No version specified');
|
|
56
|
-
process.exit(14);
|
|
57
|
-
}
|
|
58
|
-
if (!opts.artifactName) {
|
|
59
|
-
logger.error('No artifact name specified');
|
|
60
|
-
process.exit(15);
|
|
61
|
-
}
|
|
62
|
-
if (!opts.artifactGroupId) {
|
|
63
|
-
logger.error('No group id specified');
|
|
64
|
-
process.exit(16);
|
|
65
|
-
}
|
|
66
|
-
let url = opts.registry;
|
|
67
|
-
const jar = request.jar();
|
|
68
|
-
const options = { jar };
|
|
69
|
-
const password = opts.password || opts.password_env_var && process.env[opts.password_env_var];
|
|
70
|
-
if (opts.username && password) {
|
|
71
|
-
options.headers = {
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
73
|
-
Authorization: 'Basic ' + Buffer.from(`${opts.username}:${password}`).toString('base64')
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
const name = opts.artifactName;
|
|
77
|
-
const artifactGroupId = opts.artifactGroupId;
|
|
78
|
-
let version = opts.usePackageVersion ? require(path.resolve(process.cwd(), 'package.json')).version : opts.artifactVersion;
|
|
79
|
-
const filePath = opts.out || `./built/${name}.jar`;
|
|
80
|
-
fse.ensureDirSync(path.resolve(process.cwd(), path.dirname(filePath)));
|
|
81
|
-
/**
|
|
82
|
-
* Report error on artifact downloading
|
|
83
|
-
* @param e
|
|
84
|
-
*/
|
|
85
|
-
const reportError = (e) => {
|
|
86
|
-
logger.error(e);
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Download the specified Artifact on JFrog
|
|
90
|
-
*/
|
|
91
|
-
async function retrieveArtifactFromJFrog() {
|
|
92
|
-
logger.info(`Searching for ${name}@${version}`);
|
|
93
|
-
url += (url.endsWith('/') ? '' : '/') + `api/search/gavc?a=${name}&g=${artifactGroupId}`;
|
|
94
|
-
if (opts.artifactRepos && opts.artifactRepos.length) {
|
|
95
|
-
url += `&repos=${opts.artifactRepos.join(',')}`;
|
|
96
|
-
}
|
|
97
|
-
if (version.startsWith('0.0.0')) {
|
|
98
|
-
url += `&v=${version}`;
|
|
99
|
-
}
|
|
100
|
-
let responseSearch;
|
|
101
|
-
try {
|
|
102
|
-
responseSearch = await request.get(url, options).promise();
|
|
103
|
-
}
|
|
104
|
-
catch (err) {
|
|
105
|
-
logger.warn('First call to get artifact information failed, retries');
|
|
106
|
-
responseSearch = await request.get(url, options).promise();
|
|
107
|
-
}
|
|
108
|
-
// eslint-disable-next-line no-console
|
|
109
|
-
console.log(responseSearch);
|
|
110
|
-
const responseSearchObj = JSON.parse(responseSearch);
|
|
111
|
-
const uris = responseSearchObj.results
|
|
112
|
-
.map((res) => res.uri)
|
|
113
|
-
.filter((uri) => uri.endsWith('.jar'))
|
|
114
|
-
.sort((a, b) => {
|
|
115
|
-
if (a > b) {
|
|
116
|
-
return -1;
|
|
117
|
-
}
|
|
118
|
-
else if (a < b) {
|
|
119
|
-
return 1;
|
|
120
|
-
}
|
|
121
|
-
return 0;
|
|
122
|
-
});
|
|
123
|
-
if (uris.length) {
|
|
124
|
-
const artifactUrl = uris[0];
|
|
125
|
-
logger.info(`Call to ${artifactUrl}`);
|
|
126
|
-
const gavcResponse = await request.get(artifactUrl, options).promise();
|
|
127
|
-
logger.debug(`GavcResponse : ${gavcResponse}`);
|
|
128
|
-
const parsedGavcResponse = JSON.parse(gavcResponse);
|
|
129
|
-
const downloadUri = parsedGavcResponse.downloadUri;
|
|
130
|
-
logger.info(`Downloading artifact ${downloadUri}`);
|
|
131
|
-
const file = fs.createWriteStream(path.resolve(process.cwd(), filePath));
|
|
132
|
-
file.on('error', reportError);
|
|
133
|
-
const cookieString = jar.getCookieString(url);
|
|
134
|
-
const httpOptions = { headers: options.headers ? { ...options.headers, cookie: cookieString } : undefined };
|
|
135
|
-
if (artifactUrl.startsWith('https')) {
|
|
136
|
-
https.get(downloadUri, httpOptions, (response) => response.pipe(file)).on('error', reportError);
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
http.get(downloadUri, httpOptions, (response) => response.pipe(file)).on('error', reportError);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
if (opts.silent) {
|
|
144
|
-
logger.warn('No artifact found, silent mode ON, prevented the failure');
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
logger.error('No artifact found');
|
|
148
|
-
process.exit(2);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Get the latest version, if it exists, of the specified artifact
|
|
154
|
-
* @param packages Array of packages from the Azure feed
|
|
155
|
-
* @param artifactName Name of the artifact to get the latest version from
|
|
156
|
-
*/
|
|
157
|
-
function getLatestVersion(packages, artifactName) {
|
|
158
|
-
const normalizedArtifactName = `${artifactGroupId}:${artifactName}`.toLowerCase();
|
|
159
|
-
for (const pckg of packages) {
|
|
160
|
-
if (pckg.normalizedName === artifactName || pckg.normalizedName === normalizedArtifactName) {
|
|
161
|
-
const latestVersion = pckg.versions.find(v => v.isLatest);
|
|
162
|
-
if (!latestVersion) {
|
|
163
|
-
throw new Error(`No latest version found for ${artifactName}`);
|
|
164
|
-
}
|
|
165
|
-
return latestVersion.version;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
throw new Error(`No package ${artifactName} found`);
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Download the specified Artifact on Azure
|
|
172
|
-
*/
|
|
173
|
-
async function retrieveArtifactFromAzure() {
|
|
174
|
-
try {
|
|
175
|
-
if (version.startsWith('0.0.0')) {
|
|
176
|
-
// eslint-disable-next-line max-len
|
|
177
|
-
const res = await request.get(`https://feeds.dev.azure.com/${opts.organization}/${opts.project}/_apis/packaging/feeds/${opts.feed}/packages?api-version=6.0-preview.1`, options).promise();
|
|
178
|
-
version = getLatestVersion(JSON.parse(res).value, name);
|
|
179
|
-
}
|
|
180
|
-
logger.info(`Searching for ${name}@${version}`);
|
|
181
|
-
// eslint-disable-next-line max-len
|
|
182
|
-
url = `https://pkgs.dev.azure.com/${opts.organization}/${opts.project}/_apis/packaging/feeds/${opts.feed}/maven/${opts.artifactGroupId}/${name}/${version}/${name}-${version}.jar/content?api-version=6.0-preview.1`;
|
|
183
|
-
logger.info(`Call to ${url}`);
|
|
184
|
-
const downloadUri = await new Promise((resolve, reject) => {
|
|
185
|
-
https.get(url, options, (response) => resolve(response.headers.location)).on('error', reject);
|
|
186
|
-
});
|
|
187
|
-
if (!downloadUri) {
|
|
188
|
-
throw new Error(`Could not get the download url for the artifact ${name}`);
|
|
189
|
-
}
|
|
190
|
-
logger.info(`Downloading artifact ${downloadUri}`);
|
|
191
|
-
const file = fs.createWriteStream(path.resolve(process.cwd(), filePath));
|
|
192
|
-
file.on('error', reportError);
|
|
193
|
-
if (!downloadUri.startsWith('https')) {
|
|
194
|
-
throw new Error('Artifact must be downloaded using https protocol');
|
|
195
|
-
}
|
|
196
|
-
https.get(downloadUri, (response) => response.pipe(file)).on('error', reportError);
|
|
197
|
-
}
|
|
198
|
-
catch (e) {
|
|
199
|
-
if (opts.silent) {
|
|
200
|
-
logger.warn(e);
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
logger.error(e);
|
|
204
|
-
process.exit(3);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Download an artifact on the specified artifact repository manager
|
|
210
|
-
* @param registry Registry url
|
|
211
|
-
*/
|
|
212
|
-
function retrieveArtifact() {
|
|
213
|
-
switch (opts.repositoryManager) {
|
|
214
|
-
case 'JFrog': {
|
|
215
|
-
return retrieveArtifactFromJFrog();
|
|
216
|
-
}
|
|
217
|
-
case 'Azure Artifacts': {
|
|
218
|
-
return retrieveArtifactFromAzure();
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
void retrieveArtifact();
|
|
223
|
-
//# sourceMappingURL=artifact-retriever.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-retriever.js","sourceRoot":"","sources":["../../../src/cli/artifact-retriever.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,MAAM,6BAA6B,GAAG,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AAEnE,OAAO;KACJ,WAAW,CAAC,qDAAqD,CAAC;KAClE,cAAc,CAAC,kBAAkB,EAAE,kDAAkD,CAAC;KACtF,MAAM,CAAC,gCAAgC,EAAE,uDAAuD,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC;KACpJ,MAAM,CAAC,+BAA+B,EAAE,8BAA8B,EAAE,SAAS,CAAC;KAClF,MAAM,CAAC,qBAAqB,EAAE,yBAAyB,EAAE,SAAS,CAAC;KACnE,MAAM,CAAC,eAAe,EAAE,sBAAsB,EAAE,SAAS,CAAC;KAC1D,MAAM,CAAC,4BAA4B,EAAE,eAAe,EAAE,SAAS,CAAC;KAChE,MAAM,CAAC,kCAAkC,EAAE,kBAAkB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C;KACpF;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAChB;aAAM;YACL,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;KACF;AACH,CAAC;AACD;;;GAGG;AACH,SAAS,gBAAgB;IACvB,QAAQ,IAAI,CAAC,iBAAiB,EAAE;QAC9B,KAAK,OAAO,CAAC,CAAC;YACZ,OAAO,yBAAyB,EAAE,CAAC;SACpC;QACD,KAAK,iBAAiB,CAAC,CAAC;YACtB,OAAO,yBAAyB,EAAE,CAAC;SACpC;KACF;AACH,CAAC;AACD,KAAK,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export interface GavcResponse {
|
|
2
|
-
/** Ex : mvn-built */
|
|
3
|
-
repo: string;
|
|
4
|
-
/** Ex : /io/swagger/typescriptFetch-swagger-codegen/1.0.0/typescriptFetch-swagger-codegen-1.0.0.jar */
|
|
5
|
-
path: string;
|
|
6
|
-
/** Ex : 2018-07-06T17:14:14.123Z */
|
|
7
|
-
created: string;
|
|
8
|
-
/** Ex : anonymous */
|
|
9
|
-
createdBy: string;
|
|
10
|
-
/** Ex : 2018-07-06T17:14:14.031Z */
|
|
11
|
-
lastModified: string;
|
|
12
|
-
/** Ex : anonymous */
|
|
13
|
-
modifiedBy: string;
|
|
14
|
-
/** Ex : 2018-07-06T17:14:14.031Z */
|
|
15
|
-
lastUpdated: string;
|
|
16
|
-
/** Ex : https://jfrog.io/mvn-built/io/swagger/typescriptFetch-swagger-codegen/1.0.0/typescriptFetch-swagger-codegen-1.0.0.jar */
|
|
17
|
-
downloadUri: string;
|
|
18
|
-
/** Ex : application/java-archive */
|
|
19
|
-
mimeType: string;
|
|
20
|
-
/** Ex : 41800 */
|
|
21
|
-
size: 41800;
|
|
22
|
-
/**
|
|
23
|
-
* Ex :
|
|
24
|
-
* checksums : {
|
|
25
|
-
* sha1 : 4b12dc32f3ef1a10a872297423908b52bc1ce6ea;
|
|
26
|
-
* md5 : db17bea6a5f737f0644482055dcf2d36
|
|
27
|
-
* };
|
|
28
|
-
*/
|
|
29
|
-
checksums: {
|
|
30
|
-
sha1: string;
|
|
31
|
-
md5: string;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Ex :
|
|
35
|
-
* originalChecksums : {
|
|
36
|
-
* sha1 : b12dc32f3ef1a10a872297423908b52bc1ce6ea;
|
|
37
|
-
* md5 : db17bea6a5f737f0644482055dcf2d36
|
|
38
|
-
* };
|
|
39
|
-
*/
|
|
40
|
-
originalChecksums: {
|
|
41
|
-
sha1: string;
|
|
42
|
-
md5: string;
|
|
43
|
-
};
|
|
44
|
-
/** Ex : https://jfrog.io/api/storage/mvn-built/io/swagger/typescriptFetch-swagger-codegen/1.0.0/typescriptFetch-swagger-codegen-1.0.0.jar */
|
|
45
|
-
uri: string;
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=gavc-response.interfaces.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gavc-response.interfaces.d.ts","sourceRoot":"","sources":["../../../../src/helpers/gavc-response/gavc-response.interfaces.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IAEb,uGAAuG;IACvG,IAAI,EAAE,MAAM,CAAC;IAEb,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAEhB,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAElB,oCAAoC;IACpC,YAAY,EAAE,MAAM,CAAC;IAErB,qBAAqB;IACrB,UAAU,EAAE,MAAM,CAAC;IAEnB,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IAEpB,iIAAiI;IACjI,WAAW,EAAE,MAAM,CAAC;IAEpB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IAEjB,iBAAiB;IACjB,IAAI,EAAE,KAAK,CAAC;IAEZ;;;;;;OAMG;IACH,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAEzC;;;;;;OAMG;IACH,iBAAiB,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAEjD,6IAA6I;IAC7I,GAAG,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gavc-response.interfaces.js","sourceRoot":"","sources":["../../../../src/helpers/gavc-response/gavc-response.interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/helpers/gavc-response/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/helpers/gavc-response/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
package/src/helpers/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
package/src/helpers/index.js
DELETED
package/src/helpers/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
package/src/public_api.d.ts
DELETED
package/src/public_api.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"public_api.d.ts","sourceRoot":"","sources":["../../src/public_api.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
package/src/public_api.js
DELETED
package/src/public_api.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"public_api.js","sourceRoot":"","sources":["../../src/public_api.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|