Skip to content

Commit

Permalink
Merge branch 'master' into jenkins-design-library
Browse files Browse the repository at this point in the history
  • Loading branch information
gounthar authored Jan 8, 2025
2 parents 08eaad1 + 9d0f12b commit 6156dd3
Show file tree
Hide file tree
Showing 8 changed files with 217 additions and 85 deletions.
2 changes: 1 addition & 1 deletion STYLEGUIDE.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ node {
// Declarative //
pipeline {
agent { docker { image 'node:22.12.0-alpine3.21' } }
agent { docker { image 'node:22.13.0-alpine3.21' } }
stages {
stage('Build') {
sh 'npm install'
Expand Down
10 changes: 5 additions & 5 deletions content/doc/book/pipeline/docker.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Any tool that can be link:https://hub.docker.com[packaged in a Docker container]
// Declarative //
pipeline {
agent {
docker { image 'node:22.12.0-alpine3.21' }
docker { image 'node:22.13.0-alpine3.21' }
}
stages {
stage('Test') {
Expand All @@ -45,7 +45,7 @@ pipeline {
// Script //
node {
/* Requires the Docker Pipeline plugin to be installed */
docker.image('node:22.12.0-alpine3.21').inside {
docker.image('node:22.13.0-alpine3.21').inside {
stage('Test') {
sh 'node --eval "console.log(process.platform,process.env.CI)"'
}
Expand Down Expand Up @@ -177,7 +177,7 @@ pipeline {
}
stage('Front-end') {
agent {
docker { image 'node:22.12.0-alpine3.21' }
docker { image 'node:22.13.0-alpine3.21' }
}
steps {
sh 'node --version'
Expand All @@ -196,7 +196,7 @@ node {
}
stage('Front-end') {
docker.image('node:22.12.0-alpine3.21').inside {
docker.image('node:22.13.0-alpine3.21').inside {
sh 'node --version'
}
}
Expand All @@ -214,7 +214,7 @@ Reusing an example from above, with a more custom `Dockerfile`:
.Dockerfile
[source]
----
FROM node:22.12.0-alpine3.21
FROM node:22.13.0-alpine3.21
RUN apk add -U subversion
----
Expand Down
4 changes: 2 additions & 2 deletions content/doc/pipeline/tour/agents.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ link:/doc/book/pipeline/syntax#agent[syntax reference].
// Declarative //
pipeline {
agent {
docker { image 'node:22.12.0-alpine3.21' }
docker { image 'node:22.13.0-alpine3.21' }
}
stages {
stage('Test') {
Expand All @@ -61,7 +61,7 @@ pipeline {
// Script //
node {
/* Requires the Docker Pipeline plugin to be installed */
docker.image('node:22.12.0-alpine3.21').inside {
docker.image('node:22.13.0-alpine3.21').inside {
stage('Test') {
sh 'node --eval "console.log(process.arch,process.platform)"'
}
Expand Down
4 changes: 2 additions & 2 deletions content/doc/pipeline/tour/hello-world.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ node {
// Declarative //
/* Requires the Docker Pipeline plugin */
pipeline {
agent { docker { image 'node:22.12.0-alpine3.21' } }
agent { docker { image 'node:22.13.0-alpine3.21' } }
stages {
stage('build') {
steps {
Expand All @@ -96,7 +96,7 @@ pipeline {
/* Requires the Docker Pipeline plugin */
node {
stage('Build') {
docker.image('node:22.12.0-alpine3.21').inside {
docker.image('node:22.13.0-alpine3.21').inside {
sh 'node --version'
}
}
Expand Down
22 changes: 22 additions & 0 deletions updatecli/scripts/update-security-txt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Read the date after "Expires:"
expires_date=$(grep -oP 'Expires: \K.*' content/.well-known/security.txt)

# Convert the expires date to seconds since epoch
expires_epoch=$(date -d "$expires_date" +%s)

# Get the current date in seconds since epoch
current_epoch=$(date +%s)

# Calculate the difference in seconds (30 days * 24 hours * 60 minutes * 60 seconds)
one_month_seconds=$((30 * 24 * 60 * 60))

# Check if the current date is less than one month close to the expires date
if (( current_epoch + one_month_seconds >= expires_epoch )); then
# Add one year to the expires date
new_expires_date=$(date -u -d "$expires_date + 1 year" +%Y-%m-%dT%H:%M:%S.000Z)
echo "$new_expires_date"
else
echo "$expires_date"
fi
114 changes: 114 additions & 0 deletions updatecli/updatecli.d/ruby-documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
name: Bumps the ruby docker images versions in the documentation

scms:
default:
kind: github
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"
ruby:
kind: github
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "ruby"
repository: "ruby"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"

sources:
alpineLatestVersion:
kind: githubrelease
name: "Get the latest Alpine Linux version"
spec:
owner: "alpinelinux"
repository: "aports" # Its release process follows Alpine's
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
versionfilter:
kind: semver
pattern: "~3"
transformers:
- findsubmatch:
pattern: >-
v(.*)(\.\d+)
captureindex: 1
rubyDockerImageLatestVersion:
kind: dockerimage
name: "Get the latest Ruby version"
spec:
image: "ruby"
tagFilter: >-
\d\.\d\.\d$
versionfilter:
kind: regex
pattern: >-
\d\.\d\.\d$
rubyLatestVersion:
kind: gittag
name: "Get the latest Ruby version"
scmid: ruby
spec:
versionfilter:
kind: regex
pattern: >-
v3_\d+\d+$
transformers:
- removesuffix: "v"

conditions:
testRubyAlpineImagePublished:
name: "Test ruby:3.x.x-alpine-3.xx docker image tag"
kind: dockerimage
disablesourceinput: true
spec:
image: "ruby"
tag: '{{ source "rubyDockerImageLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}'
testRubyAlpineArg:
name: "Does the 'Hello World!' tutorial have a reference to the ruby alpine image?"
kind: file
disablesourceinput: true
spec:
file: content/doc/pipeline/tour/hello-world.adoc
matchpattern: >-
.*agent.*docker.*image.*ruby:.*
targets:
updateHelloWorldTutorialRubyPipeline:
name: "Update the value of the ruby docker image for pipelines in the 'Hello World!' tutorial"
kind: file
sourceid: rubyLatestVersion
spec:
file: content/doc/pipeline/tour/hello-world.adoc
matchpattern: >-
(.*agent.*docker.*image.*\')ruby:(.*)(\'.*)
replacepattern: >-
${1}ruby:{{ source "rubyDockerImageLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
scmid: default
updateHelloWorldTutorialRubyScripted:
name: "Update the value of the ruby docker image for scripts in the 'Hello World!' tutorial"
kind: file
sourceid: rubyLatestVersion
spec:
file: content/doc/pipeline/tour/hello-world.adoc
matchpattern: >-
(.*docker.*image.*\')ruby:(.*)(\'.*)
replacepattern: >-
${1}ruby:{{ source "rubyDockerImageLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
scmid: default

actions:
default:
kind: github/pullrequest
scmid: default
title: '[Ruby Tutorial] Bump ruby alpine docker image version to {{ source "rubyDockerImageLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}'
spec:
labels:
- dependencies
104 changes: 29 additions & 75 deletions updatecli/updatecli.d/ruby.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Bumps the ruby docker images versions in the documentation
name: Bump Ruby version (docker image) to follow packer-image infra version

scms:
default:
Expand All @@ -12,103 +12,57 @@ scms:
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"
ruby:
kind: github
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "ruby"
repository: "ruby"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"

sources:
alpineLatestVersion:
kind: githubrelease
name: "Get the latest Alpine Linux version"
getDeployedPackerImageVersion:
kind: file
name: Retrieve the current version of the Packer images used in production
spec:
owner: "alpinelinux"
repository: "aports" # Its release process follows Alpine's
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
versionfilter:
kind: semver
pattern: "~3"
file: https://raw.githubusercontent.com/jenkins-infra/kubernetes-management/refs/heads/main/config/jenkins_infra.ci.jenkins.io.yaml
matchpattern: 'galleryImageVersion:\s"(.*)"'
transformers:
- findsubmatch:
pattern: >-
v(.*)(\.\d+)
pattern: 'galleryImageVersion:\s"(.*)"'
captureindex: 1
rubyDockerImageLatestVersion:
kind: dockerimage
name: "Get the latest Ruby version"
spec:
image: "ruby"
tagFilter: >-
\d\.\d\.\d$
versionfilter:
kind: regex
pattern: >-
\d\.\d\.\d$
rubyLatestVersion:
kind: gittag
name: "Get the latest Ruby version"
scmid: ruby
getRubyVersionFromPackerImages:
kind: file
name: Get the latest Maven version set in packer-images
dependson:
- getDeployedPackerImageVersion
spec:
versionfilter:
kind: regex
pattern: >-
v3_\d+\d+$
file: https://raw.githubusercontent.com/jenkins-infra/packer-images/{{ source "getDeployedPackerImageVersion" }}/provisioning/tools-versions.yml
matchpattern: 'ruby_version:\s(.*)'
transformers:
- removesuffix: "v"
- findsubmatch:
pattern: 'ruby_version:\s(.*)'
captureindex: 1

conditions:
testRubyAlpineImagePublished:
name: "Test ruby:3.x.x-alpine-3.xx docker image tag"
checkDockerImagePublished:
name: Test ruby:{{ source "getRubyVersionFromPackerImages" }} docker image tag
sourceid: getRubyVersionFromPackerImages
kind: dockerimage
disablesourceinput: true
spec:
image: "ruby"
tag: '{{ source "rubyDockerImageLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}'
testRubyAlpineArg:
name: "Does the 'Hello World!' tutorial have a reference to the ruby alpine image?"
kind: file
disablesourceinput: true
spec:
file: content/doc/pipeline/tour/hello-world.adoc
matchpattern: >-
.*agent.*docker.*image.*ruby:.*
## Tag from source

targets:
updateHelloWorldTutorialRubyPipeline:
name: "Update the value of the ruby docker image for pipelines in the 'Hello World!' tutorial"
kind: file
sourceid: rubyLatestVersion
spec:
file: content/doc/pipeline/tour/hello-world.adoc
matchpattern: >-
(.*agent.*docker.*image.*\')ruby:(.*)(\'.*)
replacepattern: >-
${1}ruby:{{ source "rubyDockerImageLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
scmid: default
updateHelloWorldTutorialRubyScripted:
name: "Update the value of the ruby docker image for scripts in the 'Hello World!' tutorial"
setRubyImageVersion:
name: "Bump Ruby Image version in scripts ruby"
kind: file
sourceid: rubyLatestVersion
sourceid: getRubyVersionFromPackerImages
spec:
file: content/doc/pipeline/tour/hello-world.adoc
matchpattern: >-
(.*docker.*image.*\')ruby:(.*)(\'.*)
replacepattern: >-
${1}ruby:{{ source "rubyDockerImageLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}${3}
file: scripts/ruby
matchpattern: 'CONTAINER_NAME=ruby:.*'
replacepattern: 'CONTAINER_NAME=ruby:{{ source "getRubyVersionFromPackerImages" }}'
scmid: default

actions:
default:
kind: github/pullrequest
scmid: default
title: '[Ruby Tutorial] Bump ruby alpine docker image version to {{ source "rubyDockerImageLatestVersion" }}-alpine{{ source "alpineLatestVersion" }}'
title: Bump Ruby Image version in scripts/ruby to {{ source "getRubyVersionFromPackerImages" }} the same as the packer-image in production
spec:
labels:
- dependencies
- ruby
Loading

0 comments on commit 6156dd3

Please sign in to comment.