Unable to use variable in matrix for container image #11544

Open
opened 2025-11-02 09:40:41 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @plinss on GitHub (Aug 26, 2023).

Originally assigned to: @fuxiaohei on GitHub.

Description

I'm trying to use a repository variable in a matrix and then use the matrix variable for a container image, like:

---
name: testing

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  run_test:
    strategy:
      matrix:
        version: ${{ fromJSON(vars.PYTHON_VERSIONS) }}

    runs-on:
      - ubuntu-latest

    container: python:${{ matrix.version }}-bookworm

    steps:
      - run: echo "${{ vars.PYTHON_VERSIONS }}"

      - run: python --version

With the variable set to: ["3.10", "3.11"]

The idea is to specify the versions of Python to run self tests against as repository variables, allowing workflow file re-use on multiple Python modules.

This works on GitHub, but fails on Gitea with the error: unable to determine if image already exists for image 'python:-bookworm' (): Error response from daemon: invalid reference format

Note that is does work if I specify the matrix variable entirely in the workflow file, e.g.:

  run_test:
    strategy:
      matrix:
        version:
          - 3.10
          - 3.11

It seems the variables are being processed too late.

See https://github.com/plinss/matrix-test for an example.

Possibly related to #26307

Gitea Version

Nightly from 08/24/2023

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Debian Bookworm

How are you running Gitea?

Built, systemd service

Database

PostgreSQL

Originally created by @plinss on GitHub (Aug 26, 2023). Originally assigned to: @fuxiaohei on GitHub. ### Description I'm trying to use a repository variable in a matrix and then use the matrix variable for a container image, like: ``` --- name: testing on: push: pull_request: workflow_dispatch: jobs: run_test: strategy: matrix: version: ${{ fromJSON(vars.PYTHON_VERSIONS) }} runs-on: - ubuntu-latest container: python:${{ matrix.version }}-bookworm steps: - run: echo "${{ vars.PYTHON_VERSIONS }}" - run: python --version ``` With the variable set to: `["3.10", "3.11"]` The idea is to specify the versions of Python to run self tests against as repository variables, allowing workflow file re-use on multiple Python modules. This works on GitHub, but fails on Gitea with the error: `unable to determine if image already exists for image 'python:-bookworm' (): Error response from daemon: invalid reference format` Note that is does work if I specify the matrix variable entirely in the workflow file, e.g.: ``` run_test: strategy: matrix: version: - 3.10 - 3.11 ``` It seems the variables are being processed too late. See https://github.com/plinss/matrix-test for an example. Possibly related to #26307 ### Gitea Version Nightly from 08/24/2023 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System Debian Bookworm ### How are you running Gitea? Built, systemd service ### Database PostgreSQL
GiteaMirror added the topic/gitea-actionstype/bug labels 2025-11-02 09:40:42 -06:00
Author
Owner

@wolfogre commented on GitHub (Sep 4, 2023):

It's not upstream-related, I'm pretty sure it's a bug of Gitea - it doesn't fill context variables when expand matrix to generate jobs.

@wolfogre commented on GitHub (Sep 4, 2023): It's not upstream-related, I'm pretty sure it's a bug of Gitea - it doesn't fill context variables when expand matrix to generate jobs.
Author
Owner

@h0tw1r3 commented on GitHub (Mar 2, 2024):

Related to #28207

@h0tw1r3 commented on GitHub (Mar 2, 2024): Related to #28207
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11544