From 8b4703111c8139976bef43e11fbc6c4874ac60f3 Mon Sep 17 00:00:00 2001 From: smerle33 Date: Wed, 8 Jan 2025 17:35:54 +0100 Subject: [PATCH] chore(updatecli/ruby): add a manifest to link the docker image for ruby aligned with packer-image version --- updatecli/updatecli.d/ruby-documentation.yaml | 114 ++++++++++++++++++ updatecli/updatecli.d/ruby.yaml | 104 +++++----------- 2 files changed, 143 insertions(+), 75 deletions(-) create mode 100644 updatecli/updatecli.d/ruby-documentation.yaml diff --git a/updatecli/updatecli.d/ruby-documentation.yaml b/updatecli/updatecli.d/ruby-documentation.yaml new file mode 100644 index 000000000000..7986d9eef9a7 --- /dev/null +++ b/updatecli/updatecli.d/ruby-documentation.yaml @@ -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 diff --git a/updatecli/updatecli.d/ruby.yaml b/updatecli/updatecli.d/ruby.yaml index 7986d9eef9a7..443c61a7c221 100644 --- a/updatecli/updatecli.d/ruby.yaml +++ b/updatecli/updatecli.d/ruby.yaml @@ -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: @@ -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