Skip to content

Commit 594a923

Browse files
committed
We can't update docker manifest with another tag name
1 parent db44271 commit 594a923

2 files changed

Lines changed: 20 additions & 13 deletions

File tree

.github/workflows/build.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,3 @@ jobs:
146146
ruby_version="${{ env.ruby_version }}" \
147147
ubuntu_version="${{ matrix.ubuntu_version }}" \
148148
image_version_suffix=${{ matrix.image_version_suffix }}
149-
150-
- name: Push the same image without the ubuntu version
151-
if: matrix.ubuntu_version == 'noble'
152-
run: |-
153-
docker tag ${{ matrix.registry_name }}/ruby:${{ env.ruby_version }}${{ matrix.image_version_suffix }}-${{ matrix.ubuntu_version }} ${{ matrix.registry_name }}/ruby:${{ env.ruby_version }}${{ matrix.image_version_suffix }}
154-
docker push ${{ matrix.registry_name }}/ruby:${{ env.ruby_version }}${{ matrix.image_version_suffix }}
155-
156-
- name: Push the latest image
157-
if: matrix.ubuntu_version == 'noble' && contains(${{ env.ruby_version }}, '3.4.') && matrix.image_version_suffix == ''
158-
run: |-
159-
docker tag ${{ matrix.registry_name }}/ruby:${{ env.ruby_version }} ${{ matrix.registry_name }}/ruby:latest
160-
docker push ${{ matrix.registry_name }}/ruby:latest

Rakefile

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
LATEST_UBUNTU_VERSION = "jammy"
1+
LATEST_UBUNTU_VERSION = "noble"
2+
LATEST_RUBY_VERSION = "3.4"
23

34
def download(url)
45
require "net/http"
@@ -271,8 +272,17 @@ namespace :docker do
271272
['--amend', manifest_name]
272273
}.flatten
273274

275+
latest_tag = nil
274276
tags.each do |tag|
275277
sh 'docker', 'manifest', 'create', "#{tag}", *amend_args
278+
if tag =~ /#{LATEST_UBUNTU_VERSION}/
279+
non_ubuntu_tag = tag.sub(/-#{LATEST_UBUNTU_VERSION}/, '')
280+
sh 'docker', 'manifest', 'create', "#{non_ubuntu_tag}", *amend_args
281+
if image_version_suffix.empty? && ruby_version =~ /^#{LATEST_RUBY_VERSION}/ && latest_tag.nil?
282+
latest_tag = tag.sub(/#{ruby_version}-#{LATEST_UBUNTU_VERSION}/, "latest")
283+
sh 'docker', 'manifest', 'create', "#{latest_tag}", *amend_args
284+
end
285+
end
276286
end
277287
end
278288

@@ -282,8 +292,17 @@ namespace :docker do
282292

283293
_, tags = make_tags(ruby_version, image_version_suffix)
284294

295+
latest_tag = nil
285296
tags.each do |tag|
286297
sh 'docker', 'manifest', 'push', "#{tag}"
298+
if tag =~ /#{LATEST_UBUNTU_VERSION}/
299+
non_ubuntu_tag = tag.sub(/-#{LATEST_UBUNTU_VERSION}/, '')
300+
sh 'docker', 'manifest', 'push', "#{non_ubuntu_tag}"
301+
if image_version_suffix.empty? && ruby_version =~ /^#{LATEST_RUBY_VERSION}/ && latest_tag.nil?
302+
latest_tag = tag.sub(/#{ruby_version}-#{LATEST_UBUNTU_VERSION}/, "latest")
303+
sh 'docker', 'manifest', 'push', "#{latest_tag}"
304+
end
305+
end
287306
end
288307
end
289308
end

0 commit comments

Comments
 (0)