Skip to content

Commit cf5f143

Browse files
authored
Node: track .node-version and scripts/node via packer-images; split manifests (#8522)
* Add .node-version and scripts/node tracking to updatecli - Add setNodeVersionFile target to track .node-version - Add setNodeImageVersion target to track scripts/node - Update PR title to reflect version updates in dev files and docs Fixes #8515 (PR 2) * Node: split manifests and track CI agent version via packer-images
1 parent 60e0afa commit cf5f143

File tree

3 files changed

+214
-134
lines changed

3 files changed

+214
-134
lines changed

README.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ If you're interested in contributing to the site, please see our
1515
link:https://github.com/jenkins-infra/jenkins.io/blob/master/CONTRIBUTING.adoc[Contributing document]
1616

1717
Documentation for Jenkins website maintenance is in the https://github.com/jenkins-infra/jenkins.io/blob/master/CONTRIBUTING.adoc#maintainer-guide[maintainers guidelines].
18+
19+
NOTE: This project uses specific Ruby and Node.js versions defined in `.ruby-version` and `.node-version`. These files are kept in sync with our CI environment via Updatecli.
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
---
2+
name: Bumps the node docker images versions
3+
4+
scms:
5+
default:
6+
kind: github
7+
spec:
8+
user: "{{ .github.user }}"
9+
email: "{{ .github.email }}"
10+
owner: "{{ .github.owner }}"
11+
repository: "{{ .github.repository }}"
12+
token: "{{ requiredEnv .github.token }}"
13+
username: "{{ .github.username }}"
14+
branch: "{{ .github.branch }}"
15+
16+
sources:
17+
nodeLatestLTSVersionFromJson:
18+
name: Get value from json
19+
kind: json
20+
spec:
21+
file: https://nodejs.org/dist/index.json
22+
key: .(lts!=false).version
23+
transformers:
24+
- trimprefix: "v"
25+
26+
# Using the githubrelease allows us to retrieve the changelog information
27+
# It will fail if the version mentioned by appVersion does not have an equivalent published
28+
# GitHub release
29+
nodeLatestVersion:
30+
kind: githubrelease
31+
name: Get latest nodejs version
32+
dependson:
33+
- nodeLatestLTSVersionFromJson
34+
spec:
35+
owner: "nodejs"
36+
repository: "node"
37+
token: "{{ requiredEnv .github.token }}"
38+
username: "{{ .github.username }}"
39+
versionfilter:
40+
kind: semver
41+
pattern: '{{ source "nodeLatestLTSVersionFromJson" }}'
42+
transformers:
43+
- trimprefix: "v"
44+
alpineLatestVersion:
45+
kind: githubrelease
46+
name: "Get the latest Alpine Linux version"
47+
spec:
48+
owner: "alpinelinux"
49+
repository: "aports" # Its release process follows Alpine's
50+
token: "{{ requiredEnv .github.token }}"
51+
username: "{{ .github.username }}"
52+
versionfilter:
53+
kind: semver
54+
pattern: "~3"
55+
transformers:
56+
- findsubmatch:
57+
pattern: >-
58+
v(.*)(\.\d+)
59+
captureindex: 1
60+
61+
conditions:
62+
testNodeArg:
63+
name: "Does the 'Hello World!' tutorial have a reference to the Node alpine image?"
64+
kind: file
65+
disablesourceinput: true
66+
spec:
67+
file: content/doc/pipeline/tour/hello-world.adoc
68+
matchpattern: >-
69+
.*agent.*docker.*image.*node:.*
70+
testNodeInAgentsDocumentation:
71+
name: "Does the 'Defining execution environments' documentation have a reference to the Node alpine image?"
72+
kind: file
73+
disablesourceinput: true
74+
spec:
75+
file: content/doc/pipeline/tour/agents.adoc
76+
matchpattern: >-
77+
.*docker.*image.*node:.*
78+
testNodeInStyleGuideDocumentation:
79+
name: "Does the 'Jenkins Documentation Style Guide' documentation have a reference to the Node alpine image?"
80+
kind: file
81+
disablesourceinput: true
82+
spec:
83+
file: STYLEGUIDE.adoc
84+
matchpattern: >-
85+
.*docker.*image.*node:.*
86+
testNodeInUsingDockerWithPipelineDocumentation:
87+
name: "Does the 'Using Docker with Pipeline' documentation have a reference to the Node alpine image?"
88+
kind: file
89+
disablesourceinput: true
90+
spec:
91+
file: content/doc/book/pipeline/docker.adoc
92+
matchpattern: >-
93+
.*image.*node:.*
94+
testNodeAlpineImagePublished:
95+
name: "Test node:<latest_version>-alpine<latest-version> docker image tag"
96+
kind: dockerimage
97+
disablesourceinput: true
98+
spec:
99+
image: "node"
100+
tag: '{{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}'
101+
102+
targets:
103+
updateHelloWorldTutorialNodePipeline:
104+
name: "Update the value of the node docker image for pipelines in the 'Hello World!' tutorial"
105+
kind: file
106+
sourceid: nodeLatestVersion
107+
spec:
108+
file: content/doc/pipeline/tour/hello-world.adoc
109+
matchpattern: >-
110+
(.*agent.*docker.*image.*\')node:(.*)(\'.*)
111+
replacepattern: >-
112+
${1}node:{{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
113+
scmid: default
114+
updateHelloWorldTutorialNodeScripted:
115+
name: "Update the value of the node docker image for scripts in the 'Hello World!' tutorial"
116+
kind: file
117+
sourceid: nodeLatestVersion
118+
spec:
119+
file: content/doc/pipeline/tour/hello-world.adoc
120+
matchpattern: >-
121+
(.*docker.*image.*\')node:(.*)(\'.*)
122+
replacepattern: >-
123+
${1}node:{{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
124+
scmid: default
125+
updateAgentsDocumentation:
126+
name: "Update the value of the node docker image in the 'Defining execution environments' documentation"
127+
kind: file
128+
sourceid: nodeLatestVersion
129+
spec:
130+
file: content/doc/pipeline/tour/agents.adoc
131+
matchpattern: >-
132+
(.*docker.*image.*\')node:(.*)(\'.*)
133+
replacepattern: >-
134+
${1}node:{{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
135+
scmid: default
136+
updateStyleGuideDocumentation:
137+
name: "Update the value of the node docker image in the 'Jenkins Documentation Style Guide' documentation"
138+
kind: file
139+
sourceid: nodeLatestVersion
140+
spec:
141+
file: STYLEGUIDE.adoc
142+
matchpattern: >-
143+
(.*docker.*image.*\')node:(.*)(\'.*)
144+
replacepattern: >-
145+
${1}node:{{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
146+
scmid: default
147+
updateUsingDockerWithPipelineDocumentation:
148+
name: "Update the value of the node docker image in the 'Using Docker with Pipeline' documentation"
149+
kind: file
150+
sourceid: nodeLatestVersion
151+
spec:
152+
file: content/doc/book/pipeline/docker.adoc
153+
matchpattern: >-
154+
(.*image.*\')node:(.*)(\'.*)
155+
replacepattern: >-
156+
${1}node:{{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
157+
scmid: default
158+
updateUsingDockerWithPipelineDocumentationDockerExample:
159+
name: "Update the value of the node docker image in the 'Using Docker with Pipeline' documentation"
160+
kind: file
161+
sourceid: nodeLatestVersion
162+
spec:
163+
file: content/doc/book/pipeline/docker.adoc
164+
matchpattern: >-
165+
(FROM )node:(.*)(.*)
166+
replacepattern: >-
167+
${1}node:{{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
168+
scmid: default
169+
170+
actions:
171+
default:
172+
kind: github/pullrequest
173+
scmid: default
174+
title: 'Bump node LTS version to {{ source "nodeLatestLTSVersionFromJson" }} (alpine {{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }})'
175+
spec:
176+
labels:
177+
- dependencies
178+
179+

updatecli/updatecli.d/node.yaml

Lines changed: 33 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Bumps the node docker images versions
2+
name: Bump NodeJS version (docker image) to follow packer-image infra version
33

44
scms:
55
default:
@@ -14,163 +14,62 @@ scms:
1414
branch: "{{ .github.branch }}"
1515

1616
sources:
17-
nodeLatestLTSVersionFromJson:
18-
name: Get value from json
19-
kind: json
17+
getDeployedPackerImageVersion:
18+
kind: file
19+
name: Retrieve the current version of the Packer images used in production
2020
spec:
21-
file: https://nodejs.org/dist/index.json
22-
key: .(lts!=false).version
21+
file: https://raw.githubusercontent.com/jenkins-infra/kubernetes-management/refs/heads/main/config/jenkins_infra.ci.jenkins.io.yaml
22+
matchpattern: 'galleryImageVersion:\s"(.*)"'
2323
transformers:
24-
- trimprefix: "v"
25-
26-
# Using the githubrelease allows us to retrieve the changelog information
27-
# It will fail if the version mentioned by appVersion does not have an equivalent published
28-
# GitHub release
29-
nodeLatestVersion:
30-
kind: githubrelease
31-
name: Get latest nodejs version
24+
- findsubmatch:
25+
pattern: 'galleryImageVersion:\s"(.*)"'
26+
captureindex: 1
27+
getNodeVersionFromPackerImages:
28+
kind: file
29+
name: Get the NodeJS version set in packer-images
3230
dependson:
33-
- nodeLatestLTSVersionFromJson
34-
spec:
35-
owner: "nodejs"
36-
repository: "node"
37-
token: "{{ requiredEnv .github.token }}"
38-
username: "{{ .github.username }}"
39-
versionfilter:
40-
kind: semver
41-
pattern: '{{ source "nodeLatestLTSVersionFromJson" }}'
42-
transformers:
43-
- trimprefix: "v"
44-
alpineLatestVersion:
45-
kind: githubrelease
46-
name: "Get the latest Alpine Linux version"
31+
- getDeployedPackerImageVersion
4732
spec:
48-
owner: "alpinelinux"
49-
repository: "aports" # Its release process follows Alpine's
50-
token: "{{ requiredEnv .github.token }}"
51-
username: "{{ .github.username }}"
52-
versionfilter:
53-
kind: semver
54-
pattern: "~3"
33+
file: https://raw.githubusercontent.com/jenkins-infra/packer-images/{{ source "getDeployedPackerImageVersion" }}/provisioning/tools-versions.yml
34+
matchpattern: 'node.*_version:\s(.*)'
5535
transformers:
5636
- findsubmatch:
57-
pattern: >-
58-
v(.*)(\.\d+)
37+
pattern: 'node.*_version:\s(.*)'
5938
captureindex: 1
6039

6140
conditions:
62-
testNodeArg:
63-
name: "Does the 'Hello World!' tutorial have a reference to the Node alpine image?"
64-
kind: file
65-
disablesourceinput: true
66-
spec:
67-
file: content/doc/pipeline/tour/hello-world.adoc
68-
matchpattern: >-
69-
.*agent.*docker.*image.*node:.*
70-
testNodeInAgentsDocumentation:
71-
name: "Does the 'Defining execution environments' documentation have a reference to the Node alpine image?"
72-
kind: file
73-
disablesourceinput: true
74-
spec:
75-
file: content/doc/pipeline/tour/agents.adoc
76-
matchpattern: >-
77-
.*docker.*image.*node:.*
78-
testNodeInStyleGuideDocumentation:
79-
name: "Does the 'Jenkins Documentation Style Guide' documentation have a reference to the Node alpine image?"
80-
kind: file
81-
disablesourceinput: true
82-
spec:
83-
file: STYLEGUIDE.adoc
84-
matchpattern: >-
85-
.*docker.*image.*node:.*
86-
testNodeInUsingDockerWithPipelineDocumentation:
87-
name: "Does the 'Using Docker with Pipeline' documentation have a reference to the Node alpine image?"
88-
kind: file
89-
disablesourceinput: true
90-
spec:
91-
file: content/doc/book/pipeline/docker.adoc
92-
matchpattern: >-
93-
.*image.*node:.*
94-
testNodeAlpineImagePublished:
95-
name: "Test node:<latest_version>-alpine<latest-version> docker image tag"
41+
checkDockerImagePublished:
42+
name: Test node:{{ source "getNodeVersionFromPackerImages" }} docker image tag
43+
sourceid: getNodeVersionFromPackerImages
9644
kind: dockerimage
97-
disablesourceinput: true
9845
spec:
9946
image: "node"
100-
tag: '{{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}'
47+
## Tag from source
10148

10249
targets:
103-
updateHelloWorldTutorialNodePipeline:
104-
name: "Update the value of the node docker image for pipelines in the 'Hello World!' tutorial"
105-
kind: file
106-
sourceid: nodeLatestVersion
107-
spec:
108-
file: content/doc/pipeline/tour/hello-world.adoc
109-
matchpattern: >-
110-
(.*agent.*docker.*image.*\')node:(.*)(\'.*)
111-
replacepattern: >-
112-
${1}node:{{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
113-
scmid: default
114-
updateHelloWorldTutorialNodeScripted:
115-
name: "Update the value of the node docker image for scripts in the 'Hello World!' tutorial"
116-
kind: file
117-
sourceid: nodeLatestVersion
118-
spec:
119-
file: content/doc/pipeline/tour/hello-world.adoc
120-
matchpattern: >-
121-
(.*docker.*image.*\')node:(.*)(\'.*)
122-
replacepattern: >-
123-
${1}node:{{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
124-
scmid: default
125-
updateAgentsDocumentation:
126-
name: "Update the value of the node docker image in the 'Defining execution environments' documentation"
127-
kind: file
128-
sourceid: nodeLatestVersion
129-
spec:
130-
file: content/doc/pipeline/tour/agents.adoc
131-
matchpattern: >-
132-
(.*docker.*image.*\')node:(.*)(\'.*)
133-
replacepattern: >-
134-
${1}node:{{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
135-
scmid: default
136-
updateStyleGuideDocumentation:
137-
name: "Update the value of the node docker image in the 'Jenkins Documentation Style Guide' documentation"
50+
setNodeImageVersion:
51+
name: "Bump Node Image version in scripts/node"
13852
kind: file
139-
sourceid: nodeLatestVersion
53+
sourceid: getNodeVersionFromPackerImages
14054
spec:
141-
file: STYLEGUIDE.adoc
142-
matchpattern: >-
143-
(.*docker.*image.*\')node:(.*)(\'.*)
144-
replacepattern: >-
145-
${1}node:{{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
55+
file: scripts/node
56+
matchpattern: 'CONTAINER_NAME=node:.*'
57+
replacepattern: 'CONTAINER_NAME=node:{{ source "getNodeVersionFromPackerImages" }}'
14658
scmid: default
147-
updateUsingDockerWithPipelineDocumentation:
148-
name: "Update the value of the node docker image in the 'Using Docker with Pipeline' documentation"
59+
setNodeVersionFile:
60+
name: "Bump Node version in .node-version"
14961
kind: file
150-
sourceid: nodeLatestVersion
62+
sourceid: getNodeVersionFromPackerImages
15163
spec:
152-
file: content/doc/book/pipeline/docker.adoc
153-
matchpattern: >-
154-
(.*image.*\')node:(.*)(\'.*)
155-
replacepattern: >-
156-
${1}node:{{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
157-
scmid: default
158-
updateUsingDockerWithPipelineDocumentationDockerExample:
159-
name: "Update the value of the node docker image in the 'Using Docker with Pipeline' documentation"
160-
kind: file
161-
sourceid: nodeLatestVersion
162-
spec:
163-
file: content/doc/book/pipeline/docker.adoc
164-
matchpattern: >-
165-
(FROM )node:(.*)(.*)
166-
replacepattern: >-
167-
${1}node:{{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
64+
file: .node-version
16865
scmid: default
66+
16967
actions:
17068
default:
17169
kind: github/pullrequest
17270
scmid: default
173-
title: '[Tutorials and Agents Docs] Bump node LTS alpine docker image version to {{ source "nodeLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}'
71+
title: Bump Node version to {{ source "getNodeVersionFromPackerImages" }} to match packer-images in production
17472
spec:
17573
labels:
17674
- dependencies
75+
- nodejs

0 commit comments

Comments
 (0)