Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix for matrix format in docker scheduled workflow (#20358)

Cyril Rohr8917c92fb541
diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml
index f3ed1d66f33..32b5e65f25c 100644
--- a/.github/workflows/docker-release.yml
+++ b/.github/workflows/docker-release.yml
@@ -38,8 +38,8 @@ jobs:
BRANCH_REF="dev"
fi
- echo "branch=$BRANCH_REF" >> "$GITHUB_OUTPUT"
- echo "tag=$TAG_REF" >> "$GITHUB_OUTPUT"
+ echo "branch=$BRANCH_REF" | tee -a "$GITHUB_OUTPUT"
+ echo "tag=$TAG_REF" | tee -a "$GITHUB_OUTPUT"
build:
needs: compute-inputs
diff --git a/.github/workflows/docker-scheduled.yml b/.github/workflows/docker-scheduled.yml
index 102e391a601..c51b42dbe48 100644
--- a/.github/workflows/docker-scheduled.yml
+++ b/.github/workflows/docker-scheduled.yml
@@ -12,17 +12,16 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
- name: Generate matrix
id: set-matrix
- run: |
- matrix=$(ruby script/gh/docker-tags.rb --matrix)
- echo "matrix=$matrix" >> $GITHUB_OUTPUT
+ run: ruby script/gh/docker-tags.rb --matrix
build:
needs: generate-matrix
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
+ fail-fast: false
uses: ./.github/workflows/docker.yml
with:
branch: ${{ matrix.branch }}
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 182a424ed82..d82e93ef545 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -31,8 +31,22 @@ jobs:
- name: Set version outputs and convert tags
id: extract_version
run: |
- echo "version=$(./script/gh/docker-tags.rb "${{ inputs.tag }}" --version)" >> "$GITHUB_OUTPUT"
- echo "docker_tags=$(./script/gh/docker-tags.rb "${{ inputs.tag }}" --format-for-docker)" >> "$GITHUB_OUTPUT"
+ set -e
+ echo "Processing tag: ${{ inputs.tag }}"
+ ./script/gh/docker-tags.rb "${{ inputs.tag }}" --version
+ ./script/gh/docker-tags.rb "${{ inputs.tag }}" --format-for-docker
+ - name: Verify outputs
+ run: |
+ if [ -z "${{ steps.extract_version.outputs.version }}" ]; then
+ echo "Error: version output is empty"
+ exit 1
+ fi
+ if [ -z "${{ steps.extract_version.outputs.docker_tags }}" ]; then
+ echo "Error: docker_tags output is empty"
+ exit 1
+ fi
+ echo "✓ version: ${{ steps.extract_version.outputs.version }}"
+ echo "✓ docker_tags: ${{ steps.extract_version.outputs.docker_tags }}"
- name: Cache NPM
uses: runs-on/cache@v4
with:
@@ -65,7 +79,7 @@ jobs:
- uses: actions/upload-artifact@v4
with:
path: public/
- name: public-assets-${{ inputs.branch }}-${{ github.sha }}
+ name: public-assets-${{ inputs.tag }}-${{ github.sha }}
overwrite: true
# Since v4.4, hidden files are excluded by default.
# We need to include public/assets/.sprockets-manifest-*.json
@@ -113,7 +127,7 @@ jobs:
- name: Download precompiled public assets
uses: actions/download-artifact@v5
with:
- name: public-assets-${{ inputs.branch }}-${{ github.sha }}
+ name: public-assets-${{ inputs.tag }}-${{ github.sha }}
path: public/
- name: Setup precompiled assets
run: |
@@ -240,7 +254,7 @@ jobs:
- name: Upload digest
uses: actions/upload-artifact@v4
with:
- name: digests-${{ matrix.target }}-${{ matrix.digest }}
+ name: digests-${{ inputs.tag }}-${{ matrix.target }}-${{ matrix.digest }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
@@ -256,13 +270,13 @@ jobs:
- name: Merge digests
uses: actions/upload-artifact/merge@v4
with:
- pattern: "digests-${{ matrix.target }}-*"
+ pattern: "digests-${{ inputs.tag }}-${{ matrix.target }}-${{ matrix.digest }}*"
overwrite: true
- name: "merged-digests-${{ matrix.target }}-${{ github.run_number }}-${{ github.run_attempt }}"
+ name: "merged-digests-${{ inputs.tag }}-${{ matrix.target }}-${{ github.run_number }}-${{ github.run_attempt }}"
- name: Download digests
uses: actions/download-artifact@v5
with:
- name: "merged-digests-${{ matrix.target }}-${{ github.run_number }}-${{ github.run_attempt }}"
+ name: "merged-digests-${{ inputs.tag }}-${{ matrix.target }}-${{ github.run_number }}-${{ github.run_attempt }}"
path: /tmp/digests
- name: Set suffix
id: set_suffix
diff --git a/script/gh/docker-tags.rb b/script/gh/docker-tags.rb
index 6eec3aad841..3c6c46224ec 100755
--- a/script/gh/docker-tags.rb
+++ b/script/gh/docker-tags.rb
@@ -23,10 +23,10 @@ def generate_matrix
{
"include" => [
- {
- "branch" => "dev",
- "tag" => "dev"
- },
+ # {
+ # "branch" => "dev",
+ # "tag" => "dev"
+ # },
{
"branch" => "release/#{latest_version}",
"tag" => "#{latest_version}-rc"
@@ -89,6 +89,27 @@ class Tag
end
end
+def write_to_github_output(key, value)
+ return unless ENV["GITHUB_OUTPUT"]
+
+ puts "Writing '#{key}' to GitHub output..."
+
+ if value.nil? || value.strip.empty?
+ puts "Error: '#{key}' output is empty"
+ exit 1
+ end
+
+ File.open(ENV["GITHUB_OUTPUT"], "a") do |f|
+ if value.include?("\n")
+ f.puts "#{key}<<EOF"
+ f.puts value
+ f.puts "EOF"
+ else
+ f.puts "#{key}=#{value}"
+ end
+ end
+end
+
def main # rubocop:disable Metrics/AbcSize
options = {}
OptionParser.new do |opts|
@@ -111,7 +132,9 @@ def main # rubocop:disable Metrics/AbcSize
if options[:matrix]
matrix = generate_matrix
if matrix
- puts JSON.pretty_generate(matrix)
+ output = JSON.generate(matrix)
+ puts output
+ write_to_github_output("matrix", output)
else
puts "Error: Could not generate matrix"
exit 1
@@ -119,9 +142,13 @@ def main # rubocop:disable Metrics/AbcSize
else
tag = Tag.new(ARGV.first)
if options[:version]
- puts tag.version
+ output = tag.version
+ puts output
+ write_to_github_output("version", output)
elsif options[:format_for_docker]
- puts tag.to_semver_docker_tags.join("\n")
+ output = tag.to_semver_docker_tags.join("\n")
+ puts output
+ write_to_github_output("docker_tags", output)
else
puts "Error: Must specify either --version, --format-for-docker, or --matrix"
exit 1