@@ -4,6 +4,128 @@ import { presets } from './custom-managers';
4
4
import { regexMatches } from '~test/util' ;
5
5
6
6
describe ( 'config/presets/internal/custom-managers' , ( ) => {
7
+ describe ( 'Update `_VERSION` environment variables in Azure Pipelines files' , ( ) => {
8
+ const customManager = presets . azurePipelinesVersions . customManagers ?. [ 0 ] ;
9
+
10
+ it ( `find dependencies in file` , async ( ) => {
11
+ const fileContent = codeBlock `
12
+ trigger:
13
+ - main
14
+
15
+ pool:
16
+ vmImage: ubuntu-latest
17
+
18
+ jobs:
19
+ - job: Work
20
+ steps:
21
+ - script: echo Hello, world!
22
+ displayName: 'Run a one-line script'
23
+ env:
24
+ # renovate: datasource=node depName=node versioning=node
25
+ NODE_VERSION: 18.13.0
26
+ # renovate: datasource=npm depName=pnpm
27
+ PNPM_VERSION: "7.25.1"
28
+ # renovate: datasource=npm depName=yarn
29
+ YARN_VERSION: '3.3.1'
30
+ # renovate: datasource=custom.hashicorp depName=consul
31
+ CONSUL_VERSION: 1.3.1
32
+ # renovate: datasource=github-releases depName=hashicorp/terraform versioning=hashicorp extractVersion=^v(?<version>.+)$
33
+ TERRAFORM_VERSION: 1.5.7
34
+ # renovate: datasource=github-releases depName=kubernetes-sigs/kustomize versioning=regex:^(?<compatibility>.+)/v(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)$
35
+ KUSTOMIZE_VERSION: kustomize/v5.2.1
36
+ - script: echo Hello, world!
37
+ displayName: 'Run a one-line script'
38
+ ` ;
39
+
40
+ const res = await extractPackageFile (
41
+ 'regex' ,
42
+ fileContent ,
43
+ 'azure-pipelines.yaml' ,
44
+ customManager ! ,
45
+ ) ;
46
+
47
+ expect ( res ?. deps ) . toMatchObject ( [
48
+ {
49
+ currentValue : '18.13.0' ,
50
+ datasource : 'node-version' ,
51
+ depName : 'node' ,
52
+ replaceString :
53
+ '# renovate: datasource=node depName=node versioning=node\n NODE_VERSION: 18.13.0\n' ,
54
+ versioning : 'node' ,
55
+ } ,
56
+ {
57
+ currentValue : '7.25.1' ,
58
+ datasource : 'npm' ,
59
+ depName : 'pnpm' ,
60
+ replaceString :
61
+ '# renovate: datasource=npm depName=pnpm\n PNPM_VERSION: "7.25.1"\n' ,
62
+ } ,
63
+ {
64
+ currentValue : '3.3.1' ,
65
+ datasource : 'npm' ,
66
+ depName : 'yarn' ,
67
+ replaceString :
68
+ "# renovate: datasource=npm depName=yarn\n YARN_VERSION: '3.3.1'\n" ,
69
+ } ,
70
+ {
71
+ currentValue : '1.3.1' ,
72
+ datasource : 'custom.hashicorp' ,
73
+ depName : 'consul' ,
74
+ replaceString :
75
+ '# renovate: datasource=custom.hashicorp depName=consul\n CONSUL_VERSION: 1.3.1\n' ,
76
+ } ,
77
+ {
78
+ currentValue : '1.5.7' ,
79
+ datasource : 'github-releases' ,
80
+ depName : 'hashicorp/terraform' ,
81
+ replaceString :
82
+ '# renovate: datasource=github-releases depName=hashicorp/terraform versioning=hashicorp extractVersion=^v(?<version>.+)$\n TERRAFORM_VERSION: 1.5.7\n' ,
83
+ versioning : 'hashicorp' ,
84
+ extractVersion : '^v(?<version>.+)$' ,
85
+ } ,
86
+ {
87
+ currentValue : 'kustomize/v5.2.1' ,
88
+ datasource : 'github-releases' ,
89
+ depName : 'kubernetes-sigs/kustomize' ,
90
+ replaceString :
91
+ '# renovate: datasource=github-releases depName=kubernetes-sigs/kustomize versioning=regex:^(?<compatibility>.+)/v(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)$\n KUSTOMIZE_VERSION: kustomize/v5.2.1\n' ,
92
+ versioning :
93
+ 'regex:^(?<compatibility>.+)/v(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)$' ,
94
+ } ,
95
+ ] ) ;
96
+ } ) ;
97
+
98
+ describe ( 'matches regexes patterns' , ( ) => {
99
+ it . each `
100
+ path | expected
101
+ ${ '.azuredevops/bar.yml' } | ${ true }
102
+ ${ '.azuredevops/bar.yaml' } | ${ true }
103
+ ${ '.azuredevops/foo/bar.yml' } | ${ true }
104
+ ${ '.azuredevops/foo/bar.yaml' } | ${ true }
105
+ ${ 'foo/.azuredevops/bar.yml' } | ${ true }
106
+ ${ 'foo/.azuredevops/bar.yaml' } | ${ true }
107
+ ${ 'foo/.azuredevops/foo/bar.yml' } | ${ true }
108
+ ${ 'foo/.azuredevops/foo/bar.yaml' } | ${ true }
109
+ ${ 'azurepipelines.yml' } | ${ true }
110
+ ${ 'azurepipelines.yaml' } | ${ true }
111
+ ${ 'azure-pipelines.yml' } | ${ true }
112
+ ${ 'azure-pipelines.yaml' } | ${ true }
113
+ ${ 'azure-pipelines-foo.yml' } | ${ true }
114
+ ${ 'azure-pipelines-foo.yaml' } | ${ true }
115
+ ${ 'azure-foo-pipelines.yml' } | ${ true }
116
+ ${ 'azure-foo-pipelines.yaml' } | ${ true }
117
+ ${ 'azurepipelinesfoo.yml' } | ${ true }
118
+ ${ 'azurepipelinesfoo.yaml' } | ${ true }
119
+ ${ 'azurefoopipelines.yml' } | ${ true }
120
+ ${ 'azurefoopipelines.yaml' } | ${ true }
121
+ ${ 'foo.yml' } | ${ false }
122
+ ${ 'foo.yaml' } | ${ false }
123
+ ` ( '$path' , ( { path, expected } ) => {
124
+ expect ( regexMatches ( path , customManager ! . fileMatch ) ) . toBe ( expected ) ;
125
+ } ) ;
126
+ } ) ;
127
+ } ) ;
128
+
7
129
describe ( 'Update `$schema` version in biome.json' , ( ) => {
8
130
const customManager = presets . biomeVersions . customManagers ?. [ 0 ] ;
9
131
0 commit comments