Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use variable in matrix for container image #26749

Open
plinss opened this issue Aug 26, 2023 · 2 comments
Open

Unable to use variable in matrix for container image #26749

plinss opened this issue Aug 26, 2023 · 2 comments
Assignees
Labels
topic/gitea-actions related to the actions of Gitea type/bug

Comments

@plinss
Copy link

plinss commented Aug 26, 2023

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

@techknowlogick techknowlogick added the type/upstream This is an issue in one of Gitea's dependencies and should be reported there label Aug 27, 2023
@wolfogre
Copy link
Member

wolfogre commented 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 wolfogre added topic/gitea-actions related to the actions of Gitea and removed type/upstream This is an issue in one of Gitea's dependencies and should be reported there labels Sep 4, 2023
@fuxiaohei fuxiaohei self-assigned this Nov 17, 2023
@h0tw1r3
Copy link

h0tw1r3 commented Mar 2, 2024

Related to #28207

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/gitea-actions related to the actions of Gitea type/bug
Projects
None yet
Development

No branches or pull requests

5 participants